libutap
|
A visitor which type checks the system it visits. More...
#include <typechecker.h>
Additional Inherited Members | |
![]() | |
virtual int32_t | visitStatement (Statement *stat) |
A visitor which type checks the system it visits.
The type checker can only visit the system given in the constructor. The type checker must not be constructed before the system has been parsed.
TypeChecker::TypeChecker | ( | TimedAutomataSystem * | system, |
bool | refinement = false |
||
) |
|
inlinevirtual |
bool TypeChecker::checkDynamicExpressions | ( | Statement * | stat | ) |
References UTAP::Statement::accept().
Referenced by visitFunction().
bool TypeChecker::checkExpression | ( | expression_t | expr | ) |
Type check an expression.
Type check and checkExpression the expression.
This function performs basic type checking of the given expression and assigns a type to every subexpression of the expression. It checks that only left-hand side values are updated, checks that functions are called with the correct arguments, checks that operators are used with the correct operands and checks that operands to assignment operators are assignment compatible. Errors are reported by calling handleError(). This function does not check/compute the range of integer expressions and thus does not produce out-of-range errors or warnings. Returns true if no type errors were found, false otherwise.
References UTAP::Constants::A_BUCHI, UTAP::Constants::A_UNTIL, UTAP::Constants::A_WEAKUNTIL, UTAP::Constants::AF, UTAP::Constants::AG, UTAP::Constants::AG_R_Piotr, UTAP::Constants::AND, UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::BIT_AND, UTAP::Constants::BIT_LSHIFT, UTAP::Constants::BIT_OR, UTAP::Constants::BIT_RSHIFT, UTAP::Constants::BIT_XOR, UTAP::Constants::BOOL, UTAP::Constants::CEIL_F, UTAP::Constants::CHANNEL, checkIDList(), checkSpawnParameterCompatible(), CLOCK, UTAP::Constants::COMMA, UTAP::Constants::CONSISTENCY, UTAP::Constants::CONSTANT, UTAP::Constants::CONSTRAINT, UTAP::Constants::CONTROL, UTAP::Constants::CONTROL_TOPT, UTAP::Constants::CONTROL_TOPT_DEF1, UTAP::Constants::CONTROL_TOPT_DEF2, UTAP::Constants::COS_F, UTAP::type_t::createPrimitive(), UTAP::Constants::DIFF, UTAP::Constants::DIV, UTAP::Constants::DOUBLE, UTAP::Constants::DOUBLEINVGUARD, UTAP::template_t::dynamic, UTAP::Constants::EF, UTAP::Constants::EF_CONTROL, UTAP::Constants::EF_R_Piotr, UTAP::Constants::EG, UTAP::expression_t::empty(), UTAP::Constants::EQ, UTAP::Constants::EXISTS, UTAP::Constants::EXIT, UTAP::Constants::EXP_F, UTAP::Constants::FABS_F, UTAP::Constants::FLOOR_F, UTAP::Constants::FORALL, UTAP::Constants::FORMULA, UTAP::Constants::FRACTION, UTAP::Constants::FUNCALL, UTAP::Constants::GE, UTAP::type_t::getArraySize(), UTAP::TimedAutomataSystem::getDynamicTemplate(), UTAP::expression_t::getKind(), UTAP::expression_t::getSize(), UTAP::frame_t::getSize(), UTAP::type_t::getSub(), UTAP::expression_t::getType(), UTAP::expression_t::getValue(), UTAP::Constants::GT, UTAP::Constants::GUARD, UTAP::Constants::IDENTIFIER, UTAP::Constants::IMPLEMENTATION, UTAP::Constants::INF_VAR, UTAP::Constants::INLINEIF, UTAP::Constants::INT, UTAP::Constants::INVARIANT, UTAP::Constants::INVARIANT_WR, UTAP::type_t::isArray(), isAssignable(), isBound(), isClock(), isConstantDouble(), isConstantInteger(), isConstraint(), isCost(), UTAP::template_t::isDefined, isDiff(), isDoubleValue(), isFormula(), isGuard(), isInteger(), UTAP::type_t::isInteger(), isIntegral(), UTAP::type_t::isIntegral(), isInvariant(), isInvariantWR(), isListOfFormulas(), isNumber(), isProcessID(), isSameScalarType(), UTAP::type_t::isScalar(), isVoid(), UTAP::Constants::LE, UTAP::Constants::LEADSTO, UTAP::Constants::LIST, UTAP::Constants::LN_F, UTAP::Constants::LOG_F, UTAP::Constants::LT, UTAP::Constants::MAX, UTAP::Constants::MIN, UTAP::Constants::MINUS, UTAP::Constants::MITLATOM, UTAP::Constants::MITLCONJ, UTAP::Constants::MITLDISJ, UTAP::Constants::MITLFORMULA, UTAP::Constants::MITLNEXT, UTAP::Constants::MITLRELEASE, UTAP::Constants::MITLUNTIL, UTAP::Constants::MOD, UTAP::Constants::MULT, UTAP::Constants::NEQ, UTAP::Constants::NOT, UTAP::Constants::NUMOF, UTAP::Constants::OR, UTAP::instance_t::parameters, UTAP::Constants::PLUS, UTAP::Constants::PMAX, UTAP::Constants::PO_CONTROL, UTAP::Constants::POSTDECREMENT, UTAP::Constants::POSTINCREMENT, UTAP::Constants::POW_F, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, UTAP::Constants::PROBABOX, UTAP::Constants::PROBACMP, UTAP::Constants::PROBADIAMOND, UTAP::Constants::PROBAEXP, UTAP::Constants::PROBAMINBOX, UTAP::Constants::PROBAMINDIAMOND, UTAP::Constants::PROCESS, UTAP::Constants::RANDOM_F, UTAP::Constants::RATE, UTAP::Constants::REFINEMENT_GE, UTAP::Constants::REFINEMENT_LE, UTAP::Constants::RESTRICT, UTAP::Constants::SCENARIO, UTAP::Constants::SCENARIO2, UTAP::expression_t::setType(), UTAP::Constants::SIMULATE, UTAP::Constants::SIMULATEREACH, UTAP::Constants::SIMULATION_GE, UTAP::Constants::SIMULATION_LE, UTAP::Constants::SIN_F, UTAP::type_t::size(), UTAP::Constants::SMC_CONTROL, UTAP::Constants::SPAWN, UTAP::Constants::SPECIFICATION, UTAP::Constants::SQRT_F, UTAP::Constants::SUM, UTAP::Constants::SUMDYNAMIC, UTAP::Constants::SUP_VAR, UTAP::Constants::SYNTAX_COMPOSITION, UTAP::Constants::TIOCOMPOSITION, UTAP::Constants::TIOCONJUNCTION, UTAP::Constants::TIOGRAPH, UTAP::Constants::TIOQUOTIENT, UTAP::Constants::UNARY_MINUS, UTAP::type_t::unknown(), and UTAP::Constants::XOR.
Referenced by parseExpression(), TypeChecker(), visitAssertStatement(), visitBlockStatement(), visitCondition(), visitDoWhileStatement(), visitEdge(), visitForStatement(), visitGanttChart(), visitHybridClock(), visitIfStatement(), visitInstance(), visitIODecl(), visitMessage(), visitProgressMeasure(), visitProperty(), visitReturnStatement(), visitState(), visitSystemAfter(), visitVariable(), and visitWhileStatement().
bool UTAP::TypeChecker::checkSpawnAndExit | ( | expression_t | ) |
bool TypeChecker::checkSpawnParameterCompatible | ( | type_t | param, |
expression_t | arg | ||
) |
Referenced by checkExpression().
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::expression_t::changesAnyVariable(), checkExpression(), and UTAP::AssertStatement::expr.
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::BlockStatement::begin(), UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::expression_t::empty(), UTAP::BlockStatement::end(), UTAP::variable_t::expr, UTAP::symbol_t::getData(), UTAP::BlockStatement::getFrame(), UTAP::frame_t::getSize(), UTAP::symbol_t::getType(), and UTAP::symbol().
|
virtual |
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::Statement::accept(), checkExpression(), UTAP::DoWhileStatement::cond, and UTAP::DoWhileStatement::stat.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::edge_t::assign, UTAP::Constants::BROADCAST, UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::TimedAutomataSystem::clockGuardRecvBroadcast(), UTAP::edge_t::control, UTAP::edge_t::dst, UTAP::expression_t::empty(), UTAP::expression_t::get(), UTAP::frame_t::getSize(), UTAP::expression_t::getSync(), UTAP::expression_t::getType(), UTAP::edge_t::guard, hasStrictLowerBound(), hasStrictUpperBound(), UTAP::state_t::invariant, UTAP::type_t::is(), UTAP::type_t::isChannel(), isGuard(), isIntegral(), UTAP::expression_t::isTrue(), UTAP::TimedAutomataSystem::recordStrictLowerBoundOnControllableEdges(), UTAP::edge_t::select, UTAP::TimedAutomataSystem::setUrgentTransition(), UTAP::edge_t::sync, UTAP::Constants::SYNC_BANG, UTAP::Constants::SYNC_CSP, UTAP::Constants::SYNC_QUE, UTAP::edge_t::toString(), UTAP::type_t::toString(), URGENT, and UTAP::SystemVisitor::visitEdge().
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::ExprStatement::expr.
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::Statement::accept(), checkExpression(), UTAP::ForStatement::cond, UTAP::ForStatement::init, UTAP::ForStatement::stat, and UTAP::ForStatement::step.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::BlockStatement::accept(), UTAP::function_t::body, UTAP::function_t::changes, checkDynamicExpressions(), UTAP::function_t::depends, UTAP::BlockStatement::getFrame(), UTAP::symbol_t::getType(), UTAP::type_t::isVoid(), UTAP::type_t::size(), UTAP::function_t::uid, validReturnType(), UTAP::function_t::variables, and UTAP::SystemVisitor::visitFunction().
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References checkExpression(), UTAP::frame_t::getSize(), isConstraint(), isIntegral(), UTAP::gantt_t::mapping, and UTAP::gantt_t::parameters.
|
virtual |
References UTAP::expression_t::changesAnyVariable(), checkExpression(), and isClock().
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::Statement::accept(), checkExpression(), UTAP::IfStatement::cond, UTAP::IfStatement::falseCase, and UTAP::IfStatement::trueCase.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::instance_t::arguments, UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::symbol_t::getType(), UTAP::type_t::is(), UTAP::type_t::isConstant(), UTAP::instance_t::mapping, UTAP::instance_t::parameters, UTAP::Constants::REF, UTAP::type_t::size(), UTAP::instance_t::uid, and UTAP::SystemVisitor::visitInstance().
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::SystemVisitor::visitInstanceLine().
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::TimedAutomataSystem::addError(), UTAP::Constants::ARRAY, UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::iodecl_t::csp, UTAP::expression_t::getKind(), UTAP::type_t::getSub(), UTAP::iodecl_t::inputs, UTAP::type_t::isArray(), UTAP::type_t::isChannel(), isInteger(), UTAP::iodecl_t::outputs, UTAP::iodecl_t::param, and UTAP::TimedAutomataSystem::setSyncUsed().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References checkExpression(), UTAP::expression_t::empty(), UTAP::progress_t::guard, isIntegral(), and UTAP::progress_t::measure.
|
virtual |
References UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::Constants::CONSISTENCY, UTAP::expression_t::getKind(), UTAP::expression_t::getSize(), UTAP::expression_t::getType(), hasMITLInQuantifiedSub(), UTAP::Constants::INF_VAR, UTAP::type_t::is(), isConstraint(), isFormula(), isGameProperty(), UTAP::Constants::MITLFORMULA, UTAP::Constants::PO_CONTROL, UTAP::Constants::PROBABOX, UTAP::Constants::PROBACMP, UTAP::Constants::PROBADIAMOND, UTAP::Constants::PROBAEXP, UTAP::Constants::PROBAMINBOX, UTAP::Constants::PROBAMINDIAMOND, UTAP::Constants::SCENARIO, UTAP::Constants::SIMULATE, UTAP::Constants::SIMULATEREACH, UTAP::Constants::SUP_VAR, and UTAP::Constants::TIOGRAPH.
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References checkExpression(), UTAP::expression_t::empty(), and UTAP::ReturnStatement::value.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::state_t::costRate, UTAP::expression_t::empty(), UTAP::state_t::exponentialRate, UTAP::Constants::FRACTION, UTAP::expression_t::getKind(), UTAP::expression_t::getType(), UTAP::state_t::invariant, UTAP::type_t::isDouble(), isIntegral(), isInvariantWR(), UTAP::TimedAutomataSystem::recordStopWatch(), UTAP::TimedAutomataSystem::recordStrictInvariant(), UTAP::type_t::toString(), and UTAP::SystemVisitor::visitState().
|
virtual |
|
virtual |
Reimplemented from UTAP::SystemVisitor.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::expression_t::empty(), UTAP::update_t::label, and UTAP::SystemVisitor::visitUpdate().
|
virtual |
Reimplemented from UTAP::SystemVisitor.
References UTAP::expression_t::changesAnyVariable(), checkExpression(), UTAP::expression_t::empty(), UTAP::variable_t::expr, UTAP::symbol_t::getType(), UTAP::expression_t::hasDynamicSub(), UTAP::expression_t::isDynamic(), UTAP::variable_t::uid, and UTAP::SystemVisitor::visitVariable().
|
virtual |
Reimplemented from UTAP::AbstractStatementVisitor.
References UTAP::Statement::accept(), checkExpression(), UTAP::WhileStatement::cond, and UTAP::WhileStatement::stat.