LY Program 5
A Simple Calculator
Extend example ch1-06 from "lex & yacc".
- Make the parser handle verbs better, e.g., "has seen." Add new
word and token types AUXVERB for handling auxiliary verbs.
- Some words can be more than one part of speech, e.g. "watch," "fly,"
"time," or "bear." How could you handle them? Add a new word and
token type NOUN_OR_VERB, and add it as an alternative to the rules for
subject, verb, and object.
- Add print statements to the lexer and the parser so we can follow how
the program is proceeding
What to turn in
- Be sure your ".l" ".y" and ".exe" files are saved under your u:\program5
folder
Grading Criteria
- 80 points maximum
- Proper changes in lex for the auxiliary verbs.
- Proper changes in yacc for the auxiliary verbs.
- Proper changes in lex for nouns-or-verbs combinations
- Proper changes in yacc for nouns-or-verbs combinations
- 10 points - Output Correctness
- The program correctly prints the decisions the lexer and parser are
making
- 5 points - Comments
- Complete and correct header comments, declaration, and in-line comments
in the ".l" and ".y" files.
- 5 points - creation of Visual C++ project
- folder u:\program5 created correctly on
your network u: drive
- all files are saved correctly under u:\program5 folder