Expression Evaluator and Generator

| | Comments (0) | TrackBacks (0)
To me, this assignment was a little bit of fun. We were tasked with reading an input file and evaluating what was found in the file, much the same way a compiler does for source code(albeit extremely basic). This evaluation was elementary in that we created a global variable, if you will, named Environment, that stored the name:value pairs found in the file. Once we had the program understand what was in the data input file, we simply output our choice of varying arithmetic expressions and solve. This marked the beginning of a later two-part project which involved developing a small compiler based around the Scribbler robot.
So for example, if the data file contained:
x=3
y=5


And one of the five expressions hard coded into the program was:
(x * x) + y

We would have it output the full expression and that expression's value:
(x * x) + y = 14

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: Expression Evaluator and Generator.

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

Leave a comment

About this Entry

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

Scribbler Write-up was the previous entry in this section.

CSLite Compiler, Part 1 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.