VYPa 2022
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
Getting started
Setup
Initialize the project before running:
make
Running the compiler
vypcomp SOURCE_FILE [OUTPUT_FILE]
Default output file name is out.vc
.
Progress
Compiler stages
- Lexical analysis
- Source code lexemes to tokens
- Syntax analysis
- Semantic analysis
- Construct AST
- Target code generation (partially)
Features / Other
- Symbol table, variables
- Operator precedence
- If-Else
- While
- Functions
- Built-in Functions
- Cast INT STRING
- ...
- OOP
- Classes, objects
- Inheritance
Etc.