From: bdemsky Date: Wed, 18 Jul 2007 22:55:23 +0000 (+0000) Subject: beginning of changes for DSM transaction work X-Git-Tag: preEdgeChange~520 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6b08d594a39688253c997cb057ab655c777124e9;p=IRC.git beginning of changes for DSM transaction work --- diff --git a/Robust/src/Lex/Keyword.java b/Robust/src/Lex/Keyword.java index 44abd85c..08fb391b 100644 --- a/Robust/src/Lex/Keyword.java +++ b/Robust/src/Lex/Keyword.java @@ -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)); } } diff --git a/Robust/src/Lex/Lexer.java b/Robust/src/Lex/Lexer.java index 3cd7ecb1..9938d0b7 100644 --- a/Robust/src/Lex/Lexer.java +++ b/Robust/src/Lex/Lexer.java @@ -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 diff --git a/Robust/src/Parse/java14.cup b/Robust/src/Parse/java14.cup index c3f1feb2..f98ec7fb 100644 --- a/Robust/src/Parse/java14.cup +++ b/Robust/src/Parse/java14.cup @@ -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");