The following is the grammar implemented in this project:
The terminals (tokens) are:
assignSym
|
<-
|
colonSym
|
:
|
constSym
|
1
|
eofSym
|
end-of-file indicator |
errorSym
|
oops! |
minusSym
|
-
|
periodSym
|
.
|
plusSym
|
+
|
varSym
|
An identifier ( [A-Za-z][A-Za-z0-9]*) |
The code is in these files:
CharSets.cc
|
Data abstraction for storing sets of characters |
CharSets.h
|
Header declarations for the set abstraction |
Tokens.cc
|
Data abstraction for reading and indentifying tokens |
Tokens.h
|
Header declarations for the token abstraction |
parse.cc
|
Main program -- recursive descent parser |
pgm.dat
|
Sample "program" in this trivial language |
This program uses Morell's data abstractions. On boole compile these files with the following command:
This will run the gb script and produce an executable called parse.
This program can then be run by typing: parse < pgm.dat
'