Xeno Compiler
Compiler (front-end only) for a proprietary Python-like language named Xeno.
Features
- Fully implemented language with defined syntax using regular expressions
- Reader with adjustable buffer expansion methods and character histogram
- Scanner with implemented transition table
- Parser that detects syntax errors based on defined parse trees
Skills Applied
- Memory management in C
- CMake
- Compiler theory
- Automata (DFA, NFA)
- Regular Expressions
- Context-Free Grammars
- State-transition diagrams/tables
- Parsing (top-down, bottom-up, predictive, LL1)
- First() and Follow()
- Error handling & Recovery



Background
This project was the culmination of the entire term of my Compilers course. My teammate and I worked on this project for ~15 weeks, learning different compiler theory topics before planning a different component of the compiler and implementing it. The course required defining a new language with syntax similar to Python. By the end of the term, we had the working front-end of a compiler that could take an input language and determine if it followed the syntactical rules of the language.
What I learned
This project was tough, but useful in developing my skills in C. Not counting anything related to Compiler theory, I learned a lot about safety when dealing with pointers, deepened my understanding of CMake, gained experience using Visual Studio, and used Git extensively to help version control a collaborative project.
I implemented the transition table (Fig. 1) as a 2D in a function that accepts a row/column and uses transitional logic to determine if the next lookahead character (since this is a LL1 parser) is syntactically valid or not. This was a big learning curve as I had to design both the transition table, ensuring each transition is accounted for, and then implement the transition table in C (Fig. 2).
Fig. 1, Transition Table in Excel
Fig. 2, transition table as 2D array in C
This is not meant to be distributed and the source code is not available publicly