Parser I, Stubbing the Parser
and
Scanner IV, Polishing the Scanner
Posted Tuesday, February 12
Due at the beginning of your lab period the following week
Objectives
The objectives of this assignment are to
- make sure your journal and time sheet are up to date
- allow you to polish your scanner for a formal code review and test
- have you create the major stubs of the parser.
By the end of this week, your scanner should not only be functioning, but the source
code should have a professional appearance.
To Do
Here is what you must do.
Journal and Time Sheet
Remember that the journal and the time sheet are individual
assignments, not group assignments. Be sure that you have followed the directions on the Rules
page for making journal entries and filling in the time sheet. These will
be turned in.
Polish Your Scanner
- Polish your scanner for professional testing and code review.
For extra credit, you can include source listing that highlights any errors as part of
your scanner output.: We do not suggest that you do this unless you are completely
satisfied that your scanner is complete and correct, because extra credit will do you no good if the
scanner doesn't function properly. There
are various ways to do the source listing. Our suggestion would be to do the
following:
- Produce the listing in a separate text file in the working directory, called source.
- Print each line to the source file as it is scanned (it must appear
exactly as the programmer typed it).
- For each error print a line in the source file beneath the offending source line with an indication of
where the error starts.
For example, the source listing file might look like:
begin
Read(A, B);
Write(@40);
^
*** invalid character in input file
Fred 'Abcde xxxyz sus
^
*** runaway string
Apple @ Number_of_apples ?;
^
*** invalid character in input file
^
*** invalid character in input file
end.
Stub your Parser
The next stage of the compiler will be the construction of the parser. The
parser will eventually need a separate procedure for each nonterminal in the
grammar. Divide the number of nonterminals by the number of people in your
group. Each person is then to be responsible for completing the stubs for
the set of nonterminals assigned to them. Each procedure should be named
the same as the nonterminal of the stub. For example, if the nonterminal
is <expression>, then the stubbed procedure should be similar to
procedure Expression is
begin -- Expression
Output("Expression has not yet been implemented");
New_Line;
end Expression;
Special Notes
- If you are behind, this is your week to catch up.
- If you find any discrepancies or errors in the assignment, be sure to report them
immediately, so that the page can be updated appropriately.
- This is the week that you should really be testing your scanners well. You
should be developing some good test cases for yourself. Also, as suggested earlier, post
an announcement that you are willing to trade test cases with others who have developed
some.
To Turn In
You are to turn in, as a team, a professional-looking source listing of
your program in a three ring binder notebook. We have a handful from
previous years that you can have if you want to avoid buying one (first come,
first served).
- Print your complete scanner source code on a printer that produces dark, clean output.
Do not wait for the beginning of lab to print your scanner.
- Place your initial procedure (main function) as the first page of the source listing
- Include a cover page that is the first page of the notebook that has each
team member's name and e-mail address centered nicely on the page
You are also to turn in individually your journal and your time sheet.
Remember, these are private. You are evaluating yourself as well as your
partners, so keep the results private. Be prepared to turn these in at the
beginning of lab as well as your source listing.
You must have your program executable code available on esus with
permissions set for anyone to execute it (but not to change it).
Your parser stubs are not to be turned in in hardcopy form. Instead, have
the source code of the parser stubs available on esus so that the TA can
examine it during lab if necessary.