311 views
0 votes
0 votes
1.Given a Grammar G {S}, {a, b}, S, Pwith P defined as:
 S  aSb,
 S 
 (i) Obtain a sentence in language generated by G and the sentential form.

(ii) Obtain the language L(G).

2. Find regular expressions over {a, b} for the language defined as follows:

L1 = {a mbm   : m 0}
L2 = {bm abn : m 0, n 0 }  
L3 ={ a mbm ,  m 0, n 0 }  

3. Draw derivation or parse trees for G=({a, b}, {S,A}, S, P), where P is:
S → aAS
 S → a
A → SbA
 A → ba         

    
   
4. Draw:

Syntax tree for 9-5+2  
 Transition diagram that recognised identifier and key words  and
Translate the assignment statement
 A : = -B*(C+D) into three-address code.

5. (a)  Consider the grammar G3,construct the LL(1) parsing table for this grammar.
Grammar G3 :
S          aBa
B          bB / ᶓ  
(b) Show that Grammar G2 is left-recursive.
Grammar G2 :
S          S(S)
S           ᶓ

Please log in or register to answer this question.

Related questions

0 votes
0 votes
2 answers
2
Ebrahim asked Dec 16, 2023
223 views
Q5. Find the FIRST and FOLLOW of the grammar to check whether it is LL (1) parser or not. N → AB | BA A → a | CAC B → b | CBC C → a | b
0 votes
0 votes
0 answers
3
LavTheRawkstar asked Jun 27, 2016
332 views
Construct LALR parsing table for the given grammar :S → AA | aA → aA | b