Skip to content

Commit

Permalink
Add generator support for vdmSetEnumerateSetOfIntsGC
Browse files Browse the repository at this point in the history
Closes #126
  • Loading branch information
peterwvj committed Feb 12, 2018
1 parent 837a464 commit ebda231
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
@@ -1,5 +1,6 @@
package org.overture.codegen.vdm2c;

import static org.overture.codegen.vdm2c.utils.CTransUtil.newApply;
import static org.overture.codegen.vdm2c.utils.CTransUtil.rewriteToApply;

import java.util.LinkedList;
Expand Down Expand Up @@ -43,6 +44,7 @@ public class ColTrans extends DepthFirstAnalysisCAdaptor implements IApplyAssist
public static final String SET_DIST_UNION = "vdmSetDunion";
public static final String SET_DIST_INTER = "vdmSetDinter";
public static final String SET_POWER_SET = "vdmSetPower";
public static final String SET_RANGE = "vdmSetEnumerateSetOfInts";

// Map operations
public static final String MAP_DOM = "vdmMapDom";
Expand Down Expand Up @@ -233,6 +235,12 @@ public void caseAPowerSetUnaryExpIR(APowerSetUnaryExpIR node) throws AnalysisExc
rewriteToApply(this, node, SET_POWER_SET, node.getExp());
}

@Override
public void caseARangeSetExpIR(ARangeSetExpIR node) throws AnalysisException {

rewriteToApply(this, node, SET_RANGE, newApply("toInteger", node.getFirst().clone()), newApply("toInteger", node.getLast().clone()));
}

@Override
public void caseAMapDomainUnaryExpIR(AMapDomainUnaryExpIR node) throws AnalysisException {

Expand Down
@@ -1,20 +1,23 @@
package org.overture.codegen.vdm2c.transformations;

import java.util.HashMap;
import java.util.LinkedList;

import org.overture.cgc.extast.analysis.DepthFirstAnalysisCAdaptor;
import org.overture.codegen.ir.INode;
import org.overture.codegen.ir.SExpIR;
import org.overture.codegen.ir.SPatternIR;
import org.overture.codegen.ir.STypeIR;
import org.overture.codegen.ir.analysis.AnalysisException;
import org.overture.codegen.ir.declarations.*;
import org.overture.codegen.ir.declarations.ADefaultClassDeclIR;
import org.overture.codegen.ir.declarations.AFormalParamLocalParamIR;
import org.overture.codegen.ir.declarations.AMethodDeclIR;
import org.overture.codegen.ir.declarations.AVarDeclIR;
import org.overture.codegen.ir.expressions.AApplyExpIR;
import org.overture.codegen.ir.expressions.AExternalExpIR;
import org.overture.codegen.ir.expressions.AIdentifierVarExpIR;
import org.overture.codegen.ir.patterns.AIdentifierPatternIR;
import org.overture.codegen.ir.statements.ABlockStmIR;
import org.overture.codegen.ir.statements.APlainCallStmIR;
import org.overture.codegen.ir.statements.AReturnStmIR;
import org.overture.codegen.ir.statements.ASkipStmIR;
import org.overture.codegen.ir.types.AExternalTypeIR;
import org.overture.codegen.ir.types.AUnknownTypeIR;
import org.overture.codegen.trans.assistants.TransAssistantIR;
Expand All @@ -26,13 +29,13 @@
import org.overture.codegen.vdm2c.extast.expressions.AMacroApplyExpIR;
import org.overture.codegen.vdm2c.extast.statements.ALocalVariableDeclarationStmIR;
import org.overture.codegen.vdm2c.tags.CTags;
import org.overture.codegen.vdm2c.utils.*;
import org.overture.codegen.vdm2c.utils.CLetBeStStrategy;
import org.overture.codegen.vdm2c.utils.CSeqCompStrategy;
import org.overture.codegen.vdm2c.utils.CSetCompStrategy;
import org.overture.codegen.vdm2c.utils.CTransUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.LinkedList;

public class GarbageCollectionTrans extends DepthFirstAnalysisCAdaptor
{
final static Logger logger = LoggerFactory.getLogger(GarbageCollectionTrans.class);
Expand Down Expand Up @@ -131,6 +134,7 @@ public void initNames()
gcNames.put(ColTrans.SET_DIST_UNION, "vdmSetDunionGC");
gcNames.put(ColTrans.SET_DIST_INTER, "vdmSetDinterGC");
gcNames.put(ColTrans.SET_POWER_SET, "vdmSetPowerGC");
gcNames.put(ColTrans.SET_RANGE, "vdmSetEnumerateSetOfIntsGC");

// Comprehensions
gcNames.put(CSetCompStrategy.NEW_SET_VAR_TO_GROW, "newSetVarToGrowGC");
Expand Down

This file was deleted.

0 comments on commit ebda231

Please sign in to comment.