Figure 17.2 illustrates how various components of a Jeeves-based translator relate to each other. Gray rectangles constitute the Jeeves framework.
Figure 17-2. Components of a running Jeeves-based translator
The Jeeves framework supplies a driver program,
, 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,
OO_Schema.pm, a specification file
emp.om), and one or more templates, such as
The driver starts by calling the
parse function of
the specification parser. This calls the AST functions
add_prop_list to convert all
“relevant” data from the specification file to a tree of
The driver then calls the template parser’s
parse function, which converts the given template
file to an intermediate perl file. (Note the line
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 ...