Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) a)Assume the BNF as in your notes on the first page of this module. Show a) a left-most derivation and b) the parse tree
1) a)Assume the BNF as in your notes on the first page of this module. Show a) a left-most derivation and b) the parse tree for this program
begin
x
x = 1 ;
y = 2 ;
end
b) Design BNF for expressions using binary + - * /, unary #, with overriding () . Use the standard writing method (binary operators are infix, unary are prefix, and standard precedence and associativity - all operators are associative) except that
* has higher precedence than /, both are right to left, and + is not associative that is 1+2+3 is not valid. Expressions use identifiers or numbers.
C)Using the above, draw a parse tree for x - y * x* 3/ #x. Then give the result, using the tree, when x = 1 and y = 3, assuming the standard meaning of the operators, # is negation, and / is integer division.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started