Architecture
The architectural changes in the current version of the Equation Engine are divided into two components: the Compiler and the Interpreter. The Compiler transforms the equation into pseudo-code (a pcode different from PeopleTools pcode), that is a type of platform-independent, low-level assembly code. The Interpreter reads the pcode and executes the equation directly. This method enables you to validate the syntax without running the equation. It also simplifies the logic of the programs.
Technical Notes
The architectural approach is a left-to-right look-ahead parser. Context sensitivity was pushed down to the lexical analyzer to make the parsing algorithm simpler.
Standard compiler design uses the driving routine as the parser. The parser makes calls to the lexical analyzer to retrieve units of logical language, called Tokens. It builds a parse tree, which is an internal representation of the structure of the program. It then reduces the parsing stack using the parse tree. For example, an if-then-else-end-if construct would be reduced to an if statement. Some of the reductions trigger calls to the object code generator, which generates the target language to be emitted. In this instance, the compiler output is the pcode. The design of the interpreter is simplified because the pcode is low-level.
Statement constructs were designed to end with END-XXXX phrases so that the parsing table state transitions are from top to bottom. When the equation is compiled by means of the compile equation edit function, additional up-front syntax checks are performed to provide more compile messages with more clarity about what is syntactically wrong with the equation. Additionally, if one of the more complicated statements has a syntax error, then a message appears showing the language syntax for that statement.