public final class Checking
extends java.lang.Object
Constructor and Description |
---|
Checking() |
Modifier and Type | Method and Description |
---|---|
static Type |
canonical(Type type)
Returns canonical version of type (equality of two types implies
the equality of the canonical version of the types).
|
static Type |
canonicalTcc(Type type)
Returns canonical version of type (equality of two types implies
the equality of the canonical version of the types).
|
static TypeExpression |
clearSubtypes(Type type,
Expression exp)
return version of type where subtypes and subranges (including NAT) are
replaced by their base types; the corresponding constraints are
returned as a formula which a corresponding expression exp has to fulfill
|
static AtomicType |
getBitType()
Get canonical type BIT
|
static AtomicType |
getBooleanType()
Get canonical type BOOLEAN
|
static AtomicType |
getIntType()
Get canonical type INT
|
static AtomicType |
getNatType()
Get canonical type NAT
|
static AtomicType |
getRealType()
Get canonical type REAL
|
static java.util.Collection<Symbol> |
getReferencedSymbols()
get collection of referenced symbols
|
static boolean |
hasType(Expression exp,
Type etype,
Type type,
boolean tcc)
returns true iff expr of type etype matches type.
|
static void |
init()
Initialize checking state
|
static boolean |
isBoolean(Type type)
checks if type equals BOOLEAN
|
static boolean |
isInt(Type type)
checks if type equals INT
|
static boolean |
isNat(Type type)
checks if type equals NAT
|
static boolean |
isReal(Type type)
checks if type equals REAL
|
static Type |
processDefinitionTerm(Expression value)
type check definition term with potential first-order type check
|
static Type |
processFormula(Expression value)
type check value without first-order type check
|
static Type |
processTerm(Expression value)
type check term with potential first-order type check
|
static Type |
processTermOrFormula(Expression value)
type check term with potential first-order type check
|
static void |
resetReferencedSymbols()
reset collection of referenced symbols
|
static void |
setStrongerTypes(boolean stronger)
signals whether stronger type discipline is to be preserved
|
static void |
setWeakerTypes(boolean weaker)
signals whether weaker type discipline is to be preserved
|
static void |
simplifyNames(TypedIdentifier[] vars,
Environment env,
Expression exp)
Simplify names of local variables to their base names
if no name capture can occur.
|
static Type |
subType(Type type0,
Type type1)
return greatest subtype of type0 and type1 (null, if none exists)
does not generate tccs.
|
static boolean |
validDefinitionType(Type type)
decide whether definition type is first order, i.e.,
- a function type is only allowed at the top level
- the type BOOLEAN is only allowed at the top level
or as the range of the function type
|
static boolean |
validTerm(Expression exp)
decide whether expression denotes a term
|
static boolean |
validTermType(Type type)
decide whether type does not contain a function type or BOOLEAN.
|
public static void init()
public static void setStrongerTypes(boolean stronger)
stronger
- is true iff stronger type discipline is to be preservedpublic static void setWeakerTypes(boolean weaker)
weaker
- is true iff weaker type discipline is to be preservedpublic static AtomicType getBooleanType()
public static AtomicType getBitType()
public static AtomicType getIntType()
public static AtomicType getNatType()
public static AtomicType getRealType()
public static boolean isBoolean(Type type)
type
- the type.public static boolean isInt(Type type)
type
- the type.public static boolean isNat(Type type)
type
- the type.public static boolean isReal(Type type)
type
- the type.public static java.util.Collection<Symbol> getReferencedSymbols()
public static void resetReferencedSymbols()
public static Type canonical(Type type)
type
- the typepublic static Type canonicalTcc(Type type)
type
- the typepublic static boolean validDefinitionType(Type type)
type
- an already processed type arising from a type definitionpublic static boolean validTermType(Type type)
type
- an already processed typepublic static boolean validTerm(Expression exp)
exp
- the expression to be checkedpublic static Type processDefinitionTerm(Expression value)
value
- the definition term to be type checkedpublic static Type processTerm(Expression value)
value
- the term to be type checkedpublic static Type processFormula(Expression value)
value
- the value to be type checkedpublic static Type processTermOrFormula(Expression value)
value
- the term to be type checkedpublic static boolean hasType(Expression exp, Type etype, Type type, boolean tcc)
exp
- the expression (may be null if tcc is false)etype
- its typetype
- the type which expr:etype is expected to matchtcc
- true iff a tcc may be generatedpublic static Type subType(Type type0, Type type1)
type0
- a typetype1
- a typepublic static TypeExpression clearSubtypes(Type type, Expression exp)
type
- the type to be clearedexp
- an expression of this typepublic static void simplifyNames(TypedIdentifier[] vars, Environment env, Expression exp)
vars
- local variablesenv
- the environment in which the local variables are introduced.exp
- the expression within which the variables are referenced.