The syntax of the repeat-until statement is given by the following grammar S →…
PYQ GATE 2001
The syntax of the repeat-until statement is given by the following grammar
S → repeat S1 until EWhere E stands for expressions, S and S1 stand for statement. The non-terminals S and S1 have an attribute code that represents generated code. The non-terminal E has two attributes. The attribute code represents generated code to evaluate the expression and store its truth value in a distinct variable, and the attribute varName contains the name of the variable in which the truth value is stored? The truth-value stored in the variable is 1 if E is true, 0 if E is false. Give a syntax-directed definition to generate three-address code for the repeat-until statement. Assume that you can call a function newlabel( ) that returns a distinct label for a statement. Use the operator ‘\\’ to concatenate two strings and the function gen(s) to generate a line containing the string s.
Sign up free to check your answer
Sign up freeLoading lesson…

