-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
86 lines (53 loc) · 1.6 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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:
<csid>.test : the test
<csid>.ok : the expected output
Where <csid> 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
<csid>.test
<csid>.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;"