Draw AST from Code. What is the value of instr at the end? Statement instr = new…
- User
Draw AST from Code. What is the value of instr at the end? Statement instr = new Statement1(); Statement eblk = instr.newInstance(); instr.assembleCall("move"); eblk.addToBlock(0, instr); Statement tblk = instr.newInstance(); instr.assembleCall("infect"); tblk.addToBlock(0, instr); instr.assembleCall("turnleft"); tblk.addToBlock(1, instr); instr.assembleIfElse(Condition.NEXT_IS_ENEMY, tblk, eblk);
Draw the AST with \ | and using ASCII
- Assistant
Given the description of the code operations and the process of appending instructions, the following is an imaginary AST (Abstract Syntax Tree):