GATE | GATE CS 1997 | Question 67

The language L, defined by the following grammar allows use of real or integer data in expressions and assignment statements.

(assign-stmt):: = (LHS):= (E)
(E)          :: = (E) + (T) | (T)
(T)          :: = (T) * (V) | (V)
(V)          :: = id | ((E))
(LHS)        :: = id

It 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.



Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.