0% found this document useful (0 votes)
44 views

Assignment-3: - B. H. Gardi College of Engineering & Technology

This document contains an assignment with 4 questions on grammar rules, parsing, and LL(1) parsing: 1) Show that the string "aa+a*" can be generated by the grammar S -> SS+ | SS* | a and construct its parse tree. Determine if the grammar is ambiguous. 2) Eliminate left recursion from the grammar S -> Aa | b, A -> Ac | Sd | ^ and rewrite the grammar. 3) Perform left factoring on the grammar A  ad | a | ab | abc | b and find the FIRST and FOLLOW sets. 4) Determine if the given grammar is suitable for LL(1) parsing. If not,

Uploaded by

Devang_Ghiya
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Assignment-3: - B. H. Gardi College of Engineering & Technology

This document contains an assignment with 4 questions on grammar rules, parsing, and LL(1) parsing: 1) Show that the string "aa+a*" can be generated by the grammar S -> SS+ | SS* | a and construct its parse tree. Determine if the grammar is ambiguous. 2) Eliminate left recursion from the grammar S -> Aa | b, A -> Ac | Sd | ^ and rewrite the grammar. 3) Perform left factoring on the grammar A  ad | a | ab | abc | b and find the FIRST and FOLLOW sets. 4) Determine if the given grammar is suitable for LL(1) parsing. If not,

Uploaded by

Devang_Ghiya
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Subject Name: CD (170701) Faculty Name: RP

Date of Given: 13/08/2013 Last date of submission: 17/08/2013

Assignment-3
1) (i) Consider the grammar S -> SS+ | SS* | a Show that the string aa+a* can be generated by the grammar. Construct the parse tree for it. Is the grammar ambiguous? Justify. (ii) Write production rules for producing following language. 2) Eliminate left recursion from the following grammar and rewrite the Grammar. S -> Aa | b A -> Ac | Sd | ^ 3) (i)Perform the Left factoring of following Grammar A ad | a | ab | abc | b (ii) Find out FIRST & FOLLOW set for all the Nonterminals S AcB | cbB | Ba A da | BC B g | ^ C h | ^ 4) Is the following grammar suitable for LL(1) parsing? If not make it suitable for LL(1) parsing. Compute FIRST and FOLLOW sets. Generate the parsing table. SAB ACa | BBaAC | c Cb |

Prepared By:Prof. Renish Padariya

Approved By:Prof. Yatin Shukla

| B. H. Gardi College of Engineering & Technology

You might also like