// added for disjoint reachability analysis
terminal GENREACH;
+terminal GEN_DEF_REACH;
// 19.2) The Syntactic Grammar
non terminal ParseNode constructor_declaration, constructor_declarator;
non terminal ParseNode constructor_body;
non terminal ParseNode explicit_constructor_invocation;
-// 19.8.6) Location Hierarchy Declarations
-non terminal ParseNode location_order_declaration, location_order_list, location_order;
// 19.9.1) Interface Declarations
non terminal ParseNode interface_declaration;
-non terminal normal_interface_declaration, annotation_type_declaration;
+//non terminal ParseNode normal_interface_declaration
+non terminal ParseNode annotation_type_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 finally;
//non terminal ParseNode assert_statement;
non terminal ParseNode genreach_statement;
+non terminal ParseNode gen_def_reach_statement;
// 19.12) Expressions
non terminal ParseNode primary, primary_no_new_array;
non terminal ParseNode class_instance_creation_expression;
//non terminal ParseNode enum_arguments_opt, enum_body_declarations_opt;
// annotation expressions
-non terminal ParseNode annotations_opt, annotations, annotations_at, annotation, annotation_body;
+// non terminal ParseNode annotations_opt,
+non terminal ParseNode annotations, annotations_at, annotation, annotation_body;
non terminal ParseNode normal_annotation_body, marker_annotation_body;
non terminal ParseNode single_element_annotation_body;
non terminal ParseNode annotation_type_body, annotation_type_element_declarations;
| block:block {:
RESULT=(new ParseNode("block",parser.lexer.line_num)).addChild(block).getRoot();
:}
- | location_order_declaration:lod {:
- RESULT=(new ParseNode("location_order_declaration",parser.lexer.line_num)).addChild(lod).getRoot();
- :}
;
class_member_declaration ::=
//failure aware computation
{:
RESULT=ed;
:}
-// | interface_declaration:interfaced {:
-// RESULT=(new ParseNode("interface",parser.lexer.line_num)).addChild(interfaced).getRoot();
-// :}
+ | interface_declaration:interfaced {: RESULT=interfaced; :}
| SEMICOLON {: RESULT=new ParseNode("empty",parser.lexer.line_num); :}
;
pn.addChild(name);
RESULT=pn;
:}
- | annotation:an type:type variable_declarator_id:name {:
+ | annotations:an type:type variable_declarator_id:name {:
ParseNode pn=new ParseNode("annotation_parameter",parser.lexer.line_num);
pn.addChild(type);
pn.addChild(name);
pn.addChild(alo);
RESULT=pn;
:}
-// | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
-// | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+ | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
+ | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
;
-// 19.8.6) Location Hierarchy Declarations
-location_order_declaration ::= LOCDEF LBRACE location_order_list:lol RBRACE {:
- RESULT=lol;
- :}
- ;
-location_order_list ::=
- location_order:lo {:
- ParseNode pn=new ParseNode("location_order_list",parser.lexer.line_num);
- pn.addChild(lo);
- RESULT=pn;
- :}
- | location_order_list:lol COMMA location_order:lo {:
- lol.addChild(lo);
- RESULT=lol;
- :}
- ;
-location_order ::=
- IDENTIFIER:loc1 LT IDENTIFIER:loc2{:
- ParseNode pn=new ParseNode("location_order",parser.lexer.line_num);
- pn.addChild(loc1);
- pn.addChild(loc2);
- RESULT=pn;
- :}
- | IDENTIFIER:loc MULT{:
- ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);
- pn.addChild(loc);
- RESULT=pn;
- :}
- ;
-
// 19.9) Interfaces
// 19.9.1) Interface Declarations
pn.addChild("interfacebody").addChild(body);
RESULT=pn;
:}
- | annotation_type_declaration
+ | annotation_type_declaration:atd{:
+ RESULT=atd;
+ :}
;
extends_interfaces_opt ::=
{: RESULT=new ParseNode("empty",parser.lexer.line_num); :}
RESULT=(new ParseNode("enum_declaration",parser.lexer.line_num)).addChild(ed).getRoot();
:}
// | class_declaration:class
-// | interface_declaration:interface
+ | interface_declaration:interfaced {: RESULT=interfaced; :}
| SEMICOLON {:
RESULT=new ParseNode("empty",parser.lexer.line_num);
:}
RESULT=pn;
:}
;
-/*
+
annotation_type_declaration ::=
- AT INTERFACE IDENTIFIER annotation_type_body
- | modifiers_at INTERFACE IDENTIFIER annotation_type_body
+ AT INTERFACE IDENTIFIER:id annotation_type_body:atb{:
+ ParseNode pn=new ParseNode("annotation_type_declaration",parser.lexer.line_num);
+ pn.addChild("name").addChild(id);
+ pn.addChild("body").addChild(atb);
+ RESULT=pn;
+
+ :}
+ | modifiers_at:ma INTERFACE IDENTIFIER:id annotation_type_body:atb{:
+ ParseNode pn=new ParseNode("annotation_type_declaration",parser.lexer.line_num);
+ pn.addChild("name").addChild(id);
+ pn.addChild("modifiers").addChild(ma);
+ pn.addChild("body").addChild(atb);
+ RESULT=pn;
+ :}
;
annotation_type_body ::=
- LBRACE annotation_type_element_declarations_opt RBRACE
+ LBRACE annotation_type_element_declarations_opt:atedo RBRACE{:
+ RESULT=atedo;
+ :}
;
-annotation_type_element_declarations_opt ::=
- | annotation_type_element_declarations
+annotation_type_element_declarations_opt ::={:
+ RESULT=new ParseNode("empty",parser.lexer.line_num);
+ :}
+ | annotation_type_element_declarations:ated{:
+ RESULT=ated;
+ :}
;
annotation_type_element_declarations ::=
- annotation_type_element_declaration
- | annotation_type_element_declarations annotation_type_element_declaration
+ annotation_type_element_declaration:ated{:
+ ParseNode pn=new ParseNode("annotation_type_element_list",parser.lexer.line_num);
+ pn.addChild(ated);
+ RESULT=pn;
+ :}
+ | annotation_type_element_declarations:ateds annotation_type_element_declaration:ated{:
+ ateds.addChild(ated);
+ RESULT=ateds;
+ :}
;
annotation_type_element_declaration ::=
- constant_declaration
- | modifiers_opt type IDENTIFIER LPAREN RPAREN default_value_opt SEMICOLON
- | class_declaration
- | enum_declaration
- | interface_declaration
- | SEMICOLON
+ constant_declaration:cd {:
+ RESULT=cd;
+ :}
+ | modifiers_opt:mo type:type IDENTIFIER:id LPAREN RPAREN default_value_opt:dvo SEMICOLON {:
+ ParseNode pn=new ParseNode("annotation_type_element_declaration",parser.lexer.line_num);
+ pn.addChild("modifier").addChild(mo);
+ pn.addChild("type").addChild(type);
+ pn.addChild("name").addChild(id);
+ pn.addChild("defaultvalue").addChild(dvo);
+ RESULT=pn;
+ :}
+ | class_declaration:cd{:
+ RESULT=cd;
+ :}
+ | enum_declaration:ed{:
+ RESULT=ed;
+ :}
+ | interface_declaration:id{:
+ RESULT=id;
+ :}
+ | SEMICOLON{:
+ RESULT=new ParseNode("empty",parser.lexer.line_num);
+ :}
;
-*/
+default_value_opt ::= {:
+ RESULT=new ParseNode("empty",parser.lexer.line_num);
+ :}
+ | default_value:dv{:
+ RESULT=dv;
+ :}
+ ;
+default_value ::= DEFAULT element_value:ev {:
+ RESULT=ev;
+ :}
+ ;
+
// 19.10) Arrays
array_initializer ::=
LBRACE variable_initializers:var_init_list COMMA RBRACE {:
| sese_statement:st {: RESULT=st; :}
| synchronized_statement:st {: RESULT=st; :}
| genreach_statement:st {: RESULT=st; :}
+ | gen_def_reach_statement:st {: RESULT=st; :}
| throw_statement:st {: RESULT=st; :}
| try_statement:st {: RESULT=st; :}
// | assert_statement
pn.addChild(id);
RESULT=pn;
:}
-// | primitive_type:pt DOT CLASS {:
-// ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
-// pn.addChild(pt);
-// RESULT=pn;
-// :}
-// | VOID DOT CLASS
-// | array_type:at DOT CLASS {:
-// ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
-// pn.addChild(at);
-// RESULT=pn;
-// :}
+ | primitive_type:pt DOT CLASS {:
+ ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
+ pn.addChild(pt);
+ RESULT=pn;
+ :}
+ | VOID DOT CLASS {:
+ ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
+ pn.addChild("type").addChild("void");
+ RESULT=pn;
+ :}
+ | array_type:at DOT CLASS {:
+ ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
+ pn.addChild(at);
+ RESULT=pn;
+ :}
| name:name DOT CLASS {:
ParseNode pn=new ParseNode("class_type",parser.lexer.line_num);
pn.addChild("type").addChild("class").addChild(name);
RESULT=pn;
:}
-// | name DOT THIS
+ | name:name DOT THIS {:
+ ParseNode pn=new ParseNode("parentclass",parser.lexer.line_num);
+ pn.addChild("name").addChild(name);
+ RESULT=pn;
+ :}
;
class_instance_creation_expression ::=
NEWFLAG class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {:
pn.addChild("decl").addChild("classbody").addChild(body);
RESULT=pn;
:}
-// | primary DOT NEW IDENTIFIER
-// LPAREN argument_list_opt RPAREN {:
-//
-// :}
-// | primary DOT NEW IDENTIFIER
-// LPAREN argument_list_opt RPAREN class_body
-// | name DOT NEW IDENTIFIER
-// LPAREN argument_list_opt RPAREN
-// | name DOT NEW IDENTIFIER
-// LPAREN argument_list_opt RPAREN class_body
+ | primary: base DOT NEW class_or_interface_type:type
+ LPAREN argument_list_opt:args RPAREN {:
+ ParseNode pn=new ParseNode("createobject",parser.lexer.line_num);
+ pn.addChild(type);
+ pn.addChild(args);
+ pn.addChild( "base" ).addChild( base );
+ RESULT=pn;
+
+ :}
+ | primary: base DOT NEW class_or_interface_type:type
+ LPAREN argument_list_opt:args RPAREN class_body:body {:
+ ParseNode pn=new ParseNode("createobjectcls",parser.lexer.line_num);
+ pn.addChild(type);
+ pn.addChild(args);
+ pn.addChild( "base" ).addChild( base );
+ pn.addChild("decl").addChild("classbody").addChild(body);
+ RESULT=pn;
+ :}
+ | name:id DOT NEW class_or_interface_type:type
+ LPAREN argument_list_opt:args RPAREN {:
+ ParseNode pn=new ParseNode("createobject",parser.lexer.line_num);
+ pn.addChild(type);
+ pn.addChild(args);
+ pn.addChild( "id" ).addChild( id );
+ RESULT=pn;
+ :}
+ | name:id DOT NEW class_or_interface_type:type
+ LPAREN argument_list_opt:args RPAREN class_body:body {:
+ ParseNode pn=new ParseNode("createobjectcls",parser.lexer.line_num);
+ pn.addChild(type);
+ pn.addChild(args);
+ pn.addChild("decl").addChild("classbody").addChild(body);
+ pn.addChild( "id" ).addChild( id );
+ RESULT=pn;
+ :}
;
cons_argument_list_opt ::=
{: RESULT=new ParseNode("empty",parser.lexer.line_num); :}
pn.addChild("field").addChild(id);
RESULT=pn;
:}
-// | SUPER DOT IDENTIFIER
-// | name DOT SUPER DOT IDENTIFIER
+ | SUPER DOT IDENTIFIER:id {:
+ ParseNode pn=new ParseNode("superfieldaccess",parser.lexer.line_num);
+ pn.addChild("field").addChild(id);
+ RESULT=pn;
+ :}
+ | name:name DOT SUPER DOT IDENTIFIER:id {:
+ ParseNode pn=new ParseNode("supernamefieldaccess",parser.lexer.line_num);
+ pn.addChild("base").addChild(name);
+ pn.addChild("field").addChild(id);
+ RESULT=pn;
+ :}
;
method_invocation ::=
name:name LPAREN argument_list_opt:args RPAREN {:
pn.addChild("graphName").addChild(graphName);
RESULT=pn; :}
;
+
+gen_def_reach_statement ::=
+ GEN_DEF_REACH IDENTIFIER:outputName SEMICOLON {:
+ ParseNode pn=new ParseNode("gen_def_reach",parser.lexer.line_num);
+ pn.addChild("outputName").addChild(outputName);
+ RESULT=pn; :}
+ ;