Inquisitor
Using the Language
The language is simple in its structure, there are no sub-routines, merely sequential code. However, it should be noted that the essential nature of the code is recursive, and that this recursion takes place in the RECORD_STATEMENT, the most fundamentally important structure in the language. Before discussing this in detail, let's look at putting together a simple Inquisitor program script.
The code is free format, with WHITESPACE being ignored except in STRINGs. Newlines are not necessary to terminate statements, and several statements may be written on one line. We recommend, however, that you use one statement per line with indentations where necessary, to make the code easier to read. Comments can be placed starting anywhere in a line by entering the construct // followed by the comment, and they are terminated by the NEWLINE at the end of that line. As logical and arithmetic operators can be used in either C or Fortran form (for example, logical equals can be == or.EQ., logical and can be && or.AND., etc. See the Syntax Table for the complete list), it is possible to use different coding styles.
There are four possible sections to an Inquisitor script, each of which is programmable with exactly the same syntax. These are the INITIALIZATION, QUERY, GROUP, and FINALIZATION sections. With the exception of the QUERY section, they are all optional.
- INITIALIZATION Section
This section of code will be executed once only at the beginning of the Inquisitor run. Typically, this section would be used to initialise variables (for example, accumulators, constants, etc.) and to print out report headers. - QUERY Section
This is the main section of the Inquisitor script, and the only section that is mandatory. This operates recursively on every relationship group in the database (or just every relationship group listed in the previous selection file, if one was specified). - GROUP Section
This operates once only for each relationship group, but only when there has been at least one successful complete recursion through the QUERY section. This section might be used to report a series of totals when the QUERY section has passed through everything appropriate in the group. - FINALIZATION Section
This section of code will be executed once only at the end of the Inquisitor run. Typically, this section would be used to print total accumulations for a report, and report footers or termination comments.
In each of these sections the code falls into two sub-sections:
- STATEMENTS
- EXEC_STATEMENTS
STATEMENTs are essentially data-gathering and data-setting statements, consisting of the DATA_STATEMENT and RECORD_STATEMENT constructs with optional CONTROL_STATEMENTS.
EXEC_Statements are the operation statements for printing to reports, and manipulating the database. Currently, the two statement types cannot be mixed. The Statements must come first, and once the first EXEC_STATEMENT is reached no further Statements are allowed. Successful querying through the Statements (upon reaching the EXEC_STATEMENTS) will trigger the execution of the GROUP section (if one is specified).
In order to keep parsing simple, brackets surround all expressions in this language (...). Thus, to add two integer items together, the syntax would be:
(INTEGER + INTEGER)
to add three items together, the syntax would be:
(INTEGER + (INTEGER + INTEGER))
or
((INTEGER + INTEGER) + INTEGER)