Jeeves Overview

Figure 17.2 illustrates how various components of a Jeeves-based translator relate to each other. Gray rectangles constitute the Jeeves framework.

Components of a running Jeeves-based translator

Figure 17-2. Components of a running Jeeves-based translator

The Jeeves framework supplies a driver program, jeeves , a template-parsing module, TemplateParser.pm, and a utility module for creating and accessing the syntax tree, AST.pm.

You supply a specification parser for a given application domain, such as OO_Schema.pm, a specification file (emp.om), and one or more templates, such as oo.tpl.

The driver starts by calling the parse function of the specification parser. This calls the AST functions new, add_prop, and add_prop_list to convert all “relevant” data from the specification file to a tree of properties.

The driver then calls the template parser’s parse function, which converts the given template file to an intermediate perl file. (Note the line Translated oo.tpl to oo.tpl.pl in the command-line invocation shown earlier.) The template contains variables along with looping and conditional constructs, all of which are more than adequately supported by Perl itself, so by converting the template to Perl code, we are able to leverage all of Perl’s power. This is similar to early versions of C++ compilers (cfront), which simply converted C++ files to intermediate C files, thus taking advantage of the power, optimization ...

Get Advanced Perl Programming 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.