Ian's Javascript Expression Compiler Beta Demo Page
(update 17/10/25 view source links now all work correctly.)
(Version 7.37 6/2/19 ? works mostly ok.
)
(The development of this program/demo was rather halted due to
having to spend time to do with an elderly relative.
This version is not 100% debugged, but I thought I would put
it up anyway.)
About
If you aren't familiar with compilers, look at the compile and run and graph equation box lower down the page.
Bugs are:-
String literal expressions will compile but not run.
Arithmetic operators of same priority probably associate right to left not left to right at the moment.
Arity on functions is not checked so if you type in the wrong number of paramaters to a function it will
create a stack error at run time.
I think there is a bug in parsing function parameter lists, the cure is probably to use brackets to avoid
ambiguity.
Good luck!
View Source Code:
View file: comp_exp_tst1.html
View file: orgsite.css
View file: ai_demo_compiler_parser_upm_1.css
View file: ai_demo_ajax_interface_upm_7.js
View file: ai_demo_comp_pars_txt_edit_upm_7.js
View file: comp_opcodes1_upm_js7.js
View file: comp_runtime1_two_vers_05_upm_js7.js
View file: comp_equations1_upm_js7.js
View file: comp_buttons1_upm_js7.js
View file: ai_demo_cmp_exp_dsp_tree_1.js
View file: ai_demo_label_extensions_upm_1.js
View file: ai_demo_comp_expcomp_upm_1.js
View file: orgsite.js
What is a compiler? Look at Wikipedia entry
What is an expression compiler? It is a small compiler than parses/compiles an arithmetic expression only
(not a whole proper program), then creates some kind of computer friendly intermediate code, which, if run,
will compute the value of the arithmetic expression.
Buttons Help: Click on the for help on the button to the left. Click here for help about this.
To Choose, Compile and Run and Graph an
equation, do the following.
(You will then have to close the graph window using the close graph window button.)
You can view and edit the text in the Compiler Input Text Box (see lower down the page) and try to compile and run it again.
You can also view the parse tree output (displayed lower down the page) using the button.
Or you can also view the output intermediate object code (displayed lower down the page (see Program Output) using the button.
Compiler Input Text Box
Gptr text
Old Test Buttons (These are a bit out of date at the moment, see lower down for the right buttons to use.)
Click the buttons to run the tests if you want, or see the help.