As a part of my Compiler Design Project, I have created a python compiler from scratch using the same Grammar Rules for Python. This Compiler is designed only for python code structures with loops and uses PLY tools and is written in Python itself.
There are 4 stages of this project
- THE LEXER (inclusive of ignoring singluar and multiple comments)
- PARSER (inclusive of identation handling)
- INTERMEDIATE CODE GENERATION AND BUILDING AN ABSTRACT SYNTAX TREE
- CODE OPTIMIZATION
THE MAIN CHALLENGE WAS TO DEAL WITH INDENTATION AS FAR THE LANGUAGE PYTHON IS CONCERNED