Simplified project structure:
├── doc Documentation files
│ └── ...
├── tests Test files
│ └── ...
├── vypa_compiler Compiler source files
│ ├── generated
│ │ └── ...
│ ├── internals
│ │ ├── _ast.py Abstract syntax tree implementation
│ │ ├── _code_templates.py Instruction templates
│ │ ├── _codegen.py Code generation implementation
│ │ ├── _instructions.py Target instructions
│ │ ├── _lexer.py Lexer implementation
│ │ ├── _model.py Symbol table, semantics, etc.
│ │ ├── _parser.py Parser implementation
│ │ └── _utils.py Utility functions
│ └── compiler.py Main source file
│
├── .gitignore
├── LICENSE
├── Makefile Makefile script
├── README.md
├── requirements.txt Pip dependencies
├── setup.py Setup script
└── vypcomp Complier executable
Initialize the project before running:
make
vypcomp SOURCE_FILE [OUTPUT_FILE]
Default output file name is out.vc
.
- Lexical analysis
- Source code lexemes to tokens
- Syntax analysis
- Semantic analysis
- Construct AST
- Target code generation (partially)
- Symbol table, variables
- Operator precedence
- If-Else
- While
- Functions
- Built-in Functions
- Cast INT STRING
- ...
- OOP
- Classes, objects
- Inheritance
Etc.