Please share this web-app with as many people interested in Assembly or the compiler theory (or even just retroinformatics) as you can. I've put a lot of effort into making it.

Arithmetic Expression Compiler

_
x
AEC
Enter an arithmetic expression here:



Choose the Assembly syntax:
Verbose output:

Tokenized:

Parsed (AST converted to an S-expression):

Compiled (to x86 assembly, Intel Syntax):

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). To test the code the compiler generates, you can download the fully-prepared project file (for your arithmetic expression) that can be compiled using FlatAssembler on Windows by clicking here (although it works in Internet Explorer 6, it doesn't work in some later browsers). (UPDATE: Now that this website is hosted at GitHub, it won't work in any browser because GitHub doesn't let me run my PHP on their servers.) In case that doesn't work, you can download an example testing project here (comments are in Croatian). If you want to have a command-line app with the same functionality and some more (if-else, while-loops, arrays, the support for the assembly language compilers that don't support automatic floating-point-to-IEEE754 conversion...), you can download the source code of the version of this app runnable in Duktape (a lightweight and easy-to-use alternative to NodeJS, it's written in C99 and basically requires only a modern C compiler to work, it also works under FreeDOS) here (or, if you are willing to risk getting viruses from my computer, you can download the executable files for 32-bit Windows, 32-bit Linux and FreeDOS from GitHub here.). (UPDATE: If you just need the automatic decimal-number-to-IEEE754 conversion, you don't actually need to download it, you only need to run this web-page in a modern browser (that supports ArrayBuffer). Also, now there is a version that can be run in NodeJS, it can be downloaded here, maybe it comes useful to somebody. Thanks to supporting GNU Assembler, which is a, if you ask me, a rather bad assembler, but it's used by GNU Compiler Collection, it's relatively easy to write a part of the program in the ArithmeticExpressionCompiler language and a part of it in, for example, C++. You can see an example of a complicated algorithm implemented in ArithmeticExpressionCompiler, its example C++ wrapper and download the executables for Linux, FreeDOS and Windows. Comments are in Croatian, because it was intended for specific Croatian-speaking audience. You can also see step-by-step instructions for compiling ArithmeticExpressionCompiler programs in this video.) You can also download a Notepad++ script for syntax-highlighting of that language here. Neither do I, nor do the creators of FlatAssembler, nor does 000webhost (a Cyprus-based company hosting this website, (UPDATE: 000webhost has banned me for "hate speech", so I moved my site to GitHub.)), claim any liability for the damage those programs may do to your computer. It's a part of the Terms of Service for me not to make scripts that install executable files to your computer. Scripts that produce compilable Assembly language files do not violate the Terms of Service as they are not executable files themselves. However, once they are compiled using FlatAssembler, nobody can guarantee you (including the antivirus software) they won't do any damage to your computer. It is not my intention to damage your device, but remember that if you compile the files you download here (using FlatAssembler), you will be running arbitrary Assembly language code on your computer, and be careful with it (for maximal security, I'd recommend using some virtual machine software).
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 on 18/10/2018: If you have a modern browser, you can see the AST diagram 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 03/08/2020: I've started to develop a version of this program which doesn't target x86 processors, but WebAssembly (the JavaScript bytecode, which Mozilla has been pushing to get standardized, so that people can run programming languages better than JavaScript in a browser). Right now, it's in the very early stages of development, but you can see a program I've made today in it. I have been rewriting the compiler from scratch in C++, because most experienced programmers consider it to be a better language than JavaScript.

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.

AEC
Arithmetic
Expression
Compiler