JSFiddle - React, Tailwind, and code Playground
by puckipedia
JavaScript
lisp = {
const: {
sf: "(",
sp: " ",
ef: ")"
},
parse: function(str) {
s = str.split("");
out = {};
t = ["","",""];
a = 0;
for(var i in s) {
j = s[i];
switch(a) {
case 0:
if(j == lisp.const.sf) {
a = 1;
console.log("found starter!")
t[0] = {fn: "", args: []};
}
break;
case 1:
if(j == lisp.const.sp && t[0].fn != "") {
a = 2;
console.log("end of fn");
t[1] = 0;
}else if(j != lisp.const.sp) {
t[0].fn += j;
}
break;
}
}
},
functions: {
"+": function(a,b) {
return a+b;
}
}
}