O'Reilly logo

Building Parsers with Java™ by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.1. Building an Arithmetic Parser

Some of the rules of arithmetic are so familiar that it is hard to imagine an alternative, and others are subtle enough that you may not have thought about them. However, the subtle rules of arithmetic are important, and your user may know them and rely on them.

7.1.1. Conventional Symbols

The most obvious convention for arithmetic is the meaning of the symbols for addition, subtraction, multiplication, and division. Addition and subtraction almost always appear as “+” and “-”. Multiplication varies a little more but most often appears as “*”. One alternative for division is the symbol “÷”, although this is giving way to the more popular “/”, which appears on most keyboards. Symbols for exponentiation include ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required