Compilers (CS362 2002F)

Homework 2: Grammars and Parsing

Assigned: Friday, September 27, 2002
Due: Friday, October 4, 2002

Form of the assignment: This is primarily a written assignment, rather than a programming assignment. I consider it important for you to be able to deal with both the theory and practice of compilers. This particular assignment primarily involves you following procedures for working with grammars.

Collaboration: You should feel free to discuss the assignment, possible solutions, and possible errors in those solutions with your colleagues. However, each student should turn in his or her own set of solutions to these problems. If you discuss the assignment with others, make sure to cite them at the top of you assignment.

Problems:

1. Find or write a grammar for concise regular expressions (those in which you don't have to write all the parens).

2. Rewrite the grammar so that it is not ambiguous. Your new grammar will need to take into account precedence and associativity.

3. Rewrite the grammar to make it amenable to recursive descent (predictive) parsing.

4. Create the First, Follow, and Nullable tables for the grammar.

Turning it in

Turn in your answers to me. Your answers may be hand-written and hand-drawn (if your handwriting and drawing are legible) or typeset.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Fri Sep 27 10:29:43 2002.
The source to the document was last modified on Fri Sep 27 10:29:38 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2002F/Homework/hw.02.html.

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Glimmer Labs: The Grinnell Laboratory for Interactive Multimedia Experimentation & Research
glimmer@grinnell.edu