Choose the Assembly syntax:
Parsed (AST converted to an S-expression):
Compiled (to x86 assembly
Interpreter output: null
WARNING: The tokenizer, the parser and the compiler appear to generate correct results, but they haven't been rigorously tested. Also, no optimization is being performed (aside from perhaps the code being the one it's easiest to compile into). If you want a web-app that uses well-tested compilation algorithms and optimizes the assembly code it outputs, try GodBolt.
By the way, if you ever find yourself having to use a programming language without a built-in math library, here is an example of how to make a simple math library in less than 150 lines of code. You can also see a diagram showing how accurate the functions there are for various inputs. (I had to do that in my programming language when writing Analog Clock for WebAssembly, because WebAssembly doesn't provide fsin and similar instructions.)
UPDATE on 15/10/2018: You can download my presentation (in Croatian) about how the compilers work here (It's a ZIP archive containing an ODP file, a PPT file and a PDF file, all saved from Impress. Hopefully, your computer can usefully open at least one of those files!). (UPDATE: A way better version, written more than a year later, is available here.) (UPDATE: About a year later, I've written an English-language version. You can see a YouTube video, and, if your browser does not support streaming MP4 videos, you can download an MP4 file and open it in VLC or something like that.)
UPDATE on 18/10/2018: If you have a modern browser, you can see the AST diagram (tree diagram, also known as syntax tree) by clicking here (it requires a relatively advanced SVG support, seen in, for example, Internet Explorer 11). If you don't have, don't worry, graphical representations of complex (that can't be done by hand) ASTs are useless (the maximal depth of a useful graphical AST is probably around 5).
UPDATE on 07/08/2020: Perhaps a lot better proof of the concept that my programming language can be used on the web is my implementation of the permutations algorithm in it.
UPDATE on 30/08/2020: I've written an informal specification for my programming language.
UPDATE on 19/07/2021: Please note that this compiler has a bug related to the way the ternary conditional operator
?:is compiled. In short, do not use it as to protect yourself against the division by zero and similar errors, it will not work then, because the second and the third operand are computed before the first operand that is the condition. I am sorry about that, but, given the way this compiler is structured (because I made the core of it back when I was only 18), there does not appear to be a simple solution. The compiler for my programming language that is targetting WebAssembly is significantly more professionally made.
UPDATE on 18/01/2023: I've written a shell script so that you can more easily try out this compiler in a Unix shell:
mkdir ArithmeticExpressionCompiler cd ArithmeticExpressionCompiler if [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ] # Check if "wget" exists, see those StackOverflow answers for more details: # https://stackoverflow.com/a/75103891/8902065 # https://stackoverflow.com/a/75103209/8902065 then wget https://flatassembler.github.io/Duktape.zip else curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip fi unzip Duktape.zip if [ $(command -v clang > /dev/null 2>&1 ; echo $?) -eq 0 ] # We prefer "clang" to "gcc" because... what if somebody tries to run this in CygWin terminal? GCC will not work then, CLANG might. then c_compiler="clang" else c_compiler="gcc" fi $c_compiler -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message. if [ "$OS" = "Windows_NT" ] then ./aec analogClockForWindows.aec $c_compiler -o analogClockForWindows analogClockForWindows.s -m32 ./analogClockForWindows else ./aec analogClock.aec $c_compiler -o analogClock analogClock.s -m32 ./analogClock fiIf everything is fine, the Analog Clock program should now print the current time in the terminal. I think this would work on the vast majority of Linux machines, as well as on many non-Linux (FreeBSD, Solaris...) machines, and on some Windows machines with a Unix shell (such as Git Bash).