Skip to content
Related Articles

Related Articles

GATE | GATE CS 1997 | Question 67
  • Last Updated : 30 Oct, 2017

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
Recommended Articles
Page :