Programming Languages (CSC-302 98S)

[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Assignments]


Assignment Two: Syntactic Analysis

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).

3. Syntax of for

Write a BNF description of the Pascal for statement.

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 digits and letters.

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.


[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Assignments]

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 rebelsky@math.grin.edu