Grammar Rule Semantic Rules S- exp еxp.etype D if exp.isFloat then float else int S.val - exp.val exp, .isFloat = exp2 .isFloat or exp, .isFloat exp2 .etype = exp .etype exp3 .etype - exp, .etype...




  1. Draw dependency graphs corresponding to each grammar rule (given in the below table) and for expression 7/4/3.0




  2. Describe the two passes needed to compute the attributes on the syntax tree of 7/4/3.0, including a possible order in which the nodes could be visited and the attribute values computed at each point.



Grammar Rule<br>Semantic Rules<br>S- exp<br>еxp.etype D<br>if exp.isFloat then float else int<br>S.val - exp.val<br>exp, .isFloat =<br>exp2 .isFloat or exp, .isFloat<br>exp2 .etype = exp .etype<br>exp3 .etype - exp, .etype<br>exp,.val =<br>if exp, .etype - int<br>then exp, .val div exps .val<br>else expz .val / exp3 .val<br>exp.isFloat = false<br>exp.val =<br>if exp.etype = int then num.val<br>else Float(num.val)<br>exp.isFloat = true<br>exp.val = num.num.val<br>exp, - expz / exp3<br>exp + num<br>exp num.num<br>

Extracted text: Grammar Rule Semantic Rules S- exp еxp.etype D if exp.isFloat then float else int S.val - exp.val exp, .isFloat = exp2 .isFloat or exp, .isFloat exp2 .etype = exp .etype exp3 .etype - exp, .etype exp,.val = if exp, .etype - int then exp, .val div exps .val else expz .val / exp3 .val exp.isFloat = false exp.val = if exp.etype = int then num.val else Float(num.val) exp.isFloat = true exp.val = num.num.val exp, - expz / exp3 exp + num exp num.num

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here