Ever wanted to know how compilers work? This is a good way to learn about what happens under the hood of a compiler.
This project implements a Lua to x86 assembly compiler in JavaScript. It uses a hand-rolled lexer, a recursive-descent parser, and emits x86 assembly. The result is a compiler for a small subset of Lua to basic x86 assembly.
- Browser Developer Tools (Firefox’s 3D view is especially handy)
To understand the code, start in lex.js
.
You can see other example projects on our Community Projects page. And if you get stuck, let us know on the forum and we can help you out.