From: cristic Date: Thu, 15 Apr 2004 20:20:48 +0000 (+0000) Subject: Added the name of the file to the error report. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=commitdiff_plain;h=2aa90220f8a6a51dc84abb6c1dbb85db0b204f42 Added the name of the file to the error report. Changed some error msgs. --- diff --git a/Repair/RepairCompiler/MCC/CDL.cup b/Repair/RepairCompiler/MCC/CDL.cup index e6df103..e77068d 100755 --- a/Repair/RepairCompiler/MCC/CDL.cup +++ b/Repair/RepairCompiler/MCC/CDL.cup @@ -56,13 +56,15 @@ action code {: init with {: :} parser code {: + + public String filename; public void syntax_error (java_cup.runtime.Symbol current) { CUP$CDLParser$actions.errors = true; Symbol symbol = (Symbol) current; - report_error("CDL: Syntax error at line " + (symbol.line + 1) - + ", column " + LineCount.getColumn(symbol.left) + ": " + current.value, current); + report_error(filename+":"+(symbol.line+1)+": Syntax error at column " + LineCount.getColumn(symbol.left) +": " + current.value, current); + System.exit(0); } public void report_fatal_error (String message, Object info) { diff --git a/Repair/RepairCompiler/MCC/Compiler.java b/Repair/RepairCompiler/MCC/Compiler.java index cc1f0de..c2d1612 100755 --- a/Repair/RepairCompiler/MCC/Compiler.java +++ b/Repair/RepairCompiler/MCC/Compiler.java @@ -249,6 +249,7 @@ public class Compiler { LineCount.reset(); FileInputStream infile = new FileInputStream(state.infile + ".struct"); TDLParser parser = new TDLParser(new Lexer(infile)); + parser.filename = state.infile + ".struct"; CUP$TDLParser$actions.debug = state.verbose > 1 ; state.ptStructures = (ParseNode) parser.parse().value; } catch (FileNotFoundException fnfe) { @@ -284,6 +285,7 @@ public class Compiler { LineCount.reset(); FileInputStream infile = new FileInputStream(state.infile + ".space"); SDLParser parser = new SDLParser(new Lexer(infile)); + parser.filename = state.infile + ".space"; CUP$SDLParser$actions.debug = state.verbose > 1 ; state.ptSpace = (ParseNode) parser.parse().value; } catch (FileNotFoundException fnfe) { @@ -301,6 +303,7 @@ public class Compiler { LineCount.reset(); FileInputStream infile = new FileInputStream(state.infile + ".constraints"); CDLParser parser = new CDLParser(new Lexer(infile)); + parser.filename = state.infile + ".constraints"; CUP$CDLParser$actions.debug = state.verbose > 1 ; state.ptConstraints = (ParseNode) parser.parse().value; } catch (FileNotFoundException fnfe) { diff --git a/Repair/RepairCompiler/MCC/MDL.cup b/Repair/RepairCompiler/MCC/MDL.cup index b8a2ad1..0a3aa09 100755 --- a/Repair/RepairCompiler/MCC/MDL.cup +++ b/Repair/RepairCompiler/MCC/MDL.cup @@ -63,9 +63,8 @@ parser code {: CUP$MDLParser$actions.errors = true; Symbol symbol = (Symbol) current; - report_error(filename+": Syntax error at line " + -(symbol.line + 1) + ", column " + LineCount.getColumn(symbol.left) + -": " + current.value, current); + report_error(filename+":"+(symbol.line+1)+": Syntax error at column " + LineCount.getColumn(symbol.left) +": " + current.value, current); + System.exit(0); } public void report_fatal_error (String message, Object info) { diff --git a/Repair/RepairCompiler/MCC/SDL.cup b/Repair/RepairCompiler/MCC/SDL.cup index f8997e9..ee5172c 100755 --- a/Repair/RepairCompiler/MCC/SDL.cup +++ b/Repair/RepairCompiler/MCC/SDL.cup @@ -56,13 +56,16 @@ action code {: init with {: :} parser code {: + + public String filename; public void syntax_error (java_cup.runtime.Symbol current) { CUP$SDLParser$actions.errors = true; Symbol symbol = (Symbol) current; - report_error("SDL: Syntax error at line " + (symbol.line + 1) + report_error("TDL: Syntax error at line " + (symbol.line + 1) + ", column " + LineCount.getColumn(symbol.left) + ": " + current.value, current); + System.exit(0); } public void report_fatal_error (String message, Object info) { diff --git a/Repair/RepairCompiler/MCC/TDL.cup b/Repair/RepairCompiler/MCC/TDL.cup index c616b94..db35ad5 100755 --- a/Repair/RepairCompiler/MCC/TDL.cup +++ b/Repair/RepairCompiler/MCC/TDL.cup @@ -56,13 +56,15 @@ action code {: init with {: :} parser code {: + + public String filename; public void syntax_error (java_cup.runtime.Symbol current) { CUP$TDLParser$actions.errors = true; Symbol symbol = (Symbol) current; - report_error("TDL: Syntax error at line " + (symbol.line + 1) - + ", column " + LineCount.getColumn(symbol.left) + ": " + current.value, current); + report_error(filename+":"+(symbol.line+1)+": Syntax error at column " + LineCount.getColumn(symbol.left) +": " + current.value, current); + System.exit(0); } public void report_fatal_error (String message, Object info) { diff --git a/Repair/RepairCompiler/compiler-steps.txt b/Repair/RepairCompiler/compiler-steps.txt index 8c321b4..336662f 100755 --- a/Repair/RepairCompiler/compiler-steps.txt +++ b/Repair/RepairCompiler/compiler-steps.txt @@ -1,27 +1,33 @@ -1. Copy SimpleHash.h and .c to the working directory and add - include "Simplehash.h" +Step 1: Building Compiler +------------------------- +cd RepairCompiler/MCC +make clean +make -2. Create function - void assertvalidmemory(int low, int high) { - } - -3. Create function - void calltool(Type name) - * this is equiv to establishing a mapping in the interpreter version - * Type should be the type of the variable being mapped - * the name of the formal paremater should be the name of the variable - used in the specs - * multiple parameters for multiple mappings - * the body of the function should contain only - #include "spec-file.cc", - where the files spec-file.* contain the specs -4. Declare global variables in specs.struct +Step 2: Run Compiler +-------------------- +Example: +For the specifs in ex.constraints, ex.struct, ex.space, ex.abstract, ex.model +in directory Repair/Ex: -5. In RepairCompiler/MCC, generate the .cc file: - java -cp ../ MCC.Compiler spec-file, - where spec-file.* contain the specs +A) cd Ex +B) java -classpath MCC.Compiler ex -6. Compile the program under analysis - g++ program.c SimpleHash.cc libchecker.a -o program - \ No newline at end of file +which builds: + ex.cc + ex_aux.h + ex_aux.cc + size.h + size.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 diff --git a/Repair/RepairCompiler/java_cup/runtime/lr_parser.class b/Repair/RepairCompiler/java_cup/runtime/lr_parser.class index 13347a8..f7b0ffa 100755 Binary files a/Repair/RepairCompiler/java_cup/runtime/lr_parser.class and b/Repair/RepairCompiler/java_cup/runtime/lr_parser.class differ diff --git a/Repair/RepairCompiler/java_cup/runtime/lr_parser.java b/Repair/RepairCompiler/java_cup/runtime/lr_parser.java index 3c8335c..0687120 100755 --- a/Repair/RepairCompiler/java_cup/runtime/lr_parser.java +++ b/Repair/RepairCompiler/java_cup/runtime/lr_parser.java @@ -377,8 +377,8 @@ public abstract class lr_parser { System.err.print(message); if (info instanceof Symbol) if (((Symbol)info).left != -1) - System.err.println(" at character " + ((Symbol)info).left + - " of input"); + //System.err.println(" at character " + ((Symbol)info).left + " of input"); + System.err.println(" not expected here."); else System.err.println(""); else System.err.println(""); } diff --git a/Repair/RepairCompiler/java_cup/runtime/virtual_parse_stack.class b/Repair/RepairCompiler/java_cup/runtime/virtual_parse_stack.class index a9c1b2a..987c6ac 100755 Binary files a/Repair/RepairCompiler/java_cup/runtime/virtual_parse_stack.class and b/Repair/RepairCompiler/java_cup/runtime/virtual_parse_stack.class differ