use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class PrettyPrinter method visit.
public void visit(VariableDeclaration var) {
String var_name = var.getName();
sb.append(var_name);
sb.append(" : ");
DataType dataType = var.getDataType();
sb.append(dataType);
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VerdictLustreListener method exitRealType.
/**
* Extract a plain real type.
*/
@Override
public void exitRealType(LustreParser.RealTypeContext ctx) {
ctx.dataType = new DataType();
ctx.dataType.setPlainType(PlainType.REAL);
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDM2Lustre method visit.
public void visit(Port port, Node node) {
PortMode port_mode = port.getMode();
NodeParameter node_parameter = new NodeParameter();
// Node Name
String port_name = port.getName();
node_parameter.setName(port_name);
// Node DataType
DataType dataType = port.getType();
// Change Null DataType to Integer Default Type
if (dataType == null) {
port.setType(defaultType());
}
node_parameter.setDataType(dataType);
// Node Input Parameter
if (port_mode == PortMode.IN) {
node.getInputParameter().add(node_parameter);
} else // Node OutputParameter
if (port_mode == PortMode.OUT) {
node.getOutputParameter().add(node_parameter);
// if(node.isIsImported() != null) {
String inst_cmp = "(.+)_Inst_.*";
Pattern inst_pattern = Pattern.compile(inst_cmp);
Matcher m = inst_pattern.matcher(node.getName());
if (m.matches()) {
node_parameter.setName(node_parameter.getName() + "_instrumented");
}
}
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDM2Lustre method getEventrecord.
protected RecordType getEventrecord(String userDefineType) {
// Define a Record
RecordType eventRecord = new RecordType();
// is_present: bool
RecordField eventField = new RecordField();
DataType boolType = new DataType();
boolType.setPlainType(PlainType.BOOL);
eventField.setName("is_present");
eventField.setType(boolType);
eventRecord.getRecordField().add(eventField);
// value: UserDefined
if (userDefineType != null) {
RecordField eventValue = new RecordField();
DataType valueType = new DataType();
valueType.setUserDefinedType(userDefineType);
eventValue.setName("value");
eventValue.setType(valueType);
eventRecord.getRecordField().add(eventValue);
}
return eventRecord;
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDMInstrumentor method add_vars_assume.
protected SymbolDefinition add_vars_assume(String var, List<String> connections) {
SymbolDefinition var_dec = new SymbolDefinition();
Expression var_expr = new Expression();
Stack<Expression> var_stack = new Stack<Expression>();
for (String con : connections) {
Expression expr = new Expression();
expr.setIdentifier(con);
var_stack.push(expr);
}
if (!var_stack.isEmpty()) {
var_expr = or_expr(var_stack);
}
if (var_expr == null) {
var_expr = new Expression();
var_expr.setIdentifier(var);
}
var_dec.setDefinition(var_expr);
var_dec.setName(var);
DataType dataType = new DataType();
dataType.setPlainType(PlainType.BOOL);
var_dec.setDataType(dataType);
return var_dec;
}
Aggregations