LinedMessage sem = new LinedMessage();
sem.error = true;
sem.pn = v;
- sem.message = s;
+ sem.message = s;
add(sem);
add(sem);
}
+
+ private boolean messageExists(LinedMessage sem) {
+ for (int i = 0; i < messages.size(); i++) {
+
+ LinedMessage cur = (LinedMessage) messages.elementAt(i);
+
+ if (cur.message.equals(sem.message))
+ return true;
+ }
+ return false;
+ }
+
+
private void add(LinedMessage sem) {
+ if (messageExists(sem))
+ return;
+
if (sem.pn == null) {
messages.addElement(sem);
return;
for (int i = 0; i < messages.size(); i++) {
LinedMessage sem = (LinedMessage)messages.elementAt(i);
if (sem.error) {
- output += "error";
+ output += "Semantic Error";
} else {
- output += "warning";
+ output += "Semantic Warning";
}
if (sem.pn != null) {
- output += " (" + filename + sem.pn.getLine() + "): ";
+ output += ": " + filename + ": "+sem.pn.getLine() + ": ";
} else {
- output += " : ";
+ output += ": ";
}
output += sem.message;
vd = (VarDescriptor) sa.getSymbolTable().get(varname);
if (vd == null) {
- System.out.println(varname);
+ //System.out.println(varname);
sa.getErrorReporter().report(null, "Undefined variable '" + varname + "'");
return null;
}
in directory Repair/Ex:
A) cd Ex
-B) java -classpath <path to RepairCompiler> MCC.Compiler ex
+B) java -classpath <path to RepairCompiler> MCC.Compiler -checkonly ex
which builds:
ex.cc
Step 3: Compile checker
-----------------------
-A) copy generated files into Runtime directory
-B) remove old object files rm *.o
-C) run ./buildruntime
-D) build checking object: g++ -g -c ex_aux.cc
-E) g++ -g ex_test.cc *.o
-F) run ./a.out
+A) copy the Runtime directory in Repair/Ex:
+ cp -r <path to RepairCompiler>/MCC/Runtime .
+B) copy generated files into the Runtime directory
+ cp ex.cc ex_aux.* size.* Runtime
+B) remove old object files
+ cd Runtime; rm *.o
+C) ./buildruntime
+D) build checking object:
+ g++ -g -c ex_aux.cc
+E) g++ -g ex_test.cc *.o -o ex
+F) ./ex