Question 51
(assign-stmt):: = (LHS):= (E) (E) :: = (E) + (T) | (T) (T) :: = (T) * (V) | (V) (V) :: = id | ((E)) (LHS) :: = idIt is required to convert expression and assignment strings of L into postfix strings that use the type-specific operators (+, i), (+, r), (*, i), (*, r), (:=, i) and (:=, r). Write a syntax directed translation scheme to convert expression and assignment strings into the post-fix form. You may assume that the name and type of a variable can be obtained by making the function calls \'give-type (id)\' and \'give-name (id)\' respectively.
Question 52
<stmt> → if id then <stmt> <stmt> → if id then <stmt> else <stmt> <stmt> → id := idis ambiguous because a) the sentence if a then if b then c:= d has two parse trees b) the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse trees c) the sentence if a then if b then c:= d else c:= f has more than two parse trees d) the sentence if a then if b then c:= d else c:= f has two parse trees
Question 53
E → E + E {print “+”} E → E ∗ E {print “.”} E → id {print id.name} E → ( E )An LR-parser executes the actions associated with the productions immediately after a reduction by the corresponding production. Draw the parse tree and write the translation for the sentence (a+b)∗(c+d), using the SDTS given above.
Question 54
A --> aBCD B --> bc|c C --> d|∈ D -> b(S2) :
A --> aBCD B --> bc|∈ C --> d|c D -> b(S3) :
A --> aBCD B --> bc|∈ C --> d|∈ D -> b(S4) :
A --> aBCD B --> bc|c C --> d|c D -> bWhich of the following grammar has same follow set for variable B?
Question 56
Question 57
S → T/U T → x S y ? xy ? e U → yTgenerates a language consisting of the string yxxyy.
Question 58
E → E ∗ F ∣ F + E ∣ F F → F − F ∣ idWhich of the following is true?
Question 59
1) A → BC 2) A → CcBb 3) A → BaC 4) A → ε
There are 85 questions to complete.