The final language can be found in the github repo. Version notes right here:


Use the app online

You can use this application online in the tools section here.

Use the app on you webpage

You have created your own super cool webpage and so on ... Copy both lcalc.js and stack.js into some directory of you webpage. Include them or copy the code. Remember that stack.js is used by lcalc.js - that is insert the former first. Now say the program you want to evaluate is placed in prg.innerHTML. First define a printing function like this. Define a new instance of llang as so

var llang = new LambdaLang(); var tval = llang.evalPrg(prg.innerHTML); if(tval.error){ document.write("error!"); // in this case tval.msg contains error msg document.write(tval.msg); } else { document.write("success"); // in this case tval.res contains the result document.write(tval.res); }

You might benefit from encapsulating the second line in a try ... catch statement in order to report infinite recursion and other internal errors.

Along with pulling the repo comes the file lcalc.html - this contains a full version of the above you can play around with. Furthermore the file tests.html comes along. In this a series of tests is executed.


You can compress the .js files using some compressor. If you care about the size, you can erase the error message strings found in the actionTable near line 182. Just replace them with empty strings.