Search in sources :

Example 21 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class VDM2Lustre method visit.

public void visit(ContractSpec contractSpec) {
    for (SymbolDefinition symbol : contractSpec.getSymbol()) {
        DataType data_type = symbol.getDataType();
        String user_defined_type = data_type.getUserDefinedType();
        if (user_defined_type != null) {
            user_defined_type = user_defined_type.replace(".", "_dot_");
            user_defined_type = user_defined_type.replace("::", "_double_colon_");
            boolean implemented_type = typeDeclarations.containsKey(user_defined_type);
            if (implemented_type) {
                data_type.setUserDefinedType(user_defined_type);
            }
        }
        Expression expr = symbol.getDefinition();
        expr = visitExpression(expr);
        symbol.setDefinition(expr);
        recordLiteral(expr);
    }
    String mbas_fml = "((.+):(.+):(.+))|((.+):Formula$)";
    Pattern fml_pattern = Pattern.compile(mbas_fml);
    List<ContractItem> mbas_guarantee = new ArrayList<ContractItem>();
    // guarantee
    for (ContractItem contractItem : contractSpec.getGuarantee()) {
        if (contractItem.getName() != null) {
            Matcher m = fml_pattern.matcher(contractItem.getName());
            if (m.find()) {
                mbas_guarantee.add(contractItem);
            } else {
                // Normal Formula
                visit(contractItem);
            }
        } else {
            visit(contractItem);
        }
    }
    // remove MBAS guarantee
    contractSpec.getGuarantee().removeAll(mbas_guarantee);
}
Also used : Pattern(java.util.regex.Pattern) Expression(verdict.vdm.vdm_lustre.Expression) ContractItem(verdict.vdm.vdm_lustre.ContractItem) Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) DataType(verdict.vdm.vdm_data.DataType) SymbolDefinition(verdict.vdm.vdm_lustre.SymbolDefinition)

Example 22 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class VDM2Lustre method visit.

public void visit(ConstantDeclaration constantDeclaration) {
    // String identifier = constantDeclaration.getName();
    DataType data_type = constantDeclaration.getDataType();
    String user_defined_type = data_type.getUserDefinedType();
    if (user_defined_type != null) {
        user_defined_type = user_defined_type.replace(".", "_dot_");
        user_defined_type = user_defined_type.replace("::", "_double_colon_");
        boolean implemented_type = typeDeclarations.containsKey(user_defined_type);
        if (implemented_type) {
            data_type.setUserDefinedType(user_defined_type);
        }
        Expression expr = constantDeclaration.getDefinition();
        recordLiteral(expr);
    }
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression) DataType(verdict.vdm.vdm_data.DataType)

Example 23 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class VDM2Lustre method visit.

// protected void visitNodeEq(NodeEquation node_eq) {
// 
// Expression rhs_expr = node_eq.getRhs();
// visitExpression(rhs_expr);
// }
public void visit(NodeEquation node_equation) {
    Expression expr = node_equation.getRhs();
    recordLiteral(expr);
// expr = visitExpression(expr);
// node_equation.setRhs(expr);
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression)

Example 24 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class VDM2Lustre method binaryOP.

protected BinaryOperation binaryOP(BinaryOperation op) {
    BinaryOperation op_exp = new BinaryOperation();
    Expression lhs = op.getLhsOperand();
    lhs = visitExpression(lhs);
    Expression rhs = op.getRhsOperand();
    rhs = visitExpression(rhs);
    op_exp.setLhsOperand(lhs);
    op_exp.setRhsOperand(rhs);
    return op_exp;
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression) BinaryOperation(verdict.vdm.vdm_lustre.BinaryOperation)

Example 25 with Expression

use of verdict.vdm.vdm_lustre.Expression in project VERDICT by ge-high-assurance.

the class PrettyPrinter method visit.

public void visit(NodeEquation neq) {
    NodeEquationLHS leq = neq.getLhs();
    Expression expr = neq.getRhs();
}
Also used : Expression(verdict.vdm.vdm_lustre.Expression) NodeEquationLHS(verdict.vdm.vdm_lustre.NodeEquationLHS)

Aggregations

Expression (verdict.vdm.vdm_lustre.Expression)45 ContractItem (verdict.vdm.vdm_lustre.ContractItem)9 BinaryOperation (verdict.vdm.vdm_lustre.BinaryOperation)8 NodeCall (verdict.vdm.vdm_lustre.NodeCall)7 DataType (verdict.vdm.vdm_data.DataType)6 ComponentType (verdict.vdm.vdm_model.ComponentType)6 PropertyExpression (org.osate.aadl2.PropertyExpression)5 ConstantDeclaration (verdict.vdm.vdm_lustre.ConstantDeclaration)5 IfThenElse (verdict.vdm.vdm_lustre.IfThenElse)5 NodeEquation (verdict.vdm.vdm_lustre.NodeEquation)5 RecordLiteral (verdict.vdm.vdm_lustre.RecordLiteral)5 SymbolDefinition (verdict.vdm.vdm_lustre.SymbolDefinition)5 CompInstancePort (verdict.vdm.vdm_model.CompInstancePort)5 ComponentImpl (verdict.vdm.vdm_model.ComponentImpl)5 Port (verdict.vdm.vdm_model.Port)5 BinaryExpr (com.rockwellcollins.atc.agree.agree.BinaryExpr)4 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)4 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)4 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)4 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)4