Assigned: Friday, January 30, 1998
Due: 11am, Friday, February 6, 1998
1. An Extended Expression Grammar
Extend the expression grammar from class to include unary operations, exponentiation, and function calls.
2. Parsing Expressions
Draw the parse trees given by your grammar for the following expressions (or indicate that the expression is not parsable).
id() + id() * id()
(num - (num - (num - num)))
3. Syntax of
Write a BNF description of the Pascal
4. Regularizing Identifiers
Write a regular expression for identifiers in Pascal.
5. A Grammar for Identifiers
Write a BNF description of Pascal identifiers. You can assume that your
lexer has already converted individual characters into
6. Identifying Identifiers
Pick two "interesting" identifiers and show the parse trees that you get for those identifiers.
7. A "Functional Grammar" for Identifiers
[Based on the notes of John Stone.]
In your favorite programming language, write and test a Boolean function that takes a string argument and determines whether that string is a legal instance of the syntactic category "identifier" in Pascal. Make sure to turn in an illustration of the results of your test, as well as your function code.
8. A "Functional Grammar" for Numbers
[Based on the note of John Stone.]
In your favorite programming language, write and test a Boolean function that takes a string argument and determines whether that string is a legal instance of the syntactic category "number" in Pascal.
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Fri Feb 13 10:11:38 1998.
This page generated on Fri Feb 13 10:14:57 1998 by SiteWeaver.
Contact our webmaster at firstname.lastname@example.org