// 19.8.5) Constructor Declarations
non terminal ParseNode constructor_declaration, constructor_declarator;
non terminal ParseNode constructor_body;
-//non terminal ParseNode explicit_constructor_invocation;
+non terminal ParseNode explicit_constructor_invocation;
// 19.9.1) Interface Declarations
//non terminal ParseNode interface_declaration;
//non terminal ParseNode extends_interfaces_opt, extends_interfaces;
//failure aware computation keywords
terminal FLAG;
terminal OPTIONAL;
+terminal ISAVAILABLE;
terminal EXTERNAL;
terminal TAG;
terminal TASK;
//distributed transaction keywords
terminal ATOMIC;
-terminal LOCAL;
terminal GLOBAL;
+terminal GETOFFSET;
non terminal ParseNode atomic_statement;
+non terminal ParseNode getoffset_expression;
+
+//disjointness for Java
+terminal DISJOINT;
+
+//coarse-grain parallelization
+terminal SESE;
+non terminal ParseNode sese_statement;
start with goal;
| BOOLEAN_LITERAL:boolean_lit
{:
ParseNode pn=new ParseNode("literal");
- pn.addChild("boolean").setLiteral(boolean_lit);
+ pn.addChild("boole\1aan").setLiteral(boolean_lit);
RESULT=pn;
:}
| CHARACTER_LITERAL:char_lit
pn.addChild(cd);
pn.addChild("body").addChild(body);
RESULT=pn;
+ :} |
+ modifiers_opt:mo GLOBAL constructor_declarator:cd
+//throws_opt
+ constructor_body:body {:
+ ParseNode pn=new ParseNode("constructor_declaration");
+ pn.addChild("global");
+ pn.addChild("modifiers").addChild(mo);
+ pn.addChild(cd);
+ pn.addChild("body").addChild(body);
+ RESULT=pn;
:}
;
constructor_declarator ::=
:}
;
constructor_body ::=
-// LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE |
-// LBRACE explicit_constructor_invocation RBRACE |
+ LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE {:
+ ParseNode pn=new ParseNode("constructor_body");
+ pn.addChild(eci);
+ pn.addChild(bs);
+ RESULT=pn;
+ :} |
+ LBRACE explicit_constructor_invocation:eci RBRACE {:
+ ParseNode pn=new ParseNode("constructor_body");
+ pn.addChild(eci);
+ RESULT=pn;
+ :} |
LBRACE block_statements:block RBRACE {:
ParseNode pn=new ParseNode("constructor_body");
pn.addChild(block);
:}
| LBRACE RBRACE {: RESULT=new ParseNode("empty"); :}
;
-//explicit_constructor_invocation ::=
+explicit_constructor_invocation ::=
// THIS LPAREN argument_list_opt RPAREN SEMICOLON
-// | SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+// |
+SUPER LPAREN argument_list_opt:alo RPAREN SEMICOLON {:
+ ParseNode pn=new ParseNode("superinvoke");
+ pn.addChild(alo);
+ RESULT=pn;
+:}
// | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
// | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
-// ;
+ ;
// 19.9) Interfaces
| return_statement:st {: RESULT=st; :}
| task_exitstatement:st {: RESULT=st; :}
| atomic_statement:st {: RESULT=st; :}
+ | sese_statement:st {: RESULT=st; :}
// | synchronized_statement
// | throw_statement
// | try_statement
// SYNCHRONIZED LPAREN expression RPAREN block
// ;
atomic_statement ::=
- ATOMIC LPAREN expression:exp RPAREN block {:
- RESULT=(new ParseNode("atomic")).addChild(exp).getRoot();
+ ATOMIC block:blk {:
+ RESULT=(new ParseNode("atomic")).addChild(blk).getRoot();
+ :}
+ ;
+sese_statement ::=
+
+// SESE variable_declarator_id:id LBRACE statement:st RBRACE {:
+
+ SESE block:blk {:
+ ParseNode pn = new ParseNode("sese");
+
+// pn.addChild("identifier").addChild(id);
+
+ pn.addChild("body").addChild(blk);
+ RESULT=pn;
:}
;
//try_statement ::=
| field_access:exp {: RESULT=exp; :}
| method_invocation:exp {: RESULT=exp; :}
| array_access:exp {: RESULT=exp; :}
+ | ISAVAILABLE LPAREN IDENTIFIER:id RPAREN {:
+ ParseNode pn=new ParseNode("isavailable");
+ pn.addChild(id);
+ RESULT=pn;
+ :}
// | primitive_type DOT CLASS
// | VOID DOT CLASS
// | array_type DOT CLASS
RESULT=pn;
:}
//Global object
- | LOCAL NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {:
+ | GLOBAL 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);
+ pn.addChild("global");
+ RESULT=pn;
+ :}
+ // Objects we want to track in disjointness analysis
+ | DISJOINT IDENTIFIER:id 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);
+ pn.addChild("disjoint").addChild(id);
RESULT=pn;
:}
| NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE RBRACE LBRACE tag_list:tl RBRACE {:
pn.addChild("dims_opt").setLiteral(dims);
RESULT=pn;
:}
+ | GLOBAL NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("global");
+ RESULT=pn;
+ :}
+ | DISJOINT IDENTIFIER:id NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("disjoint").addChild(id);
+ RESULT=pn;
+ :}
+ | GLOBAL NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("global");
+ RESULT=pn;
+ :}
+ | DISJOINT IDENTIFIER:id NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {:
+ ParseNode pn=new ParseNode("createarray");
+ pn.addChild(type);
+ pn.addChild(dimexpr);
+ pn.addChild("dims_opt").setLiteral(dims);
+ pn.addChild("disjoint").addChild(id);
+ RESULT=pn;
+ :}
;
//array_creation_init ::=
// NEW primitive_type dims array_initializer
pn.addChild(args);
RESULT=pn;
:}
-// | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
+ | SUPER DOT IDENTIFIER:id LPAREN argument_list_opt:args RPAREN {:
+ ParseNode name=new ParseNode("name");
+ name.addChild("base").addChild("name").addChild("identifier").addChild("super");
+ name.addChild("identifier").addChild(id);
+ ParseNode pn=new ParseNode("methodinvoke1");
+ pn.addChild(name);
+ pn.addChild(args);
+ RESULT=pn;
+ :}
// | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
;
array_access ::=
// RESULT=pn;
// :}
;
+
postfix_expression ::=
primary:exp {:
RESULT=exp; :}
unary_expression_not_plus_minus ::=
postfix_expression:exp {:
RESULT=exp; :}
-// | COMP unary_expression
+ | COMP unary_expression:exp
+ {: RESULT=(new ParseNode("comp")).addChild(exp).getRoot(); :}
| NOT unary_expression:exp
{: RESULT=(new ParseNode("not")).addChild(exp).getRoot(); :}
| cast_expression:exp {: RESULT=exp; :}
pn.addChild(exp2);
RESULT=pn;
:}
-// | shift_expression URSHIFT additive_expression
+ | shift_expression:exp1 URSHIFT additive_expression:exp2 {:
+ ParseNode pn=new ParseNode("urightshift");
+ pn.addChild(exp1);
+ pn.addChild(exp2);
+ RESULT=pn;
+ :}
;
relational_expression ::=
shift_expression:exp {:
conditional_expression ::=
conditional_or_expression:condor {:
RESULT=condor; :}
-// | conditional_or_expression QUESTION expression
-// COLON conditional_expression
- ;
+ | conditional_or_expression:condor QUESTION expression:exptrue
+ COLON conditional_expression:expfalse {:
+ ParseNode pn=new ParseNode("tert");
+ pn.addChild("cond").addChild(condor);
+ pn.addChild("trueexpr").addChild(exptrue);
+ pn.addChild("falseexpr").addChild(expfalse);
+ RESULT=pn;
+ :}
+ ;
+getoffset_expression ::=
+ GETOFFSET LBRACE class_or_interface_type:type COMMA IDENTIFIER:id RBRACE {:
+ ParseNode pn = new ParseNode("getoffset");
+ pn.addChild(type);
+ pn.addChild("field").addChild(id);
+ RESULT = pn;
+ :}
+ ;
+
assignment_expression ::=
conditional_expression:expr {:
RESULT=expr; :} |
assignment:assign {:
- RESULT=assign; :}
+ RESULT=assign; :} |
+ getoffset_expression:expr {:
+ RESULT=expr; :}
;
// semantic check necessary here to ensure a valid left-hand side.
// allowing a parenthesized variable here on the lhs was introduced in
| MINUSEQ {: RESULT=new ParseNode("minuseq"); :}
| LSHIFTEQ {: RESULT=new ParseNode("lshifteq"); :}
| RSHIFTEQ {: RESULT=new ParseNode("rshifteq"); :}
-// | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :}
+ | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :}
| ANDEQ {: RESULT=new ParseNode("andeq"); :}
| XOREQ {: RESULT=new ParseNode("xoreq"); :}
| OREQ {: RESULT=new ParseNode("oreq"); :}