Explain how a parse tree representing an expression can be converted into stack-oriented intermediate code and then
Question:
Explain how a parse tree representing an expression can be converted into stack-oriented intermediate code and then (ii) be translated into simple machine code for a register-oriented architecture (e.g. ARM or IA32) on an instruction-by-instruction basis. Also indicate how this code might be improved to remove push-pop pairs introduced by (ii). Your answer need only consider expression forms encountered in the expression: h(a, g(b), c) * 3 + d [12 marksDefine, in a programming language documentation of your decision, a recursive drop parser that will develop the theoretical sentence structure tree for an info stream adjusting to the above grammar for orders. You might expect the presence of a capacity lex() that will yield a whole number addressing the following lexical token from the info stream, and the capacities mk2(op,x), mk3(op,x,y) and mk4(op,x,y,z) that will build theoretical sentence structure tree hubs with a given administrator and one, a few operands. You ought to expect that exponentiation is correct associativible and the order before repeatwhile ought to be the most limited conceivable. [12 marks] Briefly frame how you would adjust your parser if the order to one side of repeatwhile was changed to be the longest (as opposed to the most limited). [4 marks] 5 Data Structures and Algorithms You are given two arrangements of numbers Xi and Yj , where I and j run from 1 to N. Devise a calculation to track down the M biggest upsides of Xi ?Yj . This calculation ought not be quadratic in N, however being quadratic in M is allowed. You ought to see N as being of the request for 20,000 and M as being of the request for 1,000.
Elementary Principles of Chemical Processes
ISBN: 978-0471720638
3rd Edition
Authors: Richard M. Felder, Ronald W. Rousseau