hw4 - grammar G : (Nonterminals: S, A. Terminals: (, ), { ,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
VERSION: September 29, 2010 CS-441 Fall 2010 JWJ CS UK Homework Assignment # 4 —This material is only for use in CS441-Fall 2010 in the Department of Computer Science at the University of Kentucky.— —Please, do not distribute.— Due: solve by Thursday, Sep 28, 2010 Learning outcomes: This assignments relates to the material on CFG grammars and their properties. The assignment contributes to the following learning outcomes for this course: LO2 specify parsing elements for algorithmic languages LO4 design and implement a complete algorithmic language compiler hw4 This part pertains to designing a recursive descent parser for a simple grammar. Consider the following CF
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: grammar G : (Nonterminals: S, A. Terminals: (, ), { , } , a.) (1) S S { S } S (2) | ( A ) (3) | a (4) A { S } A (5) | Table 1: Grammar G Show two sentences that belong to L( G ). Describe the general format of strings that belong to L( G ). 4.1 Remove left recursion from G (denote the resulting grammar G 1 .) Show all the steps. 4.2 Design recursive-descent parser for G 1 . Write all the functions for the parser, such as tt parse S(), etc. 4.3 List the sequence of all parse X() , match(t) , error(msg) functions in the order they are called while parsing () { a } () . 1...
View Full Document

This document was uploaded on 12/14/2010.

Ask a homework question - tutors are online