Compilers and Interpreters: Assignment 1
September 5, 2008
In the first part of this class we will be building an interpreter
for a simple robot control language.
In this assignment you will build an interpreter to handle the first subset.
The robot hardware accepts commands such as the following
!PN09 rotate 90 degrees left
!PN39 rotate 90 degrees right
!PN5X move forward X
!PN7X move backwards X
!PN101 face forward
!PN10E face right
!PN10C face left
where the value of X determines the distance moved,
0 means 6 inches
1 means 12
2 means 18
3 means 24
4 means 36
5 means 48
6 means 60
7 means 72
The commands you are to implement this time are:
N is a number of inches
; means that the rest of the line is a comment
Thus an example command sequence is:
; patrol a square foot
Here is a second example
; wander around some
The robot emulator code is available as a 7zip file at
https://faculty.utep.edu/longpre (follow the menus from CS 4352,
to assignments and to assignment 1.)
The main() method is in the class RE.
Due Thursday, September 17, at the start of class.
- a printout of your revised Interpret.java,
- screenshots showing how it works on the two code fragments above,
- any documentation you think I should have.
ocumentation you think I should have. html>