Building Parsers with Java

Package sjm.examples.arithmetic

Class Summary
ArithmeticParser This class provides a parser that recognizes arithmetic expressions.
DivideAssembler Pop two numbers from the stack and push the result of dividing the top number into the one below it.
ExpAssembler Pop two numbers from the stack and push the result of exponentiating the lower number to the upper one.
MinusAssembler Pop two numbers from the stack and push the result of subtracting the top number from the one below it.
NumAssembler Replace the top token in the stack with the token's Double value.
PlusAssembler Pop two numbers from the stack and push their sum.
ShowArithmeticParser Show how to use the ArithmeticParser class.
TimesAssembler Pop two numbers from the stack and push the result of multiplying the top number by the one below it.
 

Exception Summary
ArithmeticExpressionException Signals that a given string is not recognizable as an arthmetic expression.
 


by Steve Metsker