A compiler for JonathanScript( JS) ;)
- The Lexer translates JonathanScript into tokens.
- The Parser parses the tokens and generates the AST.
- The Compiler compiles the AST into bytecode (instructions).
- The Virtual Machine executes the bytecode. The run function decodes the instructions, processes them, and pushes the results onto the stack.
Execution process:
Lexer | Parser | Compiler | VM | |||||
source | --------> | token | --------> | AST | --------> | code (Instructions []byte) | --------> | result |