Sin Taxes: Generating Parsers for Anything with JavaCC

Sometimes you will be lucky enough to work with data that uses a well-known syntax, such as XML or HTML, as we have done so far in this chapter. In those cases, you can use an existing parser. For other structures, you may need to write your own parser. This is essentially what we did in Chapter 2, in the section "Scan-Do Attitude: Parsing Complex Syntax with the Scanner Class." We encoded the knowledge of our grammar, the relationship between all the parts of the data, into the program itself. If there are no errors in converting the grammar into program logic, this ...

Get Wicked Cool Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.