

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


[pr]?ink [a-z][a-z0-9]* [1-9][0-9][0-9] /*[^*]+*/ ([a-c][0-9])+ (10%)
print 10 print a+10 where a= print a+b-c where a=2, b=4, c=21 (20%)
B ::= spring A | spring num C (5%)
P ::= D begin S end D ::= var V V::= T V | ε T ::= int id ; | real id ; S ::= id := num S | ε
Draw a parse tree for the sentence: var int i; int j; begin end (25+5%)
Use the following inherited and synthesized attributes: X I(X) S(X) Type Eq equal boolean Sum val int Prod val int Fact val Int AddOp left_op, right_op sum Int MulOp left_op, right_op prod Int
The meaning of the expression is true if the value of the left expression is equal to the value of right expression. Hence, the meaning of the sentence: 3*2 = 5+1 is true, while the meaning of the sentence: 1+1+1 = 4 is false. (30%)