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

15.10. Jaql Assemblers

When you parse a user's query, you want to create a Query object as a result. To achieve this, you set the initial assembly's target to be a QueryBuilder object. This builder collects information as you parse the user's query. You need assemblers to capture select terms, class names, and comparisons. To handle expressions, you need assemblers for arithmetic operations and variables. Finally, you need an assembler that exchanges a token on an assembly's stack with an atom that has the token's value as its functor. Altogether, the Jaql parser uses six assemblers, as Figure 15.15 shows.

Figure 15.15. Jaql assemblers. The Jaql parser uses six assemblers that help it build an engine query from a user's textual query. Jaql offloads ...

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