Module UtyStmts implements data types for untyped statements that are used to store parse trees of Quartz statements and modules. The module provides also functions to convert these untyped constructs to corresponding typed statements and modules according to the type rules of the Quartz language.
Type | Description |
These are arguments of module calls that can be optional since wildcards can be used in the Quartz language. |
|
|
|
a Generic consists of a loop variable and its lower and upper bounds |
|
LineNr is used as abbreviation of those integers that denote the line numbers from which the statement has been parsed. |
|
The type checker function Uty2Stmt produces a struct TypeInfo with the following attributes:
|
|
UtyAction is the data type for untyped actons that are generated by the parser for type-checking. There are two categories of actions:
|
|
UtyDeclStmt is the untyped version of DeclStmt; it contains:
|
|
There are two kinds of UtyProofGoals:
|
|
untyped Quartz modules consist of the following entries (some of them refer to the file from which the module has been read from):
|
|
This data type implements untyped statements as generated by the parser. Each untyped statement stores also the line number where it has been parsed from for means of error reporting (if the type-checking should fail). In addition to the typical statements that also appear as Quartz statements, there some further statements that are eliminated by the type-checker:
|
Function or value | Description |
|
Function Uty2Stmt below has to find aifm files to check the correct typing of module calls. To this end, it might has to compile a found qrzfile to a desired aifm file if the latter does not yet exist or is outdated. To this end, we need a forward reference to function CompileQuartzFile in module Compiler. This variable has to be set before calling function Uty2Stmt.
|
Full Usage:
NewTypingContext resetCalledModulesStack modName
Parameters:
bool
modName : string
|
determine new compile context (RootDir and ImportPaths are retained)
|
|
Uty2Module converts an untyped module utyM to a typed one. It determines the global variables ImportPaths of UtyStmts and MacroDefs of UtyExprs before calling the various type-checking functions. It also checks that names of assertions, assumptions, labels etc. do not clash.
|
|
Function Uty2Stmt translates a given untyped statement to a TypeInfo struct (see this module) that either contains error messages in the msgs attribute or contains a corresponding typed statement with additional informations. The function also unrolls generic statements and qualifies the local names of module instances, assumptions, assertions as well as local variable declarations and control flow labels accordingly. Let-statements are also expanded as well as all macro statements, so that the generated statement is a core statement of type Stmt (see module Statements). In particular, nondeterministic statements are replaced by deterministic ones whose control flow is governed by introduced oracle variables (contained in the generated TypeInfo struct). Right-hand side expressions of assignments are adapted to the type of their left hand side whenever possible, and assertions are generated to assure that the assignment is possible. These assertions are directly placed in the generated typed statement at the place where they must be fulfilled.
|