Grammar changes made today:
authorcristic <cristic>
Fri, 23 Apr 2004 20:22:14 +0000 (20:22 +0000)
committercristic <cristic>
Fri, 23 Apr 2004 20:22:14 +0000 (20:22 +0000)
  G1. Got rid of literal(keyword) thing.  Now we can simply use the keywords true, false, etc.
  G2. Added keywords NULL=null=0
  G3. != works

Repair/RepairCompiler/MCC/CDL.cup
Repair/RepairCompiler/MCC/Lexer.lex
Repair/RepairCompiler/MCC/MDL.cup
Repair/RepairCompiler/compiler-steps.txt

index 76f769d58151caa7c956d27eb1982cf54b916a06..45c0e3fd25dfe539a47b1c36f3784886f31a5831 100755 (executable)
@@ -472,7 +472,7 @@ expr ::=
        RESULT = expr;
        :}     
        
-       | LITERAL OPENPAREN literal:literal CLOSEPAREN
+       | literal:literal
        {:
        debugMessage(PRODSTRING);
        ParseNode expr = new ParseNode("expr", parser.curLine(4));
@@ -596,6 +596,12 @@ literal ::=
        debugMessage(PRODSTRING);
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("boolean").addChild("false").getRoot();
        :}
+
+       | NULL
+       {:
+       debugMessage(PRODSTRING);
+       RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("decimal").addChild("0").getRoot();
+       :}
         
        | DECIMAL:dec
        {:
@@ -615,7 +621,7 @@ literal ::=
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("char").addChild(chr).getRoot();
        :}
         
-       | ID:literal
+       | LITERAL OPENPAREN ID:literal CLOSEPAREN
        {:
        debugMessage(PRODSTRING);
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("token").addChild(literal).getRoot();
index b1a20f9f0682a8a85422eabf7b28663ead93382d..6e630c00fc2e3597f08829bd92d2975897b156fb 100755 (executable)
@@ -100,6 +100,7 @@ CHAR=(\\\"|\\\'|\\\\|\\t|\\n|[\x20-\x21\x23-\x26\x28-\x5B\x5D-\x7E])
 <YYINITIAL> cast                       { return tok(Sym.CAST, yytext()); }
 <YYINITIAL> short                      { return tok(Sym.SHORT, yytext()); }
 <YYINITIAL> null                       { return tok(Sym.NULL, yytext()); }
+<YYINITIAL> NULL                       { return tok(Sym.NULL, yytext()); }
 <YYINITIAL> crash                      { return tok(Sym.CRASH, yytext()); }
 
 <YYINITIAL> {ALPHA}({ALPHA}|{DIGIT})*  { return tok(Sym.ID, yytext()); }
index efd49425a8caba6817f45243149a42306158cf8e..4d2e02a8e2976ce64b8901340d06254ab33ec5bf 100755 (executable)
@@ -468,13 +468,14 @@ expr ::=
        RESULT = expr;
        :}     
     
-       | LITERAL OPENPAREN literal:literal CLOSEPAREN       
+       |  literal:literal
        {:
        debugMessage(PRODSTRING);
        ParseNode expr = new ParseNode("expr", parser.curLine(4));
        expr.addChild(literal);
        RESULT = expr;
        :}
+
                
        | expr:leftexpr LT expr:rightexpr 
        {:
@@ -638,6 +639,12 @@ literal ::=
        debugMessage(PRODSTRING);
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("boolean").addChild("false").getRoot();
        :}
+
+       | NULL
+       {:
+       debugMessage(PRODSTRING);
+       RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("decimal").addChild("0").getRoot();
+       :}
        
        | DECIMAL:dec
        {:
@@ -657,7 +664,7 @@ literal ::=
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("char").addChild(chr).getRoot();
        :}
         
-       | ID:literal
+       | LITERAL OPENPAREN ID:literal CLOSEPAREN 
        {:
        debugMessage(PRODSTRING);
        RESULT = (new ParseNode("literal", parser.curLine(1))).addChild("token").addChild(literal).getRoot();
index f1b11731a16d09c4f5843b7c240183c46c96a965..7cb3689fc29b3548a71b7cf29953d52740505832 100755 (executable)
@@ -29,11 +29,26 @@ 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 
+C) remove old object files 
    cd Runtime; rm *.o
-C) ./buildruntime
-D) build checking object: 
+D) ./buildruntime
+E) build checking object: 
    g++ -g -c ex_aux.cc
-E) If ex_test.c is the application under testing, run:
+
+
+Step 4: Check the application
+-----------------------------
+
+If ex_test.c is the application under testing, then:
+
+A) in ex_test.c, add:
+   #include "ex_aux.h" 
+   #include "memory.h"
+B) at the beginning of the main method, add:
+   initializemmap();
+C) wherever you want to check the consistency constraints, add:
+   #include "ex.cc"
+D) compile the application:
    g++ -g ex_test.cc *.o -o ex_test
-F) ./ex_test
+E) run the application: 
+   ./ex_test