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, apparently runnable only on Pentium Pro and newer processors, 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). If you want a web-app that uses well-tested compilation algorithms and optimizes the assembly code it outputs, try GodBolt. 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 executable files 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 or GNU Assembler), 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, but notice that DosBox does not emulate Pentium Pro).
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 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 since 2015, 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. My new compiler is only compatible with very modern browsers, which not only support WebAssembly, but also support WebAssembly.Global. Those are Firefox 62, released 05/09/2018, and Chrome 69, released 04/09/2018. Thus, the code it produces cannot be run in any browser compatible with Windows XP. 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.

UPDATE on 30/08/2020: I've written an informal specification for my programming language.

UPDATE on 01/11/2020: As a part of an university project, I've began to write a PicoBlaze simulator in JavaScript (which can be run in a browser). So, if you want to try non-x86 assembly language programming to better understand how computers work, there might be no better way to do that than to try that app. It runs in Firefox 52 (the last version of Firefox to run on Windows XP) and newer browsers.

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.

AEC
Arithmetic
Expression
Compiler