You will find my technical articles and translations on software in this article. My areas of interest include JAVA - J2EE with all its aspects, specially EJB3, Struts, JSF, Spring, WebServices and other frameworks.

In this case, the stacks will be as below:instruction stack at the end of third line:nillToken stack:Nill

Output:If (X==Y) { B = A;}

Things are not that neat though. There is a diference between a simpleMOVE statement

MOVE A TO B

And a MOVE statement in a complex statement

IF X = Y MOVE A TO BEND-IF

The simple MOVE statement does not upush its reduction outputinto the token stack but the the MOVE statement in the complex statementdoes. So, just after the reduction the program checks if there are anyleaves in the instruction stack. If yes then it pushes its reduced and convertedoutput into the token stack.

One more note, as you may have noticed there is a need to write a prettyPrinter for the outputs.

PROBLEM: While this redduction approach feels very sensible,it is difficult to print the source Natural lines and output JAVA linesin sequence with this approach. The output lists the inputcomplex Natural statement with all its lines and then the outputcomplex JAVA statement as bunch…