Explore BrainMass

Semantic record and code generation

How do you think a compiler translates into machine language, a branch in the parse tree that looks like the diagram given in attached CompilerTranslate.doc? Show the code that can be generated from the production given in the diagram, and the semantic record created for the new nonterminal symbol <Boolean expression>.


Solution Preview

This response is just a guidance. Please adjust the assembly instructions as per your instruction set.

Semantic record for new nonterminal symbol <Boolean expression> : (temp, integer).

Following ...

Solution Summary

Solution gives a sample generated code, and a variation to it. The code is commented well to help you choose appropriate instructions from your instruction set, in case you are using a different assembly language.