CS362 2011F Compilers

Assignment 2: Tokenizing Pascal

Assigned: Friday, 9 September 2011
Due: 11:00 p.m. Wednesday, 14 September 2011

This homework is also available in PDF.

Summary: In this assignment, you will write regular expressions for the tokens of Pascal.

Purposes: To get you started with your lexer. To help you think more deeply about tokens.

Expected Time: Three to Five Hours.

Collaboration: You may work in groups of up to size three. You may consult with anyone you'd like on this assignment, but you should clearly document that consultation.

Submitting: Submit a tarball containing your solution on Pioneerweb.

Warning: So that this exercise is a learning assignment for everyone, I may spend class time publicly critiquing your work.


Reread (or rescan) the Pascal report and identify the important tokens in the language. Write a regular expression for each token.

For example, if you decide that there should be a BEGIN token, you might write

BEGIN: [Bb][Ee][Gg][Ii][Nn]

Minimally, you should support:


Create a tarball of your files. The tarball should include your regular expressions (probalby just one file) and any notes you make.

If possible, ensure that your tarball expands to the directory user1-user2-user3.HW2.

Submit your tarball on Pioneerweb.

Important Evaluation Criteria

I will evaluate your assignment primarily on its correctness. In particular, I will consider whether your program achieves its desired goals.

I will also evaluate your assignment on its style. I will consider how you have decomposed the problem, the names of your procedures, your indentation and commenting, and other issues that suggest that you have not only thought about how to code the problem, but how to code it well, and in a way readable to others.



Wednesday, 7 September 2011 [Samuel A. Rebelsky]

  • Designed.

Friday, 9 September 2011 [Samuel A. Rebelsky]


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 Sun Nov 20 22:32:11 2011.
The source to the document was last modified on Sun Sep 11 20:50:51 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2011F/Handouts/pascal-tokens.html.

Samuel A. Rebelsky, rebelsky@grinnell.edu