The problem
I was exploring the world of compilers, and I have implemented this one as a part of my journey. It takes a file containing a Rust-inspired language and transpiles it into JavaScript.
Technical highlights
- I built a handwritten recursive descent parser.
- I used string interning to optimize memory consumption.
- I implemented a simple type system and a type checker.
- A Rust-like module system was also implemented.
- Unlike my previous attempt, this compiler is simpler since it only produces JavaScript and not binary.
- Pipeline: Lexer > Parser > Checker (semantic analysis) > Resolver (type resolving) > JavaScript Generator