6 ms·
Implementing a Simple Compiler in 25 Lines of JavaScript
- flavio81 9y agotl;dr: it's a transpiler, not a compiler. The programning "language" only supports four operations: Add, substract, multiply, and divide. On integers only. No control flow operators. No parentheses to group expressions. No possibility to define functions. If it didn't have such a clickbaity title then it would make for a good, educational reading.
- ttd 9y agoIf we're being pedantic, then it is a compiler. It's a compiler that targets another high-level language instead of a lowered representation. Transpiler is (in my opinion) a meaningless specialization of the word compiler. The corresponding blog post (http://blog.mgechev.com/2017/09/16/developing-simple-interpreter-transpiler-compiler-tutorial/ http://blog.mgechev.com/2017/09/16/developing-simple-interpr...) does seem to be educational.