- Generate AST Nodes definitions in
./src/RustAST.py
:
$ ./src/_build_tables.py
- Run tests:
- All tests:
$ ./tools/test-all.sh
- Lexer Unit Tests:
$ ./tests/TestLexerAuto.py
- Lexer Manual Tests:
$ ./tests/TestLexerManual.py
- Symbol Table Test:
$ ./tests/TestSymbolTable.py ./tests/testFile2.rs 2
- Abstract Syntax Tree Test:
$ ./tests/TestAST.py ./tests/testFile1.rs
- Intermediate Code Generation Test:
$ ./tests/TestICGen.py ./tests/testFile1.rs
- All tests:
- Clean project directory:
$ ./tools/clean.sh
- Remove Comments.
- Generate tokens.
- Preload keywords into the symbol table.
- Make an entry for the identifiers into the symbol table(if there exists an identifier with the same name in different scopes then construct symbol table per scope).
- Symbol table must contain entries for predefined routines like printf, scanf etc
- Write CFG for the entire program.
-
If implementing parser by hand:-
Prefer RDP with backtracking. -
Perform translation at required places in the code for each non-terminal.
-
- If implementing using tool:
- Provide appropriate semantic rules.
- Take care of the primitive types and array types.
-
Take care of coersions. - Take care of Arithemetic expressions.
- Concetrate on the looping construct choosen.
- Update type and storage information into the symbol table.
- Show Abstract Syntax tree(AST).
- Three address code generation
- Constant folding
- Constant Propogation
-
Common subexpression elimination (optional) - Dead code elimination
-
Reducing temporaries (optional) - Loop optimizations