This project is a C++ implementation of Yehonathan Sharvit's JavaScript compiler.
The project has 4 main parts:
- Tokenizer
- Parser
- Emitter
- Compiler
The Tokenizer class takes input and converts it into a vector of Tokens. Each token consists of a type and a value.
The Parser class takes in tokens and converts it into an Abstract Syntax Tree (AST).
The Emitter class takes the AST and converts it into C-like code syntax (string-ify).
The Compiler class combines all of the previous parts.
Build: g++ *.cpp *.hpp -o compiler.o
Run: ./compiler.o
Build: docker build . --tag compiler
Run: docker run --rm -i compiler:latest