Translating Expressions to Stack Machine
Connection to Postfix
Example: translate expression
(a*b + b*c + a*c) * 2
into posftix form.
Tree:
Postfix expression:
Compare to cubeArea in Compiled Expression Examples
In compiled code what corresponds to:
- '+'
- '*'
- variables, like a,b,c
- constants, like 2
Conclusion:
Translation Rules
Notation for translation
and similarly for other operations.
For constant ,
The iconst is just special case of bipush