Compiler Construction (CECS 444)

Compiler Construction (CECS 444)

These scanners and parsers were built in CECS 444 (Compiler Construction) in the Spring of 2012 at CSULB.

The first programming project of the course, assignment 2 was to implement a lexical scanner for a small subset of the scripting language we would evenually be parsing. The language mostly consists of operators and variable names tokens. All table work (i.e. action, state, etc) was done on paper, so no tables are included for this project.

The second programming project in the course was to expand the scanner from assignment 2 to scan the entire language. Table work for this project would have been to tedious to do by hand, so it was all done in Excel. The original XLS file, along with the state, action and look-up CSV files it generated, are included in the tables directory.

The final project for the course was to implement a parser that gets tokens from the large scanner developed in assignment 3. The program parses the context-free grammar we had been working with all semester into a parse tree. The parser is an LL(1) top-down parser with error recovery.

The Client

Verne Konig was my Compiler Construction professor. His class focused on the practicalities of designing and building a lexical scanner and parser, the foundations of language compilers.

My Role

I wrote the code and designed the interfaces for these three projects. The language itself was defined by the professor as part of the assignment.

Technology Used

The three programs are written in Python 2.7. GUI elements are produced using WXPython.

About the Code

I tried to keep this code as simple and easy to read as possible. The task is so massively complex, I knew I would not be able to read this code if I came back to it later unless I made sure to keep it simple.

Source Code

Full source code for 3 assignments.