Question: Please show all work involved Q3: Compilers [10 marks]: Given the followings: Source Grammar: Machine Grammar: INT -1 23 | Int = 1 | 2

 Please show all work involved Q3: Compilers [10 marks]: Given the

Please show all work involved

Q3: Compilers [10 marks]: Given the followings: Source Grammar: Machine Grammar: INT -1 23 | Int = 1 | 2 | 3 REG R1 I R2 I R3 I INST REG""OP REG REG REG"-" LOAD INT Func = sin Expr | pow Expr Expr OPADDSUB MUL | DIV PROG INST PROG PRO ExprInt | Expr Op Expr | (Expr) Func Semantics: [[Int ] ] [[+]] ADD [[-]] = SUB *1MUL [[/-DIV [[Expr1 Op Expr2]] - [[Expr1]] [[Expr2]] [[0p]] [[Func]] [[Expr1]] - SIN or [[Expr1]] [[Expr2]] = POW a) Using the source grammar provided, parse the following expression pow 4 3 sin 2 I b) Create the corresponding parsing tree c) Using the semantics provided, generate the machine instructions for the parsing tree you constructed in b Q3: Compilers [10 marks]: Given the followings: Source Grammar: Machine Grammar: INT -1 23 | Int = 1 | 2 | 3 REG R1 I R2 I R3 I INST REG""OP REG REG REG"-" LOAD INT Func = sin Expr | pow Expr Expr OPADDSUB MUL | DIV PROG INST PROG PRO ExprInt | Expr Op Expr | (Expr) Func Semantics: [[Int ] ] [[+]] ADD [[-]] = SUB *1MUL [[/-DIV [[Expr1 Op Expr2]] - [[Expr1]] [[Expr2]] [[0p]] [[Func]] [[Expr1]] - SIN or [[Expr1]] [[Expr2]] = POW a) Using the source grammar provided, parse the following expression pow 4 3 sin 2 I b) Create the corresponding parsing tree c) Using the semantics provided, generate the machine instructions for the parsing tree you constructed in b

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!