JSFiddle - React, Tailwind, and code Playground

by Conor O'Brien

HTML

<h1>META</h1>
<h2>(META External Transpiling Application)</h2>
<textarea id="code"></textarea><button id="submit">Submit</button>

CSS

@import url(https://fonts.googleapis.com/css?family=Raleway:400,200,700);html{font-family:Raleway,sans-serif;}h1,h2{margin:0;}pre,code,textarea{font-family:Consolas,monospace;}textarea{width:90%;height:15em;}

JavaScript

/*
Compiles a program using the code as a data layout.

*/

function META(code){
	var layout = code.split("\n").map(function(e){return e.split("");});
  code = code.replace(/\s/g,"");
  var con = "'";
  var ptr = {
  	x: 0,
    y: 0
  };
  for(var i=0;i<code.length;i++){
  	var chr = layout[ptr.y][ptr.x];
    switch(code[i]){
    	case "v":
      	ptr.y++;
      	break;
    	case "^":
      	ptr.y--;
      	break;
    	case ">":
      	ptr.x++;
      	break;
    	case "<":
      	ptr.x--;
      	break;
      case ";":
      	console.log(chr);
      	con += atob(chr+chr+"==");
        break;
      case ":":
      	console.log(chr);
      	con += atob(atob(chr+chr+"==")+chr+"==");
        break;
      case ".":
      	console.log(chr);
      	con += String.fromCharCode(127-atob(chr+chr+"==").charCodeAt());
        break;
      case ",":
      	console.log(chr);
      	con += atob(chr+String.fromCharCode(127-chr.charCodeAt())+"==");
        break;
      case "!":
      	console.log(chr);
      	con += String.fromCharCode(chr.charCodeAt()>>2^94);
      	break;
      case "?":
      	console.log(chr);
      	con += String.fromCharCode((chr.charCodeAt()*3>>3)+(chr.charCodeAt()>>5));
        break;
      case "{":
      	console.log("{");
      	con += "'+eval('";
      	break;
      case "}":
      	con += "')+'";
        break;
    }
  }
  con += "'";
  console.log(con);
  console.log(eval(con));
  eval(eval(con));
}
submit.addEventListener("click",function(){
	META(code.value);
});