Add support for Enum type for mgc version and also add default constructor. Comment...
[IRC.git] / Robust / src / Parse / java14.cup
index 1d296fae5b6af7042598862b249ef4fa37d35776..2fd93f3f51d686020e65e2a1d416bb5eb048aedb 100644 (file)
@@ -52,11 +52,11 @@ terminal STATIC; // modifier
 terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE;
 terminal CLASS; // class_declaration
 terminal EXTENDS; // super
-//terminal IMPLEMENTS; // interfaces
+terminal IMPLEMENTS; // interfaces
 terminal VOID; // method_header
 terminal THROWS; // throws
 terminal THIS, SUPER; // explicit_constructor_invocation
-//terminal INTERFACE; // interface_declaration
+terminal INTERFACE; // interface_declaration
 terminal IF, ELSE; // if_then_statement, if_then_else_statement
 terminal SWITCH; // switch_statement
 terminal CASE, DEFAULT; // switch_label
@@ -103,6 +103,9 @@ terminal ASSERT; // assert_statement
 terminal ELLIPSIS;
 terminal ENUM;
 
+// added for disjoint reachability analysis
+terminal GENREACH;
+
 
 // 19.2) The Syntactic Grammar
 non terminal ParseNode goal;
@@ -114,24 +117,24 @@ non terminal ParseNode integral_type, floating_point_type;
 non terminal ParseNode reference_type;
 non terminal ParseNode class_or_interface_type;
 non terminal ParseNode class_type;
-//non terminal ParseNode interface_type;
+non terminal ParseNode interface_type;
 non terminal ParseNode array_type;
 // 19.5) Names
 non terminal ParseNode name, simple_name, qualified_name;
 // 19.6) Packages
 non terminal ParseNode compilation_unit;
-//non terminal ParseNode package_declaration_opt, package_declaration;
-//non terminal ParseNode import_declarations_opt, import_declarations;
+non terminal ParseNode package_declaration_opt, package_declaration;
+non terminal ParseNode import_declarations_opt, import_declarations;
 non terminal ParseNode type_declarations_opt, type_declarations;
-//non terminal ParseNode import_declaration;
-//non terminal ParseNode single_type_import_declaration;
-//non terminal ParseNode type_import_on_demand_declaration;
+non terminal ParseNode import_declaration;
+non terminal ParseNode single_type_import_declaration;
+non terminal ParseNode type_import_on_demand_declaration;
 non terminal ParseNode type_declaration;
 // 19.7) Productions used only in the LALR(1) grammar
 non terminal ParseNode modifiers_opt, modifiers, modifier;
 // 19.8.1) Class Declaration
 non terminal ParseNode class_declaration, super, super_opt;
-//non terminal interfaces, interfaces_opt, interface_type_list;
+non terminal ParseNode interfaces, interfaces_opt, interface_type_list;
 non terminal ParseNode class_body;
 non terminal ParseNode class_body_declarations, class_body_declarations_opt;
 non terminal ParseNode class_body_declaration, class_member_declaration;
@@ -148,21 +151,21 @@ non terminal ParseNode formal_parameter;
 //non terminal ParseNode class_type_list;
 non terminal ParseNode method_body;
 // 19.8.4) Static Initializers
-//non terminal ParseNode static_initializer;
+non terminal ParseNode static_initializer;
 // 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;
-//non terminal ParseNode interface_body;
-//non terminal ParseNode interface_member_declarations_opt, interface_member_declarations;
-//non terminal ParseNode interface_member_declaration, constant_declaration;
-//non terminal ParseNode abstract_method_declaration;
+non terminal ParseNode interface_declaration;
+non terminal ParseNode extends_interfaces_opt, extends_interfaces;
+non terminal ParseNode interface_body;
+non terminal ParseNode interface_member_declarations_opt, interface_member_declarations;
+non terminal ParseNode interface_member_declaration, constant_declaration;
+non terminal ParseNode abstract_method_declaration;
 // 19.10) Arrays
-//non terminal ParseNode array_initializer;
-//non terminal ParseNode variable_initializers;
+non terminal ParseNode array_initializer;
+non terminal ParseNode variable_initializers;
 // 19.11) Blocks and Statements
 non terminal ParseNode block;
 non terminal ParseNode block_statements_opt, block_statements, block_statement;
@@ -174,10 +177,10 @@ non terminal ParseNode empty_statement;
 non terminal ParseNode expression_statement, statement_expression;
 non terminal ParseNode if_then_statement;
 non terminal ParseNode if_then_else_statement, if_then_else_statement_no_short_if;
-//non terminal ParseNode switch_statement, switch_block;
-//non terminal ParseNode switch_block_statement_groups;
-//non terminal ParseNode switch_block_statement_group;
-//non terminal ParseNode switch_labels, switch_label;
+non terminal ParseNode switch_statement, switch_block;
+non terminal ParseNode switch_block_statement_groups;
+non terminal ParseNode switch_block_statement_group;
+non terminal ParseNode switch_labels, switch_label;
 non terminal ParseNode while_statement, while_statement_no_short_if;
 non terminal ParseNode do_statement;
 non terminal ParseNode for_statement, for_statement_no_short_if;
@@ -188,14 +191,17 @@ non terminal ParseNode statement_expression_list;
 non terminal ParseNode break_statement, continue_statement;
 non terminal ParseNode return_statement;
 //non terminal ParseNode throw_statement;
-//non terminal ParseNode synchronized_statement, try_statement;
+non terminal ParseNode synchronized_statement;
+//non terminal ParseNode try_statement;
 //non terminal ParseNode catches_opt;
 //non terminal ParseNode catches, catch_clause;
 //non terminal ParseNode finally;
 //non terminal ParseNode assert_statement;
+non terminal ParseNode genreach_statement;
 // 19.12) Expressions
 non terminal ParseNode primary, primary_no_new_array;
 non terminal ParseNode class_instance_creation_expression;
+non terminal ParseNode cons_argument_list_opt, cons_argument_list;
 non terminal ParseNode argument_list_opt, argument_list;
 //non terminal ParseNode array_creation_init;
 non terminal ParseNode array_creation_uninit;
@@ -217,9 +223,12 @@ non terminal ParseNode assignment_expression;
 non terminal ParseNode assignment;
 non terminal ParseNode assignment_operator;
 non terminal ParseNode expression_opt, expression;
-//non terminal ParseNode constant_expression;
+non terminal ParseNode constant_expression;
 //failure aware computation keywords
 terminal FLAG;
+terminal OPTIONAL;
+terminal ISAVAILABLE;
+terminal EXTERNAL;
 terminal TAG;
 terminal TASK;
 terminal TASKEXIT;
@@ -235,8 +244,43 @@ non terminal ParseNode flag_effects_opt;
 non terminal ParseNode flag_effects;
 non terminal ParseNode flag_effect;
 non terminal ParseNode flag_list;
+non terminal ParseNode flag_list_opt;
 non terminal ParseNode flag_change;
 
+non terminal ParseNode cons_checks_opt;
+non terminal ParseNode cons_checks;
+non terminal ParseNode cons_check;
+
+non terminal ParseNode tag_variable_declaration_statement;
+non terminal ParseNode tag_expression_list;
+non terminal ParseNode tag_expression;
+non terminal ParseNode tag_list;
+non terminal ParseNode tag_list_opt;
+non terminal ParseNode tag_change;
+
+//distributed transaction keywords
+terminal ATOMIC;
+terminal GLOBAL;
+terminal SCRATCH;
+terminal GETOFFSET;
+non terminal ParseNode atomic_statement;
+non terminal ParseNode getoffset_expression;
+
+//disjointness for Java
+terminal DISJOINT;
+
+//coarse-grain parallelization
+terminal SESE;
+terminal RBLOCK;
+non terminal ParseNode sese_statement;
+
+// mgc
+// JSR-201) Enum Declaration
+non terminal ParseNode enum_declaration;
+non terminal ParseNode enum_body, enum_constants_opt, enum_constants, enum_constant;
+//non terminal ParseNode enum_arguments_opt, enum_body_declarations_opt;
+
+
 start with goal;
 
 
@@ -271,11 +315,73 @@ task_parameter ::=
                ParseNode pn=new ParseNode("task_parameter");
                pn.addChild(type);
                pn.addChild(name);
-               pn.addChild(exp);
+               pn.addChild("flag").addChild(exp);
+               RESULT=pn;
+       :} 
+        | type:type variable_declarator_id:name LBRACE flag_expression:exp RBRACE LBRACE tag_expression_list:texp RBRACE {:
+               ParseNode pn=new ParseNode("task_parameter");
+               pn.addChild(type);
+               pn.addChild(name);
+               pn.addChild("flag").addChild(exp);
+               pn.addChild("tag").addChild(texp);
+               RESULT=pn;
+       :}
+        | type:type variable_declarator_id:name LBRACE RBRACE LBRACE tag_expression_list:texp RBRACE {:
+               ParseNode pn=new ParseNode("task_parameter");
+               pn.addChild(type);
+               pn.addChild(name);
+               pn.addChild("tag").addChild(texp);
+               RESULT=pn;
+       :}
+       | OPTIONAL task_parameter:fp {:
+               ParseNode pn=new ParseNode("task_parameter");
+               pn.addChild("optional").addChild(fp);
+               RESULT=pn;
+       :}              
+       
+       ;
+
+tag_expression_list ::= tag_expression:te {: 
+       ParseNode pn=new ParseNode("tag_expression_list");
+       pn.addChild(te);
+       RESULT=pn;
+       :}
+       | tag_expression_list:tel COMMA tag_expression:te {: 
+       tel.addChild(te);
+       RESULT=tel;
+       :}
+       ;
+
+tag_expression ::= IDENTIFIER:type IDENTIFIER:id {: 
+               ParseNode pn=new ParseNode("tag_expression");
+               pn.addChild("type").addChild(type);
+               pn.addChild("single").addChild(id);
                RESULT=pn;
        :}
        ;
 
+tag_list_opt ::= LBRACE tag_list:fl RBRACE {:RESULT=fl;:}
+       | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :}  
+       | {: RESULT = new ParseNode("empty"); :}
+       ;
+
+tag_list ::= tag_change:fc {: 
+               ParseNode pn=new ParseNode("tag_list");
+               pn.addChild(fc);
+               RESULT=pn;
+       :}
+       | tag_list:fl COMMA tag_change:fc {: 
+               fl.addChild(fc);
+               RESULT=fl;
+       :};
+
+tag_change ::= IDENTIFIER:id {: 
+               RESULT=new ParseNode("name").addChild(id).getRoot();
+       :}
+       | NOT IDENTIFIER:id {: 
+               RESULT=new ParseNode("not").addChild("name").addChild(id).getRoot();
+       :};
+
 flag_expression ::= 
        flag_andexpression:exp {: 
                RESULT=exp;
@@ -314,12 +420,33 @@ flag_notexpression ::=
        :}
        ;
 
-task_exitstatement ::= TASKEXIT flag_effects_opt SEMICOLON{: 
-               RESULT=new ParseNode("taskexit");
+task_exitstatement ::= TASKEXIT flag_effects_opt:opt cons_checks_opt:cco SEMICOLON {: 
+               RESULT=(new ParseNode("taskexit")).addChild(opt).getRoot().addChild(cco).getRoot();
+       :};
+
+cons_checks_opt ::= ASSERT LPAREN cons_checks:cc RPAREN {: RESULT=cc; :}
+       | {: RESULT = new ParseNode("empty"); :}
+       ;
+
+cons_checks ::= cons_check:cc {: 
+               ParseNode pn=new ParseNode("cons_checks");
+               pn.addChild(cc);
+               RESULT=pn;
+       :}
+       |       cons_checks:ccs COMMA cons_check:cc {: 
+               ccs.addChild(cc);
+               RESULT=ccs;
+       :};
+
+cons_check ::= IDENTIFIER:name LPAREN cons_argument_list_opt:args RPAREN {: 
+               ParseNode pn=new ParseNode("cons_check");
+               pn.addChild("name").addChild("identifier").addChild(name);
+               pn.addChild(args);
+               RESULT=pn;
        :};
 
 flag_effects_opt ::= LPAREN flag_effects:fe RPAREN {:RESULT=fe;:}
-       | {: RESULT = null; :}
+       | {: RESULT = new ParseNode("empty"); :}
        ;
 
 flag_effects ::= flag_effect:fe {: 
@@ -332,12 +459,26 @@ flag_effects ::= flag_effect:fe {:
                RESULT=fes;
        :};
 
-flag_effect ::= IDENTIFIER:id LBRACE flag_list:fl RBRACE {: 
+flag_effect ::= IDENTIFIER:id LBRACE flag_list:fl RBRACE tag_list_opt:tlo {: 
                ParseNode pn=new ParseNode("flag_effect");
+               pn.addChild("name").addChild(id);
                pn.addChild(fl);
+               pn.addChild(tlo);
+               RESULT=pn;
+       :}
+       | IDENTIFIER:id LBRACE RBRACE LBRACE tag_list:tl RBRACE {: 
+               ParseNode pn=new ParseNode("flag_effect");
+               pn.addChild("name").addChild(id);
+               pn.addChild(tl);
                RESULT=pn;
        :};
 
+flag_list_opt ::= LBRACE flag_list:fl RBRACE {:RESULT=fl;:}
+       | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :}  
+       | 
+       {: RESULT = new ParseNode("empty"); :}
+       ;
+
 flag_list ::= flag_change:fc {: 
                ParseNode pn=new ParseNode("flag_list");
                pn.addChild(fc);
@@ -434,19 +575,19 @@ class_or_interface_type ::= name:name {:
        :};
 
 class_type ::= class_or_interface_type:type {: RESULT=type; :};
-//interface_type ::= class_or_interface_type;
+interface_type ::= class_or_interface_type:type {: RESULT=type; :};
 
 array_type ::= primitive_type:prim dims:dims {: 
                ParseNode pn=(new ParseNode("type")).addChild("array");
                pn.addChild("basetype").addChild(prim);
                pn.addChild("dims").setLiteral(dims);
-               RESULT=pn;
+               RESULT=pn.getRoot();
        :}
        |       name:name dims:dims {: 
                ParseNode pn=(new ParseNode("type")).addChild("array");
                pn.addChild("basetype").addChild("type").addChild("class").addChild(name);
                pn.addChild("dims").setLiteral(dims);
-               RESULT=pn;
+               RESULT=pn.getRoot();
        :}
        ;
 
@@ -468,26 +609,44 @@ qualified_name ::= name:name DOT IDENTIFIER:id {:
 
 // 19.6) Packages
 compilation_unit ::=
-//              package_declaration_opt
-//              import_declarations_opt
+                package_declaration_opt:pdo
+                import_declarations_opt:ido
                type_declarations_opt:tdo {: 
                ParseNode pn=new ParseNode("compilation_unit");
                pn.addChild(tdo);
+               pn.addChild("packages").addChild(pdo);
+               pn.addChild("imports").addChild(ido);
                RESULT=pn;
                :}
                ;
-//package_declaration_opt ::= package_declaration | ;
-//import_declarations_opt ::= import_declarations | ;
+package_declaration_opt ::= package_declaration:pdo {:
+               RESULT=pdo;
+       :} |
+       {: RESULT=new ParseNode("empty"); :}
+;
+
+import_declarations_opt ::= import_declarations:ido {: 
+               RESULT=ido;
+       :} | 
+       {: RESULT=new ParseNode("empty"); :}
+;
 type_declarations_opt   ::= type_declarations:tds {:
                RESULT=tds;
                :}   | 
        {: RESULT=new ParseNode("empty"); :}
        ;
 
-//import_declarations ::=
-//               import_declaration
-//       |       import_declarations import_declaration
-//       ;
+import_declarations ::=
+               import_declaration:id {: 
+               ParseNode pn=new ParseNode("import_decls_list");
+               pn.addChild(id);
+               RESULT=pn;
+       :}
+       |       import_declarations:ids import_declaration:id {: 
+               ids.addChild(id);
+               RESULT=ids;
+       :}
+       ;
 
 type_declarations ::= 
                type_declaration:td {:
@@ -501,30 +660,49 @@ type_declarations ::=
                :}
        ;
 
-//package_declaration ::=
-//               PACKAGE name SEMICOLON
-//       ;
-//import_declaration ::=
-//               single_type_import_declaration
-//       |       type_import_on_demand_declaration
-//       ;
-//single_type_import_declaration ::=
-//               IMPORT name SEMICOLON
-//       ;
-//type_import_on_demand_declaration ::=
-//               IMPORT name DOT MULT SEMICOLON
-//       ;
+package_declaration ::=
+               PACKAGE name:name SEMICOLON {: 
+       ParseNode pn=new ParseNode("package");
+       pn.addChild(name);
+       RESULT=pn;
+       :}
+       ;
+import_declaration ::=
+               single_type_import_declaration:sid {: RESULT=sid; :}
+       |       type_import_on_demand_declaration:iod {: RESULT=iod; :}
+       ;
+single_type_import_declaration ::=
+               IMPORT name:name SEMICOLON {: 
+       ParseNode pn=new ParseNode("import_single");
+       pn.addChild(name);
+       RESULT=pn;
+:}
+       ;
+type_import_on_demand_declaration ::=
+               IMPORT name:name DOT MULT SEMICOLON {:
+       ParseNode pn=new ParseNode("import_ondemand");
+       pn.addChild(name);
+       RESULT=pn;
+       :}       
+       ;
 
 type_declaration ::=
                class_declaration:cd 
                {:
                        RESULT=cd;
                :}
+       |       enum_declaration:ed
+           {:
+               RESULT=ed;
+           :}
        |       task_declaration:td 
                {:
                        RESULT=td;
                :}
-//      |       interface_declaration
+    |   interface_declaration:in
+        {:
+                       RESULT=in;
+               :}
        |       SEMICOLON {: RESULT=new ParseNode("empty"); :}
        ;
 
@@ -550,12 +728,14 @@ modifier ::=
        PROTECTED {: RESULT=new ParseNode("protected"); :}|
        PRIVATE {: RESULT=new ParseNode("private"); :}|
        STATIC {: RESULT=new ParseNode("static"); :} |
-//     ABSTRACT |
+       ABSTRACT {: RESULT=new ParseNode("abstract"); :}  |
        FINAL {: RESULT=new ParseNode("final"); :}|
-       NATIVE {: RESULT=new ParseNode("native"); :}
-//     SYNCHRONIZED | 
+       NATIVE {: RESULT=new ParseNode("native"); :} |
+       SYNCHRONIZED {: RESULT=new ParseNode("synchronized"); :} |
+       ATOMIC {: RESULT=new ParseNode("atomic"); :} |
+       VOLATILE {: RESULT=new ParseNode("volatile"); :}
 //     TRANSIENT | 
-//     VOLATILE |
+
 //     STRICTFP // note that semantic analysis must check that the
                         // context of the modifier allows strictfp.
        ;
@@ -564,13 +744,14 @@ modifier ::=
 
 // 19.8.1) Class Declaration:
 class_declaration ::= 
-       modifiers_opt:mo CLASS IDENTIFIER:id super_opt:so //interfaces_opt
-class_body:body 
+       modifiers_opt:mo CLASS IDENTIFIER:id super_opt:so interfaces_opt:ifo 
+       class_body:body 
        {:
        ParseNode pn=new ParseNode("class_declaration");
        pn.addChild("modifiers").addChild(mo);
        pn.addChild("name").addChild(id);
        pn.addChild("super").addChild(so);
+       pn.addChild("superIF").addChild(ifo);
        pn.addChild("classbody").addChild(body);
        RESULT=pn;
        :}
@@ -586,15 +767,23 @@ super_opt ::=
        :}
        ;
 
-//interfaces ::= IMPLEMENTS interface_type_list
-//       ;
-//interfaces_opt::=
-//       |       interfaces
-//       ;
-//interface_type_list ::=
-//               interface_type
-//       |       interface_type_list COMMA interface_type
-//       ;
+interfaces ::= IMPLEMENTS interface_type_list:iftl {: RESULT=iftl; :}
+       ;
+interfaces_opt ::=
+       {: RESULT=new ParseNode("empty"); :}
+       |       interfaces:ifs {: RESULT=ifs; :}
+       ;
+interface_type_list ::=
+               interface_type:ift {: 
+                       ParseNode pn=new ParseNode("interface_type_list");
+                       pn.addChild(ift);
+                       RESULT=pn;
+               :}
+       |       interface_type_list:iftl COMMA interface_type:ift {: 
+                       iftl.addChild(ift);
+                       RESULT=iftl;
+               :}
+       ;
 
 class_body ::= LBRACE class_body_declarations_opt:cbdo RBRACE {: RESULT=cbdo; :}
        ;
@@ -619,7 +808,9 @@ class_body_declaration ::=
                class_member_declaration:member {: 
                RESULT=(new ParseNode("member")).addChild(member).getRoot();
        :}
-//     |       static_initializer
+       |       static_initializer:block{:
+               RESULT=(new ParseNode("static_block")).addChild(block).getRoot();
+       :}
        |       constructor_declaration:constructor {: 
                RESULT=(new ParseNode("constructor")).addChild(constructor).getRoot();
        :}
@@ -640,10 +831,75 @@ class_member_declaration ::=
        RESULT=(new ParseNode("method")).addChild(method).getRoot(); 
        :}
        /* repeat the prod for 'class_declaration' here: */
-//     |       modifiers_opt CLASS IDENTIFIER super_opt class_body
-//      |       interface_declaration
+       |       modifiers_opt:mo CLASS IDENTIFIER:id super_opt:so interfaces_opt:ifo class_body:body
+       {:
+       ParseNode pn=new ParseNode("inner_class_declaration");
+       pn.addChild("modifiers").addChild(mo);
+       pn.addChild("name").addChild(id);
+       pn.addChild("super").addChild(so);
+       pn.addChild("superIF").addChild(ifo);
+       pn.addChild("classbody").addChild(body);
+       RESULT=pn;
+       :}
+       |       enum_declaration:ed
+       {:
+       RESULT=ed; 
+       :}
+//    |       interface_declaration:interfaced {: 
+//     RESULT=(new ParseNode("interface")).addChild(interfaced).getRoot(); 
+//     :}
        |       SEMICOLON       {: RESULT=new ParseNode("empty"); :}
        ;
+       
+// mgc
+// JSR-201) Enum Declaration
+enum_declaration ::=
+               modifiers_opt:mo ENUM IDENTIFIER:id /*interfaces_opt:io*/ enum_body:body
+               {:
+                       ParseNode pn=new ParseNode("enum_declaration");
+                       pn.addChild("modifiers").addChild(mo);
+                       pn.addChild("name").addChild(id);
+                       //pn.addChild("superIF").addChild(ifo);
+                       pn.addChild("enumbody").addChild(body);
+                       RESULT=pn;
+               :}
+       ;
+enum_body ::=
+               LBRACE enum_constants_opt:eco /*enum_body_declarations_opt:ebdo*/ RBRACE
+               {: RESULT=eco; :}
+       ;
+enum_constants_opt ::=
+  {: RESULT=new ParseNode("empty"); :}
+       |       enum_constants:ecs
+       {: RESULT=ecs; :}
+       ;
+enum_constants ::=
+               enum_constant:ec {: 
+               ParseNode pn=new ParseNode("enum_constants_list");
+               pn.addChild(ec);
+               RESULT=pn;
+       :}
+       |       enum_constants:ecs COMMA enum_constant:ec {:
+           ecs.addChild(ec);
+           RESULT=ecs;
+       :}
+       ;
+enum_constant ::=
+               IDENTIFIER:id /*enum_arguments_opt*/
+               {: 
+                   ParseNode pn=new ParseNode("enum_constant");
+                   pn.addChild("name").addChild(id);
+                   RESULT=pn; 
+               :}
+//     |       IDENTIFIER enum_arguments_opt class_body
+       ;
+//enum_arguments_opt ::=
+//     |       LPAREN argument_list_opt RPAREN
+//     ;
+//enum_body_declarations_opt ::=
+//     |       SEMICOLON class_body_declarations_opt:cbdo
+//     ;
+
 
 //Failure aware computation
 flag_declaration ::= 
@@ -651,6 +907,12 @@ flag_declaration ::=
                ParseNode pn=new ParseNode("flag_declaration");
                pn.addChild("name").addChild(id);
                RESULT=pn;
+       :}      |
+               EXTERNAL FLAG IDENTIFIER:id SEMICOLON {: 
+               ParseNode pn=new ParseNode("flag_declaration");
+               pn.addChild("name").addChild(id);
+               pn.addChild("external");
+               RESULT=pn;
        :}
        ;
 
@@ -662,6 +924,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;
        :}
        ;
 
@@ -697,7 +967,7 @@ variable_declarator_id ::=
        ;
 variable_initializer ::=
                expression:exp {: RESULT=exp; :}
-//     |       array_initializer
+       |       array_initializer {: RESULT=new ParseNode("array_initializer"); :}
        ;
 
 // 19.8.3) Method Declarations
@@ -760,7 +1030,18 @@ formal_parameter ::=
                pn.addChild(name);
                RESULT=pn;
        :}
-//     |       FINAL type variable_declarator_id
+       |
+               TAG variable_declarator_id:name {:
+               ParseNode pn=new ParseNode("tag_parameter");
+               pn.addChild(name);
+               RESULT=pn;
+       :}
+       |       FINAL type:type variable_declarator_id:name {:
+               ParseNode pn=new ParseNode("formal_parameter");
+               pn.addChild(type);
+               pn.addChild(name);
+               RESULT=pn;
+       :}
        ;
 //throws_opt ::=       
 //     |       throws
@@ -778,9 +1059,13 @@ method_body ::=   block:block {:
        ;
 
 // 19.8.4) Static Initializers
-//static_initializer ::=
-//             STATIC block
-//     ;
+static_initializer ::=
+               STATIC block:body {:
+               ParseNode pn=new ParseNode("static_block_declaration");
+               pn.addChild("body").addChild(body);
+               RESULT=pn;
+       :}
+       ;
 
 // 19.8.5) Constructor Declarations
 constructor_declaration ::=
@@ -792,8 +1077,19 @@ constructor_declaration ::=
                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 ::=
                simple_name:name LPAREN formal_parameter_list_opt:fplo RPAREN {: 
                ParseNode pn=new ParseNode("constructor_declarator");
@@ -803,8 +1099,17 @@ 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);
@@ -812,66 +1117,131 @@ constructor_body ::=
        :}
        |       LBRACE RBRACE {: RESULT=new ParseNode("empty"); :}
        ;
-//explicit_constructor_invocation ::=
-//             THIS LPAREN argument_list_opt RPAREN SEMICOLON
-//     |       SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+explicit_constructor_invocation ::=
+       THIS LPAREN argument_list_opt:alo RPAREN SEMICOLON {:
+            ParseNode pn=new ParseNode("explconstrinv");
+            pn.addChild(alo);
+            RESULT=pn;
+       :}
+       |       
+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
 
 // 19.9.1) Interface Declarations
-//interface_declaration ::=
-//               modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt
-//                       interface_body
-//       ;
-//extends_interfaces_opt ::=
-//       |       extends_interfaces
-//       ;
-//extends_interfaces ::=
-//               EXTENDS interface_type
-//       |       extends_interfaces COMMA interface_type
-//       ;
-//interface_body ::=
-//               LBRACE interface_member_declarations_opt RBRACE
-//       ;
-//interface_member_declarations_opt ::=
-//       |       interface_member_declarations
-//       ;
-//interface_member_declarations ::=
-//               interface_member_declaration
-//       |       interface_member_declarations interface_member_declaration
-//       ;
-//interface_member_declaration ::=
-//               constant_declaration
-//       |       abstract_method_declaration
-//       |       class_declaration
-//       |       interface_declaration
-//       |       SEMICOLON
-//       ;
-//constant_declaration ::=
-//               field_declaration
-//       // need to semantically check that modifiers of field declaration
-//       // include only PUBLIC, STATIC, or FINAL.  Other modifiers are
-//       // disallowed.
-//       ;
-//abstract_method_declaration ::=
-//               method_header SEMICOLON
-//       ;
+interface_declaration ::=
+               modifiers_opt:mo INTERFACE IDENTIFIER:id extends_interfaces_opt:io
+                       interface_body:body
+       {:
+       ParseNode pn=new ParseNode("interface_declaration");
+       pn.addChild("modifiers").addChild(mo);
+       pn.addChild("name").addChild(id);
+       pn.addChild("superIF").addChild(io);
+       pn.addChild("interfacebody").addChild(body);
+       RESULT=pn;
+       :}
+       ;
+extends_interfaces_opt ::=
+       {: RESULT=new ParseNode("empty"); :}
+       |       extends_interfaces:eifs {: RESULT=eifs; :}
+       ;
+extends_interfaces ::=
+               EXTENDS interface_type:ift 
+               {: 
+               ParseNode pn=new ParseNode("extend_interface_list");
+               pn.addChild(ift);
+               RESULT=pn; 
+               :}
+     |       extends_interfaces:eifs COMMA interface_type:ift
+             {:
+             eifs.addChild(ift);
+             RESULT=eifs;
+             :}
+       ;
+interface_body ::=
+               LBRACE interface_member_declarations_opt:imdo RBRACE
+               {: RESULT=imdo; :}
+       ;
+interface_member_declarations_opt ::=
+       {: RESULT=new ParseNode("empty"); :}
+       |       interface_member_declarations:imd {: RESULT=imd; :}
+       ;
+interface_member_declarations ::=
+               interface_member_declaration:imd {: 
+                       ParseNode pn=new ParseNode("interface_member_declaration_list");
+                       pn.addChild(imd);
+                       RESULT=pn;
+               :}
+       |       interface_member_declarations:imds interface_member_declaration:imd {: 
+                       imds.addChild(imd);
+                       RESULT=imds;
+               :}
+       ;
+interface_member_declaration ::=
+               constant_declaration:constant {: 
+               RESULT=(new ParseNode("constant")).addChild(constant).getRoot();
+       :}
+       |       abstract_method_declaration:method {:
+       RESULT=(new ParseNode("method")).addChild(method).getRoot(); 
+       :}
+          |    enum_declaration:ed {:
+          RESULT=(new ParseNode("enum_declaration")).addChild(ed).getRoot();
+          :}
+//       |       class_declaration:class 
+//       |       interface_declaration:interface 
+       |       SEMICOLON {: 
+       RESULT=new ParseNode("empty"); 
+       :}
+       ;
+constant_declaration ::=
+               field_declaration:fd {: RESULT=fd; :}
+       // need to semantically check that modifiers of field declaration
+       // include only PUBLIC, STATIC, or FINAL.  Other modifiers are
+       // disallowed.
+       ;
+abstract_method_declaration ::=
+               method_header:header SEMICOLON {:
+               ParseNode pn=new ParseNode("method_declaration");
+               pn.addChild("header").addChild(header);
+               pn.addChild("body").addChild(new ParseNode("empty"));
+               RESULT=pn;
+       :}
+       ;
 
 
 // 19.10) Arrays
-//array_initializer ::=
-//             LBRACE variable_initializers COMMA RBRACE
-//     |       LBRACE variable_initializers RBRACE
-//     |       LBRACE COMMA RBRACE
-//     |       LBRACE RBRACE
-//     ;
-//variable_initializers ::=
-//             variable_initializer
-//     |       variable_initializers COMMA variable_initializer
-//     ;
+array_initializer ::=
+               LBRACE variable_initializers:var_init_list COMMA RBRACE {:
+                      RESULT=var_init_list;
+               :}
+       |       LBRACE variable_initializers:var_init_list RBRACE {:
+                      RESULT=var_init_list;
+               :}
+       |       LBRACE COMMA RBRACE {:
+                      RESULT=new ParseNode("empty");                  
+               :}
+       |       LBRACE RBRACE {:
+                      RESULT=new ParseNode("empty");
+               :}
+       ;
+variable_initializers ::=
+               variable_initializer:var_init {:
+                      ParseNode pn=new ParseNode("var_init_list");
+                      pn.addChild(var_init);
+                      RESULT=pn;
+               :}
+       |       variable_initializers:var_init_list COMMA variable_initializer:var_init {:
+                      var_init_list.addChild(var_init);
+                      RESULT=var_init_list;
+               :}
+       ;
 
 // 19.11) Blocks and Statements
 block ::=      LBRACE block_statements_opt:bso RBRACE {: 
@@ -896,15 +1266,29 @@ block_statements ::=
        :}
        ;
 block_statement ::=
-               local_variable_declaration_statement:lvds {: 
+       tag_variable_declaration_statement:tvds {:
+               RESULT=tvds;
+       :}              
+       |       local_variable_declaration_statement:lvds {: 
                RESULT=lvds;
        :}
        |       statement:statement {: 
                RESULT=statement;
        :}
+//     |       enum_declaration:ed {:
+//             RESULT=ed;
+//     :}
 //     |       class_declaration
 //     |       interface_declaration
        ;
+tag_variable_declaration_statement ::=
+               TAG IDENTIFIER:id EQ NEW TAG LPAREN IDENTIFIER:type RPAREN SEMICOLON {: 
+               ParseNode pn=new ParseNode("tag_declaration");
+               pn.addChild("single").addChild(id);
+               pn.addChild("type").addChild(type);
+               RESULT=pn;
+       :}
+       ;
 local_variable_declaration_statement ::=
                local_variable_declaration:lvd SEMICOLON {: 
                RESULT=lvd;
@@ -916,8 +1300,13 @@ local_variable_declaration ::=
                pn.addChild(type);
                pn.addChild(var);
                RESULT=pn;
-:}
-//     |       FINAL type variable_declarators
+       :}
+       |       FINAL type:type variable_declarators:var {: 
+               ParseNode pn=new ParseNode("local_variable_declaration");
+               pn.addChild(type);
+               pn.addChild(var);
+               RESULT=pn;
+       :}
        ;
 statement ::=  statement_without_trailing_substatement:st {: 
                RESULT=st;
@@ -939,13 +1328,16 @@ statement_without_trailing_substatement ::=
                block:st {: RESULT=st; :}
        |       empty_statement:st {: RESULT=st; :}
        |       expression_statement:st {: RESULT=st; :}
-//     |       switch_statement
-       |       do_statement
+       |       switch_statement:st {: RESULT=st; :}
+       |       do_statement:dos {:RESULT=dos; :}
        |       break_statement:st {: RESULT=st; :}
        |       continue_statement:st {: RESULT=st; :}
        |       return_statement:st {: RESULT=st; :}
        |       task_exitstatement:st {: RESULT=st; :}
-//     |       synchronized_statement
+       |       atomic_statement:st {: RESULT=st; :}
+       |       sese_statement:st {: RESULT=st; :}
+       |       synchronized_statement:st {: RESULT=st; :}
+       |       genreach_statement:st {: RESULT=st; :}
 //     |       throw_statement
 //     |       try_statement
 //     |       assert_statement
@@ -1002,30 +1394,86 @@ if_then_else_statement_no_short_if ::=
                RESULT=pn;
        :}
        ;
-//switch_statement ::=
-//             SWITCH LPAREN expression RPAREN switch_block
-//     ;
-//switch_block ::=
-//             LBRACE switch_block_statement_groups switch_labels RBRACE
-//     |       LBRACE switch_block_statement_groups RBRACE
-//     |       LBRACE switch_labels RBRACE
-//     |       LBRACE RBRACE
-//     ;
-//switch_block_statement_groups ::=
-//             switch_block_statement_group
-//     |       switch_block_statement_groups switch_block_statement_group
-//     ;
-//switch_block_statement_group ::=
-//             switch_labels block_statements
-//     ;
-//switch_labels ::=
-//             switch_label
-//     |       switch_labels switch_label
-//     ;
-//switch_label ::=
-//             CASE constant_expression COLON
-//     |       DEFAULT COLON
-//     ;
+switch_statement ::=
+               SWITCH LPAREN expression:exp RPAREN switch_block:body
+               {:
+                   ParseNode pn=new ParseNode("switch_statement");
+                   pn.addChild("condition").addChild(exp);
+                   pn.addChild("statement").addChild(body);
+                   RESULT=pn;
+               :}
+       ;
+switch_block ::=
+               LBRACE switch_block_statement_groups:sbsg switch_labels:sl RBRACE
+               {: 
+                   ParseNode pn = new ParseNode("switch_block");
+                   pn.addChild("switch_labels").addChild(sl);
+                   pn.addChild("switch_statements").addChild(new ParseNode("empty"));
+                   sbsg.addChild(pn);
+                   RESULT=sbsg; 
+               :}
+       |       LBRACE switch_block_statement_groups:sbsg RBRACE
+           {: 
+                   RESULT=sbsg; 
+               :}
+       |       LBRACE switch_labels:sl RBRACE 
+           {: 
+               ParseNode pnb = new ParseNode("switch_block_list");
+                   ParseNode pn = new ParseNode("switch_block");
+                   pn.addChild("switch_labels").addChild(sl);
+                   pn.addChild("switch_statements").addChild(new ParseNode("empty"));
+                   pnb.addChild(pn);
+                   RESULT=pnb; 
+               :}
+       |       LBRACE RBRACE {: RESULT=new ParseNode("empty"); :}
+       ;
+switch_block_statement_groups ::=
+               switch_block_statement_group:sbsg
+               {: 
+                   ParseNode pn = new ParseNode("switch_block_list");
+                   pn.addChild(sbsg);
+                   RESULT=pn;
+               :}
+       |       switch_block_statement_groups:sbsgs switch_block_statement_group:sbsg
+           {:
+               sbsgs.addChild(sbsg);
+               RESULT=sbsgs;
+           :}
+       ;
+switch_block_statement_group ::=
+               switch_labels:sls block_statements:body
+               {: 
+                   ParseNode pn=new ParseNode("switch_block");
+                   pn.addChild("switch_labels").addChild(sls);
+                   pn.addChild("switch_statements").addChild(body);
+                   RESULT=pn; 
+               :}
+       ;
+switch_labels ::=
+               switch_label:sl
+               {: 
+                   ParseNode pn=new ParseNode("switch_label_list");
+                   pn.addChild(sl);
+                   RESULT=pn; 
+               :}
+       |       switch_labels:sls switch_label:sl
+           {: 
+                   sls.addChild(sl); 
+                   RESULT=sls;
+               :}
+       ;
+switch_label ::=
+               CASE constant_expression:ce COLON
+               {: 
+                   ParseNode pn=new ParseNode("switch_label");
+                   pn.addChild(ce);
+                   RESULT=pn;
+               :}
+       |       DEFAULT COLON
+           {: 
+                   RESULT=new ParseNode("default_switch_label"); 
+               :}
+       ;
 
 while_statement ::=
                WHILE LPAREN expression:exp RPAREN statement:st {: 
@@ -1119,9 +1567,43 @@ return_statement ::=
 //throw_statement ::=
 //             THROW expression SEMICOLON
 //     ;
-//synchronized_statement ::=
-//             SYNCHRONIZED LPAREN expression RPAREN block
-//     ;
+synchronized_statement ::=
+               SYNCHRONIZED LPAREN expression:e RPAREN block:b {: 
+               ParseNode pn=new ParseNode("synchronized");
+               pn.addChild("expr").addChild(e);
+               pn.addChild("block").addChild(b);
+               RESULT=pn;
+               :}
+       ;
+atomic_statement ::=
+               ATOMIC block:blk {: 
+       RESULT=(new ParseNode("atomic")).addChild(blk).getRoot();
+       :}
+       ;
+sese_statement ::=
+              SESE block:blk {: 
+              ParseNode pn = new ParseNode("sese");
+              pn.addChild("body").addChild(blk);
+              RESULT=pn;
+       :}
+       |      SESE variable_declarator_id:id block:blk {: 
+              ParseNode pn = new ParseNode("sese");
+              pn.addChild("body").addChild(blk);
+              pn.addChild("identifier").addChild(id);
+              RESULT=pn;
+       :}
+       |      RBLOCK block:blk {: 
+              ParseNode pn = new ParseNode("sese");
+              pn.addChild("body").addChild(blk);
+              RESULT=pn;
+       :}
+       |      RBLOCK variable_declarator_id:id block:blk {: 
+              ParseNode pn = new ParseNode("sese");
+              pn.addChild("body").addChild(blk);
+              pn.addChild("identifier").addChild(id);
+              RESULT=pn;
+       :}
+       ;
 //try_statement ::=
 //             TRY block catches
 //     |       TRY block catches_opt finally
@@ -1160,6 +1642,11 @@ primary_no_new_array ::=
        |       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
@@ -1167,12 +1654,55 @@ primary_no_new_array ::=
 //     |       name DOT THIS
        ;
 class_instance_creation_expression ::=
-               NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN {: 
+               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;
+       :} 
+       //Global object
+       | 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;
+       :}
+       | SCRATCH 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("scratch");
+               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 {: 
+               ParseNode pn=new ParseNode("createobject");
+               pn.addChild(type);
+               pn.addChild(args);
+               pn.addChild(tl);
+               RESULT=pn;
+       :}
+       | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE flag_list:fl RBRACE LBRACE tag_list:tl RBRACE {: 
                ParseNode pn=new ParseNode("createobject");
                pn.addChild(type);
                pn.addChild(args);
+               pn.addChild(fl);
+               pn.addChild(tl);
                RESULT=pn;
        :}
+
 //     |       NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body
 //     |       primary DOT NEW IDENTIFIER
 //                     LPAREN argument_list_opt RPAREN {: 
@@ -1185,10 +1715,33 @@ class_instance_creation_expression ::=
 //     |       name DOT NEW IDENTIFIER
 //                     LPAREN argument_list_opt RPAREN class_body
        ;
+cons_argument_list_opt ::=
+       {: RESULT=new ParseNode("empty"); :}
+       |       cons_argument_list:args {: RESULT=args; :}
+       ;
+
+cons_argument_list ::=
+               IDENTIFIER:id COLON expression:exp {:
+               ParseNode pn=new ParseNode("cons_argument_list");
+               ParseNode pnarg=pn.addChild("binding");
+               pnarg.addChild("var").addChild(id);
+               pnarg.addChild("exp").addChild(exp);
+               RESULT=pn;
+       :}
+       |       argument_list:list COMMA IDENTIFIER:id COLON expression:exp {:
+               ParseNode pnarg=new ParseNode("binding");
+               pnarg.addChild("var").addChild(id);
+               pnarg.addChild("exp").addChild(exp);
+               list.addChild(pnarg);
+               RESULT=list;
+       :}
+       ;
+
 argument_list_opt ::=
        {: RESULT=new ParseNode("empty"); :}
        |       argument_list:args {: RESULT=args; :}
        ;
+
 argument_list ::=
                expression:exp {:
                ParseNode pn=new ParseNode("argument_list");
@@ -1215,6 +1768,54 @@ array_creation_uninit ::=
                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;
+               :}
+       |       SCRATCH 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("scratch");
+               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;
+               :}
+       |       SCRATCH 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("scratch");
+               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
@@ -1231,11 +1832,11 @@ dim_exprs ::=   dim_expr:exp {:
        ;
 dim_expr ::=   LBRACK expression:exp RBRACK {: RESULT=exp; :}
        ;
-dims_opt ::= {: RESULT=null; :}
+dims_opt ::= {: RESULT=new Integer(0); :}
        |       dims:dims {: RESULT = dims; :}
        ;
 
-dims ::=       LBRACK RBRACK {: RESULT=new Integer(0); :}
+dims ::=       LBRACK RBRACK {: RESULT=new Integer(1); :}
        |       dims:dims LBRACK RBRACK {: RESULT=new Integer(dims.intValue()+1); :}
        ;
 
@@ -1263,7 +1864,15 @@ method_invocation ::=
                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 ::=
@@ -1286,6 +1895,7 @@ array_access ::=
 //             RESULT=pn;
 //     :}
        ;
+
 postfix_expression ::=
                primary:exp {: 
        RESULT=exp; :}
@@ -1322,17 +1932,23 @@ predecrement_expression ::=
 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; :}
        ;
 cast_expression ::=
-               LPAREN primitive_type:type
-       //dims_opt 
+               LPAREN primitive_type:type dims_opt:dims
                RPAREN unary_expression:exp {: 
                ParseNode pn=new ParseNode("cast1");
+if (dims.intValue()==0)
                pn.addChild("type").addChild(type);
+else {
+               ParseNode arrayt=pn.addChild("type").addChild("type").addChild("array");
+               arrayt.addChild("basetype").addChild(type);
+               arrayt.addChild("dims").setLiteral(dims);
+}
                pn.addChild("exp").addChild(exp);
                RESULT=pn;
        :}
@@ -1398,7 +2014,12 @@ shift_expression ::=
                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 {: 
@@ -1427,7 +2048,12 @@ relational_expression ::=
                pn.addChild(exp2);
                RESULT=pn;
        :}
-//     |       relational_expression INSTANCEOF reference_type
+       |       relational_expression:exp INSTANCEOF reference_type:type {: 
+               ParseNode pn=new ParseNode("instanceof");
+               pn.addChild("exp").addChild(exp);
+               pn.addChild(type);
+               RESULT=pn;
+       :}
        ;
 
 equality_expression ::=
@@ -1500,14 +2126,31 @@ conditional_or_expression ::=
 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
@@ -1530,7 +2173,7 @@ assignment_operator ::=
        |       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"); :}
@@ -1543,6 +2186,21 @@ expression_opt ::=
 expression ::= assignment_expression:exp {: 
                RESULT=exp; :}
        ;
-//constant_expression ::=
-//             expression
-//     ;
+// note that this constraint must be enforced during semantic checking
+// 'constant_expression' should include enumerated constants.
+constant_expression ::=
+               expression:exp 
+               {:
+                   ParseNode pn = new ParseNode("constant_expression");
+                   pn.addChild(exp);
+                   RESULT=pn;
+               :}
+       ;
+
+
+genreach_statement ::=
+               GENREACH IDENTIFIER:graphName SEMICOLON {: 
+               ParseNode pn=new ParseNode("genreach");
+               pn.addChild("graphName").addChild(graphName);
+               RESULT=pn; :}
+       ;