beginning of changes for DSM transaction work
authorbdemsky <bdemsky>
Wed, 18 Jul 2007 22:55:23 +0000 (22:55 +0000)
committerbdemsky <bdemsky>
Wed, 18 Jul 2007 22:55:23 +0000 (22:55 +0000)
Robust/src/Lex/Keyword.java
Robust/src/Lex/Lexer.java
Robust/src/Parse/java14.cup

index 44abd85c55474b34ddc6d7ecd790366d09858564..08fb391b31b94bd2df570a694f120c2bf2e82bbf 100644 (file)
@@ -71,5 +71,9 @@ class Keyword extends Token {
     key_table.put("tag", new Integer(Sym.TAG));
     key_table.put("task", new Integer(Sym.TASK));
     key_table.put("taskexit", new Integer(Sym.TASKEXIT));
+    //Keywords for transactions
+    key_table.put("atomic", new Integer(Sym.ATOMIC));
+    key_table.put("local", new Integer(Sym.LOCAL));
+    key_table.put("global", new Integer(Sym.GLOBAL));
   }
 }
index 3cd7ecb1d6d276935ee1d4defa24c312a04669b6..9938d0b7753b315a70b4e1332a1523dc4794ab07 100644 (file)
@@ -244,12 +244,12 @@ public class Lexer {
   }
 
   static final String[] keywords = new String[] {
-    "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char",
+    "abstract", "assert", "atomic", "boolean", "break", "byte", "case", "catch", "char",
     "class", "const", "continue", "default", "do", "double", "else", "enum",
     "extends", "external", "final", "finally", 
     "flag", //keyword for failure aware computation
-    "float", "for", "goto", "if", 
-    "implements", "import", "instanceof", "int", "interface", "long",  
+    "float", "for", "global", "goto", "if", 
+    "implements", "import", "instanceof", "int", "interface", "local", "long",  
     "native", "new", "optional", "package", "private", "protected", "public", 
     "return", "short", "static", "strictfp", "super", "switch", "synchronized",
     "tag", "task", "taskexit", //keywords for failure aware computation
index c3f1feb250f0cfc0390b562a3c90115b7108961a..f98ec7fb96bd35053323283d0889697c73262eb3 100644 (file)
@@ -252,6 +252,13 @@ non terminal ParseNode tag_list;
 non terminal ParseNode tag_list_opt;
 non terminal ParseNode tag_change;
 
+//distributed transaction keywords
+terminal ATOMIC;
+terminal LOCAL;
+terminal GLOBAL;
+non terminal ParseNode atomic_statement;
+
+
 start with goal;
 
 
@@ -695,7 +702,8 @@ modifier ::=
 //     ABSTRACT |
        FINAL {: RESULT=new ParseNode("final"); :}|
        NATIVE {: RESULT=new ParseNode("native"); :} |
-       SYNCHRONIZED {: RESULT=new ParseNode("synchronized"); :}
+       SYNCHRONIZED {: RESULT=new ParseNode("synchronized"); :} |
+       ATOMIC {: RESULT=new ParseNode("atomic"); :}
 //     TRANSIENT | 
 //     VOLATILE |
 //     STRICTFP // note that semantic analysis must check that the
@@ -810,6 +818,14 @@ field_declaration ::=
                pn.addChild("type").addChild(type);
                pn.addChild("variables").addChild(var);
                RESULT=pn;
+       :} |
+               modifiers_opt:mo GLOBAL type:type variable_declarators:var SEMICOLON {: 
+               ParseNode pn=new ParseNode("field_declaration");
+               pn.addChild("modifier").addChild(mo);
+               pn.addChild("type").addChild(type);
+               pn.addChild("variables").addChild(var);
+               pn.addChild("global");
+               RESULT=pn;
        :}
        ;
 
@@ -1110,6 +1126,7 @@ statement_without_trailing_substatement ::=
        |       continue_statement:st {: RESULT=st; :}
        |       return_statement:st {: RESULT=st; :}
        |       task_exitstatement:st {: RESULT=st; :}
+       |       atomic_statement:st {: RESULT=st; :}
 //     |       synchronized_statement
 //     |       throw_statement
 //     |       try_statement
@@ -1287,6 +1304,11 @@ return_statement ::=
 //synchronized_statement ::=
 //             SYNCHRONIZED LPAREN expression RPAREN block
 //     ;
+atomic_statement ::=
+               ATOMIC LPAREN expression:exp RPAREN block {: 
+       RESULT=(new ParseNode("atomic")).addChild(exp).getRoot();
+       :}
+       ;
 //try_statement ::=
 //             TRY block catches
 //     |       TRY block catches_opt finally
@@ -1338,6 +1360,14 @@ class_instance_creation_expression ::=
                pn.addChild(args);
                pn.addChild(feo);
                RESULT=pn;
+       :} 
+       //Global object
+       | LOCAL NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {: 
+               ParseNode pn=new ParseNode("createobject");
+               pn.addChild(type);
+               pn.addChild(args);
+               pn.addChild(feo);
+               RESULT=pn;
        :}
        | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE RBRACE LBRACE tag_list:tl RBRACE {: 
                ParseNode pn=new ParseNode("createobject");