assignment 1

2
Assignment -1 1. Given the grammar E→T+E │T T→V*T│V V→ id Write pseudo code to parse this grammar by recursive descent. 2. Given the grammar A( A ) A| € Construct First and Follow sets for the nonterminal A. 3. Consider the grammar lexpatom | list atomnumber | identifier list ( lexp-seq ) lexp-seqlexp-seq lexp | lexp a) Remove the left recursion. b) Construct First and Follow sets for the nonterminals of the resulting grammar. 4. Consider the grammar lexpatom | list atomnumber | identifier list ( lexp-seq ) lexp-seqlexp , lexp-seq | lexp a) Left factor this grammar. b) Construct First and Follow sets for the nonterminals of the resulting grammar.

Upload: saraah-ghori

Post on 18-Feb-2016

212 views

Category:

Documents


0 download

DESCRIPTION

CC Assignment Questions

TRANSCRIPT

Page 1: Assignment 1

Assignment -1

1. Given the grammarE→T+E │TT→V*T│VV→ id

Write pseudo code to parse this grammar by recursive descent.

2. Given the grammar A( A ) A| €

Construct First and Follow sets for the nonterminal A.

3. Consider the grammarlexpatom | listatomnumber | identifierlist ( lexp-seq )lexp-seqlexp-seq lexp | lexp

a) Remove the left recursion.b) Construct First and Follow sets for the nonterminals of the resulting grammar.

4. Consider the grammarlexpatom | listatomnumber | identifierlist ( lexp-seq )lexp-seqlexp , lexp-seq | lexp

a) Left factor this grammar.b) Construct First and Follow sets for the nonterminals of the resulting grammar.

NOTE: Here € symbol is an epsilon.

Note: Last date of submission is 21-01-2014