The tlcore application

Now that the Core TransLucid library has been developed, it is time to develop some applications.
The first application is called tlcore. It simply reads, either from a file or from the standard input, a TransLucid header, set of equations and set of expressions. The expressions are then evaluated one by one, and the results are placed on the standard output or in a file.

The interface is as follows:

tlcore --input=infile --output=outfile

along with the standard –verbose and –version options.

If the –input option is not provided, input is read from the standard input.
If the –output option is not provided, output is written to the standard output.
All errors or log messages, including version information, are written to the standard error.

The syntax of the files is simple. It consists of three parts:

header
%%
equations
%%
expressions

where each part follows its standard syntax.

The expressions are to be read, one by one, and then evaluated. The answers are provided as follows:

answer1;;
...;;
answern;;

Should the –verbose option be used, then the output will be

expr1answer1;;
...;;
exprnanswern;;

The inContext variable is used to define the default context for parsing expressions.

The outContext variable is used to define the default context for printing expressions.

Advertisement