0% found this document useful (0 votes)
2 views1 page

Parser

The document outlines an assignment involving LL(1) and LR(1) parsers based on given context-free grammars. It includes tasks such as explaining why a grammar is not LL(1), converting it to LL(1), left factorizing it, constructing parsing tables, and demonstrating parsing steps for specific input strings. The assignment requires a detailed understanding of parsing techniques and the construction of parsing tables.

Uploaded by

Gemechis Gurmesa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Parser

The document outlines an assignment involving LL(1) and LR(1) parsers based on given context-free grammars. It includes tasks such as explaining why a grammar is not LL(1), converting it to LL(1), left factorizing it, constructing parsing tables, and demonstrating parsing steps for specific input strings. The assignment requires a detailed understanding of parsing techniques and the construction of parsing tables.

Uploaded by

Gemechis Gurmesa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT

Q1 LL (1) Parsers
In the following context-free grammar, the symbols 0, 1, 2 and 3 are terminals and S is the initial symbol.

S → 0|1S2S3|1A3

A → S|AS

a) Explain briefly why this grammar is not LL(1)

b) Convert this grammar to an equivalent that is LL(1)

c) Left factorize it

d) Construct the complete sLL (1) parsing table.

e) Using stack, show all the steps required to parse the input string: 11020301033

Q2 LR (1) Parsers
In the following context-free grammar, the symbols (, a, ) and , are terminals. And S is the initial
symbol.

(1) S → ( L )

(2) S → a

(3) L → L , S

(4) L → S

a) Construct the full LR (1) DFA, showing all items in each state.

b) Construct the LR (1) parsing table using the DFA. For the reduce actions, please use the
provided enumeration of the productions in the grammar.

c) Using stack, show all the steps required to parse the input string: (( a , a ) , a , a )

You might also like