Assignment 3 (3%)
Note: Your solution should be written in C!
- Write a function Token NextToken() for PL tokens
(based on the supplied source
handler).
- Write a function void PrintToken(Token tok) that
prints a argument of type Token as a 4-tupel as
suggested in the lecture.
- Write a driver program that uses these functions to print a file
"pl_test" as a sequence of tokens.
You can download an example PL
program. The output of your program on this testfile should be
something like the following:
(Variable, "X1", 1, 1)
(AssignOp, "<=", 1, 3)
(NullDigit, "0", 1, 5)
(Semicolon, ";", 1, 6)
(ResWordLoop, "loop", 2, 1)
(Variable, "X2", 2, 6)
(Semicolon, ";", 2, 8)
(ResWordGoto, "goto", 3, 4)
(Label, "l12", 3, 9)
(Semicolon, ";", 3, 12)
(ResWordEndloop, "endloop", 4, 1)
(Semicolon, ";", 4, 8)
(Label, "l12", 5, 1)
(Colon, ":", 5, 4)
(Variable, "X1", 5, 5)
(IncOp, "++", 5, 7)
(Semicolon, ";", 5, 9)
Please pack your source code (not including any binaries or object
files!) using gtar czvf ASSIGNMENT3.tgz [files or
directories] and send the resulting archive as an attachment
to yi_82@yahoo.com (if you
somehow end up with a very large archive, send only a short note and
send the main file to yigao@mail.cs.miami.edu.
Stephan
Schulz,schulz@cs.miami.edu, Thu Aug 22 13:35:31 EDT 2002