O'Reilly logo

Advanced Perl Programming by Sriram Srinivasan

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

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 ...

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