Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/spkenkare/Interpreter


https://github.com/spkenkare/Interpreter

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

Due date: Sunday 1/24/2016 @ 11:59pm

Objective:
~~~~~~~~~~

- Become familiar with the project submission environment
- Introduction to C programming
- Help you think about test cases and ambiguities in specifications

Assignment:
~~~~~~~~~~~

(1) Write an interpreter for a simple programming language:

- The program is passed as a command line argument to the interpreter

- A program consists of a sequence of assignment statements

- Each statement is terminated with ';'

- The left hand side of an assignment is always a simple variable

- Variable names can only contain a single lower-case letter

- The right hand side of an assignment is always a positive integer literal

- All variables are initialized to 0

- The interpreter prints the values of all the non-zero variables in
alphabetical order when it finishes interpreting the program

- Unexpected characters are ignored

(2) Donate a test case by adding two files:

.test : the test
.ok : the expected output

Where is you CS ID (not your UTEID)

(3) Answer the questions in REPORT.txt

Examples:
~~~~~~~~~

./p1 "x = 10;"
x:10

./p1 "x = 2_09 ; a = 17;"
a:17
x:209

Files you're allowed to change:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

p1.c
.test
.ok

Files you're supposed to leave alone:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Everything else

To compile:
~~~~~~~~~~~

make

To run tests:
~~~~~~~~~~~~~

make clean test

To make the output less noisy:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make -s clean test

To debug with gdb
~~~~~~~~~~~~~~~~~

make
gdb ./p1
(gdb) run "x = 100; a = 30;"