...
Computer-Networks
October 8, 2023
Compiler-Design
October 8, 2023
Computer-Networks
October 8, 2023
Compiler-Design
October 8, 2023

Compiler-Design

Question 42

Consider the grammar:

  E → E + n | E × n | n 

For a sentence n + n × n, the handles in the right-sentential form of the reduction are:

A
n, E + n and E + n × n
B
n, E + n and E + E × n
C
n, n + n and n + n × n
D
n, E + n and E × n
Question 42 Explanation: 
E → E + n {Applying E → E+n}
→ E + E * n {Applying E → E * n}
→ E + n * n {Applying E → n}
→ n + n * n {Applying E → n}
We use n, E+n, E×n reductions to get a sentence n+n*n.
Correct Answer: D
Question 42 Explanation: 
E → E + n {Applying E → E+n}
→ E + E * n {Applying E → E * n}
→ E + n * n {Applying E → n}
→ n + n * n {Applying E → n}
We use n, E+n, E×n reductions to get a sentence n+n*n.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!