Name

calculus — Algebraic type system tool

Synopsis

calculus 

[ -A name ] [ -E file ] [ -T file ] [ -a ] [ -d ] [ -i ] [ -o ] [ -p ] [ -r ] [ -t ] [ -w ] [ -x ]
input-file… [ output-file ]

calculus 

{ -v }

Description

calculus translates a specification of an algebraic type system, input-file, into code representing that system. This takes the form of a number of files which are generated in the output directory, output-file. If no output directory is specified then the current working directory is used.

By default, C code implementing the type system is generated, however this may be changed by means of command-line options.

Input files and command-line options may be given in any order. Options always relate to the input files immediately following.

Type systems for calculus are conventionally named with the extension .alg.

Options

-A name

Specifies that the algebra named name should be used by the output routines. Unless otherwise specified the last algebra input is used for output.

-E file

Specifies a file containing a list of extra types to calculus. These are used, for example, to generate extra disk reading and writing routines in conjunction with the -d option.

-T file

Specifies a template file which is used to generate an output file output-file.

-a

Causes calculus to generate extra statements in its C code which includes assertions about null pointers etc. and other code to help in writing programs using the tool.

-d

Causes calculus to generate disk reading and writing routines designed to add persistence to the generated type system.

-i

Indicates to calculus that input-file is a simple input file.

-o

Causes calculus to output a pretty-print of the input algebra into output-file, which in this instance in an output file. If no output file is given then the standard output is used.

-p

Causes calculus to generate printing routines designed for use in the debugging of programs written using the type system.

-r

Indicates to calculus that input-file is the output of a previous -w option.

-t

Causes calculus to generate #pragma token commands describing the type system. These are designed so that tcc can apply extremely rigorous type checking to programs written using the type system.

-v

Causes calculus to print its version number.

-w

Causes calculus to output a dump of the input algebra into output-file, which in this instance is an output file.

-x

Causes calculus to suppress the vector and vector pointer constructs in its output.

See Also

tcc.