This project implements a simple compiler for a custom Python-like language (.cpy).
It tokenizes the source, checks syntax, builds symbol tables, and emits an intermediate representation.
- Lexical analysis for keywords, identifiers, operators, separators, and blocks
- Syntax analysis with support for functions, conditional statements, loops, and nested scopes
- Generation of intermediate code (
.int) and symbol tables (.sym)
- Python 3.x
- Place your
.cpysource file in the project directory. - Run the compiler:
python compiler.py yourfile.cpy
- The compiler produces:
- yourfile.int – intermediate code
- yourfile.sym – symbol table
A sample program is available in test.cpy demonstrating functions, loops, and nested definitions.
python compiler.py test.cpy