* files.
*
* @author le01, 6.035 Staff (<tt>6.035-staff@mit.edu</tt>)
- * @version <tt>$Id: CLI.java,v 1.4 2004/05/10 21:54:40 bdemsky Exp $</tt>
+ * @version <tt>$Id: CLI.java,v 1.5 2004/05/11 21:14:24 bdemsky Exp $</tt>
*/
public class CLI {
/**
Compiler.REPAIR=false;
} else if (args[i].equals("-aggressivesearch")) {
Compiler.AGGRESSIVESEARCH=true;
+ } else if (args[i].equals("-prunequantifiernodes")) {
+ Compiler.PRUNEQUANTIFIERS=true;
} else if (args[i].equals("-verbose") || args[i].equals("-v")) {
context = 0;
verbose++;
/* Set this flag to false to turn repairs off */
public static boolean REPAIR=true;
public static boolean AGGRESSIVESEARCH=false;
+ public static boolean PRUNEQUANTIFIERS=false;
public static void main(String[] args) {
State state = null;
String field;
Expr index;
- static boolean DOMEMCHECKS=true;
+ static boolean DOMEMCHECKS=false;
static boolean DOTYPECHECKS=false;
static boolean DONULL=false;
if (!foundupdate)
allgood=false;
}
- if (allgood)
+ if (allgood) {
couldremove.remove(gn);
+ if (Compiler.PRUNEQUANTIFIERS) {
+ TermNode tn=(TermNode)gn.getOwner();
+ Constraint constr=tn.getConstraint();
+ for(Iterator consit=((Set)termination.conjunctionmap.get(constr)).iterator();consit.hasNext();) {
+ GraphNode gn4=(GraphNode)consit.next();
+ TermNode tn4=(TermNode)gn4.getOwner();
+ if (tn4.getquantifiernode()) {
+ mustremove.add(gn4); /* This node is history */
+ System.out.println("Eliminating: "+gn4.getTextLabel());
+ }
+ }
+ }
+ }
}
public TypeDescriptor typecheck(SemanticAnalyzer sa) {
TypeDescriptor t=expr.typecheck(sa);
TypeDescriptor ts=setexpr.typecheck(sa);
- if (t!=ts)
+ if (t instanceof StructureTypeDescriptor) {
+ while(((StructureTypeDescriptor)t).getSuperType()!=null)
+ t=((StructureTypeDescriptor)t).getSuperType();
+ }
+ if (ts instanceof StructureTypeDescriptor) {
+ while(((StructureTypeDescriptor)ts).getSuperType()!=null)
+ ts=((StructureTypeDescriptor)ts).getSuperType();
+ }
+ if (t!=ts) {
return null;
-
+ }
return ReservedTypeDescriptor.INT;
}
TypeDescriptor constype = cons.getLogicStatement().typecheck(sa);
if (constype == null) {
+ System.out.println("Failed attempting to type constraint");
ok = false;
} else if (constype != ReservedTypeDescriptor.INT) {
er.report(null, "Type of guard must be 'int' not '" + constype.getSymbol() + "'");
assert qn.getLabel().equals("quantifier");
Quantifier quantifier = parse_quantifier(qn);
if (quantifier == null) {
+ System.out.println("Failed parsing quantifier");
ok = false;
} else {
constraint.addQuantifier(quantifier);
LogicStatement logicexpr = parse_body(pn.getChild("body"));
if (logicexpr == null) {
+ System.out.println("Failed parsing logical expression");
ok = false;
} else {
constraint.setLogicStatement(logicexpr);
AbstractRepair repair;
ScopeNode scope;
MultUpdateNode update;
+ boolean quantifiernode=false;
+
+ public void setquantifiernode() {
+ quantifiernode=true;
+ }
+
+ public boolean getquantifiernode() {
+ return quantifiernode;
+ }
+
public int getType() {
return type;
conjunctionmap.put(c,new HashSet());
((Set)conjunctionmap.get(c)).add(gn);
conjtonodemap.put(dnf.get(j),gn);
-
-
}
// Construct quantifier "conjunction" nodes
for(int j=0;j<c.numQuantifiers();j++) {
DNFConstraint dconst=new DNFConstraint(ip);
dconst=dconst.not();
TermNode tn=new TermNode(c,dconst.get(0));
+ tn.setquantifiernode();
GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
"Conj ("+i+","+j+") "+dconst.get(0).name()
,tn);
DNFConstraint dconst=new DNFConstraint(ip);
dconst=dconst.not();
TermNode tn=new TermNode(c,dconst.get(0));
+ tn.setquantifiernode();
GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
"Conj ("+i+","+j+") "+dconst.get(0).name()
,tn);
import java.util.*;
public class VarExpr extends Expr {
- static boolean DOMEMCHECKS=true;
+ static boolean DOMEMCHECKS=false;
static boolean DOTYPECHECKS=false;
static boolean DONULL=false;