This Page

syntax.program

Defines classes for parsing and compiling programs, which consist of a series of relation constraint declarations:

<relation>
<relation>
...
<relation>
class ProgramSyntax(relations)[source]

Represents the abstract syntax of an entire program, which consists of a series of relation declarations.

__init__(relations)[source]

Initializes a new program syntax structure with the given list of relation syntax objects.

__str__()[source]

Converts the program back into a raw string representation equivalent to its input text.

compile()[source]

Compiles the entire program from its abstract syntax structure into a ProgramDeclaration.

Returns:the resulting program declaration.
Raises :a CompilationError if the program fails to statically check.
classmethod parse(text)[source]

Parses the given input text to produce a new ProgramSyntax object.

Returns:the newly created syntax structure for the entire program.
Raises :a ParsingError if the program contains any invalid syntax.