CSLite Compiler, Part 1

| | Comments (0) | TrackBacks (0)
This is the first portion in a two-part project involving the construction of a small compiler for the scribbler robot. The professor had already written up most of the front and back ends and required us to simply adjust the given code to incorporate new functions, namely an unconditional loop, for loop and a break statement. This largely involved playing around and adding to the lexer and parser source code. Upon a successful build, the program should be able to evaluate these statements and perform the necessary actions.
The main goal of this part was to understand what the front and back ends of a compiler actually do, while the sub-goal, if you will, was to make use of the AntLR tool and output a corresponding XML abstract syntax trees(AST). The XML trees helped to illuminate the concepts he was trying to educate us on.

To get this smörgåsbord of code working, it takes a bit of patience and understanding of the code the professor developed. When I finally got this code to work as required it was pretty cool to see your source file read by a small compiler and have output based on the input.

All required tasks to be performed required by the specification were implemented successfully.

See the wiki for a detailed write-up on this whole assignment, and/or click the below picture to go to the repository listing, likewise for this assignment.

repo-listing.jpg

Code critiques and criticisms are always welcome.

Categories: ,

0 TrackBacks

Listed below are links to blogs that reference this entry: CSLite Compiler, Part 1.

TrackBack URL for this entry: http://www.lozzisolutions.com/cgi-bin/movable-type/mt-tb.cgi/92

Leave a comment

About this Entry

This page contains a single entry published on June 24, 2008.

Expression Evaluator and Generator was the previous entry in this section.

CSLite Compiler, Part 2 is the next entry in this section.

Find recent content on the section index or look in the archives to find all content posted to this section.

Overview

  • This section contains a repository of code created at the university level, completed for individual clients(with their permission), or simply varieties of programs which may have no place at all but to serve as a reference. Please note that this section has its own search engine for finding the entries which contain code or links to code.