use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDM2Lustre method visit.
public void visit(NodeBody nodeBody, LustreProgram program) {
for (VariableDeclaration var : nodeBody.getVariableDeclaration()) {
DataType data_type = var.getDataType();
String user_defined_type = null;
if (data_type != null) {
user_defined_type = data_type.getUserDefinedType();
}
if (user_defined_type != null) {
// user_defined_type = user_defined_type + "_Impl";
boolean implemented_type = typeDeclarations.containsKey(user_defined_type);
if (implemented_type) {
data_type.setUserDefinedType(user_defined_type);
}
}
}
for (NodeEquation node_equation : nodeBody.getEquation()) {
visit(node_equation);
}
// Update Expression related to Events
// for (NodeEquation node_equation : nodeBody.getEquation()) {
// visitNodeEq(node_equation);
// }
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDM2Lustre method getEventType.
protected DataType getEventType(DataType dataType, LustreProgram lustreProgram) {
// LustreProgram lustreProgram = vdm_model.getDataflowCode();
DataType eventType = new DataType();
TypeDeclaration eventTypeDeclaration = defineEventDeclaration(dataType);
String eventTypeName = eventTypeDeclaration.getName();
eventType.setUserDefinedType(eventTypeName);
if (!typeDeclarations.containsKey(eventTypeName)) {
typeDeclarations.put(eventTypeName, eventTypeDeclaration);
lustreProgram.getTypeDeclaration().add(eventTypeDeclaration);
}
return eventType;
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VDM2Lustre method visit.
// Event Ports
public void visit(Port port, LustreProgram lustreProgram) {
// Print Event Ports.
if (port.isEvent() != null && port.isEvent()) {
DataType dataType = port.getType();
DataType eventType = getEventType(dataType, lustreProgram);
port.setType(eventType);
}
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VerdictLustreListener method exitArrayType.
/**
* Extract an array type.
*/
@Override
public void exitArrayType(LustreParser.ArrayTypeContext ctx) {
ArrayType arrayType = new ArrayType();
arrayType.setDataType(ctx.type().dataType);
arrayType.setDimension(ctx.expr().getText());
ctx.dataType = new DataType();
ctx.dataType.setArrayType(arrayType);
}
use of verdict.vdm.vdm_data.DataType in project VERDICT by ge-high-assurance.
the class VerdictLustreListener method exitSubrangeType.
/**
* Extract a subrange type.
*/
@Override
public void exitSubrangeType(LustreParser.SubrangeTypeContext ctx) {
SubrangeType subrangeType = new SubrangeType();
subrangeType.setLowerBound(ctx.bound(0).getText());
subrangeType.setType("int");
subrangeType.setUpperBound(ctx.bound(1).getText());
ctx.dataType = new DataType();
ctx.dataType.setSubrangeType(subrangeType);
}
Aggregations