checking in stuff
[IRC.git] / Robust / JavaGrammar / Parse / java11.cup
1 package Parse;
2
3 import java_cup.runtime.*;
4
5 /* Java 1.1 parser for CUP.  
6  * Copyright (C) 1998-2003 C. Scott Ananian <cananian@alumni.princeton.edu>
7  * This program is released under the terms of the GPL; see the file
8  * COPYING for more details.  There is NO WARRANTY on this code.
9  */
10
11 /*
12 JDK 1.1 Features added:
13   instance initializers
14   anonymous array expressions.
15   class literals.
16   blank finals; final local variables.
17   inner classes:
18   block ::= class/interface decl
19   primary_no_new_array ::= class_name DOT THIS
20   class_instance_creation_expresion ::= ...
21   explicit_constructor_invocation ::= ...
22 */
23 parser code  {: 
24   Lexer lexer;
25
26   public Grm11(Lexer l) {
27     this();
28     lexer=l;
29   }
30
31   public void syntax_error(java_cup.runtime.Symbol current) {
32     report_error("Syntax error (" + current.sym + ")", current);
33   }
34   public void report_error(String message, java_cup.runtime.Symbol info) {
35     lexer.errorMsg(message, info);
36   }
37 :};
38
39 scan with {: return lexer.nextToken(); :};
40
41 terminal BOOLEAN; // primitive_type
42 terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type
43 terminal FLOAT, DOUBLE; // floating_point_type
44 terminal LBRACK, RBRACK; // array_type
45 terminal java.lang.String IDENTIFIER; // name
46 terminal DOT; // qualified_name
47 terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON;
48 terminal PACKAGE; // package_declaration
49 terminal IMPORT; // import_declaration
50 terminal PUBLIC, PROTECTED, PRIVATE; // modifier
51 terminal STATIC; // modifier
52 terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE;
53 terminal CLASS; // class_declaration
54 terminal EXTENDS; // super
55 terminal IMPLEMENTS; // interfaces
56 terminal VOID; // method_header
57 terminal THROWS; // throws
58 terminal THIS, SUPER; // explicit_constructor_invocation
59 terminal INTERFACE; // interface_declaration
60 terminal IF, ELSE; // if_then_statement, if_then_else_statement
61 terminal SWITCH; // switch_statement
62 terminal CASE, DEFAULT; // switch_label
63 terminal DO, WHILE; // while_statement, do_statement
64 terminal FOR; // for_statement
65 terminal BREAK; // break_statement
66 terminal CONTINUE; // continue_statement
67 terminal RETURN; // return_statement
68 terminal THROW; // throw_statement
69 terminal TRY; // try_statement
70 terminal CATCH; // catch_clause
71 terminal FINALLY; // finally
72 terminal NEW; // class_instance_creation_expression
73 terminal PLUSPLUS; // postincrement_expression
74 terminal MINUSMINUS; // postdecrement_expression
75 terminal PLUS, MINUS, COMP, NOT, DIV, MOD;
76 terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression
77 terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression
78 terminal EQEQ, NOTEQ; // equality_expression
79 terminal AND; // and_expression
80 terminal XOR; // exclusive_or_expression
81 terminal OR;  // inclusive_or_expression
82 terminal ANDAND; // conditional_and_expression
83 terminal OROR; // conditional_or_expression
84 terminal QUESTION; // conditional_expression
85 terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator
86 terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator
87 terminal ANDEQ, XOREQ, OREQ; // assignment_operator
88
89 terminal java.lang.Number INTEGER_LITERAL;
90 terminal java.lang.Number FLOATING_POINT_LITERAL;
91 terminal java.lang.Boolean BOOLEAN_LITERAL;
92 terminal java.lang.Character CHARACTER_LITERAL;
93 terminal java.lang.String STRING_LITERAL;
94 terminal NULL_LITERAL;
95
96 // Reserved but unused:
97 terminal CONST, GOTO;
98 // lexer compatibility with Java 1.2:
99 terminal STRICTFP;
100 // lexer compatibility with Java 1.4
101 terminal ASSERT;
102 // lexer compatibility with Java 1.5
103 terminal ELLIPSIS;
104 terminal ENUM;
105
106 // 19.2) The Syntactic Grammar
107 non terminal goal;
108 // 19.3) Lexical Structure
109 non terminal literal;
110 // 19.4) Types, Values, and Variables
111 non terminal type, primitive_type, numeric_type;
112 non terminal integral_type, floating_point_type;
113 non terminal reference_type;
114 non terminal class_or_interface_type;
115 non terminal class_type, interface_type;
116 non terminal array_type;
117 // 19.5) Names
118 non terminal name, simple_name, qualified_name;
119 // 19.6) Packages
120 non terminal compilation_unit;
121 non terminal package_declaration_opt, package_declaration;
122 non terminal import_declarations_opt, import_declarations;
123 non terminal type_declarations_opt, type_declarations;
124 non terminal import_declaration;
125 non terminal single_type_import_declaration;
126 non terminal type_import_on_demand_declaration;
127 non terminal type_declaration;
128 // 19.7) Productions used only in the LALR(1) grammar
129 non terminal modifiers_opt, modifiers, modifier;
130 // 19.8.1) Class Declaration
131 non terminal class_declaration, super, super_opt;
132 non terminal interfaces, interfaces_opt, interface_type_list;
133 non terminal class_body;
134 non terminal class_body_declarations, class_body_declarations_opt;
135 non terminal class_body_declaration, class_member_declaration;
136 // 19.8.2) Field Declarations
137 non terminal field_declaration, variable_declarators, variable_declarator;
138 non terminal variable_declarator_id, variable_initializer;
139 // 19.8.3) Method Declarations
140 non terminal method_declaration, method_header, method_declarator;
141 non terminal formal_parameter_list_opt, formal_parameter_list;
142 non terminal formal_parameter;
143 non terminal throws_opt, throws;
144 non terminal class_type_list, method_body;
145 // 19.8.4) Static Initializers
146 non terminal static_initializer;
147 // 19.8.5) Constructor Declarations
148 non terminal constructor_declaration, constructor_declarator;
149 non terminal constructor_body;
150 non terminal explicit_constructor_invocation;
151 // 19.9.1) Interface Declarations
152 non terminal interface_declaration;
153 non terminal extends_interfaces_opt, extends_interfaces;
154 non terminal interface_body;
155 non terminal interface_member_declarations_opt, interface_member_declarations;
156 non terminal interface_member_declaration, constant_declaration;
157 non terminal abstract_method_declaration;
158 // 19.10) Arrays
159 non terminal array_initializer;
160 non terminal variable_initializers;
161 // 19.11) Blocks and Statements
162 non terminal block;
163 non terminal block_statements_opt, block_statements, block_statement;
164 non terminal local_variable_declaration_statement, local_variable_declaration;
165 non terminal statement, statement_no_short_if;
166 non terminal statement_without_trailing_substatement;
167 non terminal empty_statement;
168 non terminal labeled_statement, labeled_statement_no_short_if;
169 non terminal expression_statement, statement_expression;
170 non terminal if_then_statement;
171 non terminal if_then_else_statement, if_then_else_statement_no_short_if;
172 non terminal switch_statement, switch_block;
173 non terminal switch_block_statement_groups;
174 non terminal switch_block_statement_group;
175 non terminal switch_labels, switch_label;
176 non terminal while_statement, while_statement_no_short_if;
177 non terminal do_statement;
178 non terminal for_statement, for_statement_no_short_if;
179 non terminal for_init_opt, for_init;
180 non terminal for_update_opt, for_update;
181 non terminal statement_expression_list;
182 non terminal identifier_opt;
183 non terminal break_statement, continue_statement;
184 non terminal return_statement, throw_statement;
185 non terminal synchronized_statement, try_statement;
186 non terminal catches_opt, catches, catch_clause;
187 non terminal finally;
188 // 19.12) Expressions
189 non terminal primary, primary_no_new_array;
190 non terminal class_instance_creation_expression;
191 non terminal argument_list_opt, argument_list;
192 non terminal array_creation_expression;
193 non terminal dim_exprs, dim_expr, dims_opt, dims;
194 non terminal field_access, method_invocation, array_access;
195 non terminal postfix_expression;
196 non terminal postincrement_expression, postdecrement_expression;
197 non terminal unary_expression, unary_expression_not_plus_minus;
198 non terminal preincrement_expression, predecrement_expression;
199 non terminal cast_expression;
200 non terminal multiplicative_expression, additive_expression;
201 non terminal shift_expression, relational_expression, equality_expression;
202 non terminal and_expression, exclusive_or_expression, inclusive_or_expression;
203 non terminal conditional_and_expression, conditional_or_expression;
204 non terminal conditional_expression, assignment_expression;
205 non terminal assignment;
206 non terminal left_hand_side;
207 non terminal assignment_operator;
208 non terminal expression_opt, expression;
209 non terminal constant_expression;
210
211 start with goal;
212
213 // 19.2) The Syntactic Grammar
214 goal ::=        compilation_unit
215         ;
216
217 // 19.3) Lexical Structure.
218 literal ::=     INTEGER_LITERAL
219         |       FLOATING_POINT_LITERAL
220         |       BOOLEAN_LITERAL
221         |       CHARACTER_LITERAL
222         |       STRING_LITERAL
223         |       NULL_LITERAL
224         ;
225
226 // 19.4) Types, Values, and Variables
227 type    ::=     primitive_type
228         |       reference_type
229         ;
230 primitive_type ::=
231                 numeric_type
232         |       BOOLEAN
233         ;
234 numeric_type::= integral_type
235         |       floating_point_type
236         ;
237 integral_type ::= 
238                 BYTE 
239         |       SHORT 
240         |       INT 
241         |       LONG 
242         |       CHAR 
243         ;
244 floating_point_type ::= 
245                 FLOAT 
246         |       DOUBLE
247         ;
248
249 reference_type ::=
250                 class_or_interface_type
251         |       array_type
252         ;
253 class_or_interface_type ::= name;
254
255 class_type ::=  class_or_interface_type;
256 interface_type ::= class_or_interface_type;             
257
258 array_type ::=  primitive_type dims
259         |       name dims
260         ;
261
262 // 19.5) Names
263 name    ::=     simple_name
264         |       qualified_name
265         ;
266 simple_name ::= IDENTIFIER
267         ;
268 qualified_name ::=
269                 name DOT IDENTIFIER
270         ;
271
272 // 19.6) Packages
273 compilation_unit ::=
274                 package_declaration_opt 
275                 import_declarations_opt
276                 type_declarations_opt
277                 ;
278 package_declaration_opt ::= package_declaration | ;
279 import_declarations_opt ::= import_declarations | ;
280 type_declarations_opt   ::= type_declarations   | ;
281
282 import_declarations ::= 
283                 import_declaration
284         |       import_declarations import_declaration
285         ;
286 type_declarations ::= 
287                 type_declaration
288         |       type_declarations type_declaration
289         ;
290 package_declaration ::= 
291                 PACKAGE name SEMICOLON
292         ;
293 import_declaration ::= 
294                 single_type_import_declaration
295         |       type_import_on_demand_declaration
296         ;
297 single_type_import_declaration ::= 
298                 IMPORT name SEMICOLON
299         ;
300 type_import_on_demand_declaration ::=
301                 IMPORT name DOT MULT SEMICOLON
302         ;
303 type_declaration ::=
304                 class_declaration
305         |       interface_declaration
306         |       SEMICOLON
307         ;
308
309 // 19.7) Productions used only in the LALR(1) grammar
310 modifiers_opt::=
311         |       modifiers
312         ;
313 modifiers ::=   modifier
314         |       modifiers modifier
315         ;
316 modifier ::=    PUBLIC | PROTECTED | PRIVATE
317         |       STATIC
318         |       ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE
319         ;
320
321 // 19.8) Classes
322
323 // 19.8.1) Class Declaration:
324 class_declaration ::= 
325         modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
326         ;
327 super ::=       EXTENDS class_type
328         ;
329 super_opt ::=   
330         |       super
331         ;
332 interfaces ::=  IMPLEMENTS interface_type_list
333         ;
334 interfaces_opt::=
335         |       interfaces 
336         ;
337 interface_type_list ::= 
338                 interface_type
339         |       interface_type_list COMMA interface_type
340         ;
341 class_body ::=  LBRACE class_body_declarations_opt RBRACE 
342         ;
343 class_body_declarations_opt ::= 
344         |       class_body_declarations ;
345 class_body_declarations ::= 
346                 class_body_declaration
347         |       class_body_declarations class_body_declaration
348         ;
349 class_body_declaration ::=
350                 class_member_declaration
351         |       static_initializer
352         |       constructor_declaration
353         |       block
354         ;
355 class_member_declaration ::=
356                 field_declaration
357         |       method_declaration
358         /* repeat the prod for 'class_declaration' here: */
359         |       modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
360         |       interface_declaration
361         |       SEMICOLON
362         ;
363
364 // 19.8.2) Field Declarations
365 field_declaration ::= 
366                 modifiers_opt type variable_declarators SEMICOLON
367         ;
368 variable_declarators ::=
369                 variable_declarator
370         |       variable_declarators COMMA variable_declarator
371         ;
372 variable_declarator ::=
373                 variable_declarator_id
374         |       variable_declarator_id EQ variable_initializer
375         ;
376 variable_declarator_id ::=
377                 IDENTIFIER
378         |       variable_declarator_id LBRACK RBRACK
379         ;
380 variable_initializer ::=
381                 expression
382         |       array_initializer
383         ;
384
385 // 19.8.3) Method Declarations
386 method_declaration ::=
387                 method_header method_body
388         ;
389 method_header ::=
390                 modifiers_opt type method_declarator throws_opt
391         |       modifiers_opt VOID method_declarator throws_opt
392         ;
393 method_declarator ::=
394                 IDENTIFIER LPAREN formal_parameter_list_opt RPAREN
395         |       method_declarator LBRACK RBRACK
396         ;
397 formal_parameter_list_opt ::=
398         |       formal_parameter_list
399         ;
400 formal_parameter_list ::=
401                 formal_parameter
402         |       formal_parameter_list COMMA formal_parameter
403         ;
404 formal_parameter ::=
405                 type variable_declarator_id
406         |       FINAL type variable_declarator_id
407         ;
408 throws_opt ::=  
409         |       throws
410         ;
411 throws ::=      THROWS class_type_list
412         ;
413 class_type_list ::=
414                 class_type
415         |       class_type_list COMMA class_type
416         ;
417 method_body ::= block
418         |       SEMICOLON
419         ;
420
421 // 19.8.4) Static Initializers
422 static_initializer ::=
423                 STATIC block
424         ;
425
426 // 19.8.5) Constructor Declarations
427 constructor_declaration ::=
428                 modifiers_opt constructor_declarator throws_opt 
429                         constructor_body
430         ;
431 constructor_declarator ::=
432                 simple_name LPAREN formal_parameter_list_opt RPAREN
433         ;
434 constructor_body ::=
435                 LBRACE explicit_constructor_invocation
436                         block_statements RBRACE
437         |       LBRACE explicit_constructor_invocation RBRACE
438         |       LBRACE block_statements RBRACE
439         |       LBRACE RBRACE
440         ;
441 explicit_constructor_invocation ::=
442                 THIS LPAREN argument_list_opt RPAREN SEMICOLON
443         |       SUPER LPAREN argument_list_opt RPAREN SEMICOLON
444         |       primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
445         ;
446
447 // 19.9) Interfaces
448
449 // 19.9.1) Interface Declarations
450 interface_declaration ::=
451                 modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt 
452                         interface_body
453         ;
454 extends_interfaces_opt ::=
455         |       extends_interfaces
456         ;
457 extends_interfaces ::=
458                 EXTENDS interface_type
459         |       extends_interfaces COMMA interface_type
460         ;
461 interface_body ::=
462                 LBRACE interface_member_declarations_opt RBRACE
463         ;
464 interface_member_declarations_opt ::=
465         |       interface_member_declarations
466         ;
467 interface_member_declarations ::=
468                 interface_member_declaration
469         |       interface_member_declarations interface_member_declaration
470         ;
471 interface_member_declaration ::=
472                 constant_declaration
473         |       abstract_method_declaration
474         |       class_declaration
475         |       interface_declaration
476         |       SEMICOLON
477         ;
478 constant_declaration ::=
479                 field_declaration
480         // need to semantically check that modifiers of field declaration
481         // include only PUBLIC, STATIC, or FINAL.  Other modifiers are
482         // disallowed.
483         ;
484 abstract_method_declaration ::=
485                 method_header SEMICOLON
486         ;
487
488 // 19.10) Arrays
489 array_initializer ::=
490                 LBRACE variable_initializers COMMA RBRACE
491         |       LBRACE variable_initializers RBRACE
492         |       LBRACE COMMA RBRACE
493         |       LBRACE RBRACE
494         ;
495 variable_initializers ::=
496                 variable_initializer
497         |       variable_initializers COMMA variable_initializer
498         ;
499
500 // 19.11) Blocks and Statements
501 block ::=       LBRACE block_statements_opt RBRACE
502         ;
503 block_statements_opt ::=
504         |       block_statements
505         ;
506 block_statements ::=
507                 block_statement
508         |       block_statements block_statement
509         ;
510 block_statement ::=
511                 local_variable_declaration_statement
512         |       statement
513         |       class_declaration
514         |       interface_declaration
515         ;
516 local_variable_declaration_statement ::=
517                 local_variable_declaration SEMICOLON
518         ;
519 local_variable_declaration ::=
520                 type variable_declarators
521         |       FINAL type variable_declarators
522         ;
523 statement ::=   statement_without_trailing_substatement
524         |       labeled_statement
525         |       if_then_statement
526         |       if_then_else_statement
527         |       while_statement
528         |       for_statement
529         ;
530 statement_no_short_if ::=
531                 statement_without_trailing_substatement
532         |       labeled_statement_no_short_if
533         |       if_then_else_statement_no_short_if
534         |       while_statement_no_short_if
535         |       for_statement_no_short_if
536         ;
537 statement_without_trailing_substatement ::=
538                 block
539         |       empty_statement
540         |       expression_statement
541         |       switch_statement
542         |       do_statement
543         |       break_statement
544         |       continue_statement
545         |       return_statement
546         |       synchronized_statement
547         |       throw_statement
548         |       try_statement
549         ;
550 empty_statement ::=
551                 SEMICOLON
552         ;
553 labeled_statement ::=
554                 IDENTIFIER COLON statement
555         ;
556 labeled_statement_no_short_if ::=
557                 IDENTIFIER COLON statement_no_short_if
558         ;
559 expression_statement ::=
560                 statement_expression SEMICOLON
561         ;
562 statement_expression ::=
563                 assignment
564         |       preincrement_expression
565         |       predecrement_expression
566         |       postincrement_expression
567         |       postdecrement_expression
568         |       method_invocation
569         |       class_instance_creation_expression
570         ;
571 if_then_statement ::=
572                 IF LPAREN expression RPAREN statement
573         ;
574 if_then_else_statement ::=
575                 IF LPAREN expression RPAREN statement_no_short_if 
576                         ELSE statement
577         ;
578 if_then_else_statement_no_short_if ::=
579                 IF LPAREN expression RPAREN statement_no_short_if
580                         ELSE statement_no_short_if
581         ;
582 switch_statement ::=
583                 SWITCH LPAREN expression RPAREN switch_block
584         ;
585 switch_block ::=
586                 LBRACE switch_block_statement_groups switch_labels RBRACE
587         |       LBRACE switch_block_statement_groups RBRACE
588         |       LBRACE switch_labels RBRACE
589         |       LBRACE RBRACE
590         ;
591 switch_block_statement_groups ::=
592                 switch_block_statement_group
593         |       switch_block_statement_groups switch_block_statement_group
594         ;
595 switch_block_statement_group ::=
596                 switch_labels block_statements
597         ;
598 switch_labels ::=
599                 switch_label
600         |       switch_labels switch_label
601         ;
602 switch_label ::=
603                 CASE constant_expression COLON
604         |       DEFAULT COLON
605         ;
606
607 while_statement ::=
608                 WHILE LPAREN expression RPAREN statement
609         ;
610 while_statement_no_short_if ::=
611                 WHILE LPAREN expression RPAREN statement_no_short_if
612         ;
613 do_statement ::=
614                 DO statement WHILE LPAREN expression RPAREN SEMICOLON
615         ;
616 for_statement ::=
617                 FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
618                         for_update_opt RPAREN statement
619         ;
620 for_statement_no_short_if ::=
621                 FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
622                         for_update_opt RPAREN statement_no_short_if
623         ;
624 for_init_opt ::=
625         |       for_init
626         ;
627 for_init ::=    statement_expression_list
628         |       local_variable_declaration
629         ;
630 for_update_opt ::=
631         |       for_update
632         ;
633 for_update ::=  statement_expression_list
634         ;
635 statement_expression_list ::=
636                 statement_expression
637         |       statement_expression_list COMMA statement_expression
638         ;
639
640 identifier_opt ::= 
641         |       IDENTIFIER
642         ;
643
644 break_statement ::=
645                 BREAK identifier_opt SEMICOLON
646         ;
647
648 continue_statement ::=
649                 CONTINUE identifier_opt SEMICOLON
650         ;
651 return_statement ::=
652                 RETURN expression_opt SEMICOLON
653         ;
654 throw_statement ::=
655                 THROW expression SEMICOLON
656         ;
657 synchronized_statement ::=
658                 SYNCHRONIZED LPAREN expression RPAREN block
659         ;
660 try_statement ::=
661                 TRY block catches
662         |       TRY block catches_opt finally
663         ;
664 catches_opt ::=
665         |       catches
666         ;
667 catches ::=     catch_clause
668         |       catches catch_clause
669         ;
670 catch_clause ::=
671                 CATCH LPAREN formal_parameter RPAREN block
672         ;
673 finally ::=     FINALLY block
674         ;
675
676 // 19.12) Expressions
677 primary ::=     primary_no_new_array
678         |       array_creation_expression
679         ;
680 primary_no_new_array ::=
681                 literal
682         |       THIS
683         |       LPAREN expression RPAREN
684         |       class_instance_creation_expression
685         |       field_access
686         |       method_invocation
687         |       array_access
688         |       primitive_type DOT CLASS
689         |       VOID DOT CLASS
690         |       array_type DOT CLASS
691         |       name DOT CLASS
692         |       name DOT THIS
693         ;
694 class_instance_creation_expression ::=
695                 NEW class_type LPAREN argument_list_opt RPAREN
696         |       NEW class_type LPAREN argument_list_opt RPAREN class_body
697         |       primary DOT NEW IDENTIFIER
698                         LPAREN argument_list_opt RPAREN
699         |       primary DOT NEW IDENTIFIER
700                         LPAREN argument_list_opt RPAREN class_body
701         ;
702 argument_list_opt ::=
703         |       argument_list
704         ;
705 argument_list ::=
706                 expression
707         |       argument_list COMMA expression
708         ;
709 array_creation_expression ::=
710                 NEW primitive_type dim_exprs dims_opt
711         |       NEW class_or_interface_type dim_exprs dims_opt
712         |       NEW primitive_type dims array_initializer
713         |       NEW class_or_interface_type dims array_initializer
714         ;
715 dim_exprs ::=   dim_expr
716         |       dim_exprs dim_expr
717         ;
718 dim_expr ::=    LBRACK expression RBRACK
719         ;
720 dims_opt ::=
721         |       dims
722         ;
723 dims ::=        LBRACK RBRACK
724         |       dims LBRACK RBRACK
725         ;
726 field_access ::=
727                 primary DOT IDENTIFIER
728         |       SUPER DOT IDENTIFIER
729         ;
730 method_invocation ::=
731                 name LPAREN argument_list_opt RPAREN
732         |       primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN
733         |       SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
734         ;
735 array_access ::=
736                 name LBRACK expression RBRACK
737         |       primary_no_new_array LBRACK expression RBRACK
738         ;
739 postfix_expression ::=
740                 primary
741         |       name
742         |       postincrement_expression
743         |       postdecrement_expression
744         ;
745 postincrement_expression ::=
746                 postfix_expression PLUSPLUS
747         ;
748 postdecrement_expression ::=
749                 postfix_expression MINUSMINUS
750         ;
751 unary_expression ::=
752                 preincrement_expression
753         |       predecrement_expression
754         |       PLUS unary_expression
755         |       MINUS unary_expression
756         |       unary_expression_not_plus_minus
757         ;
758 preincrement_expression ::=
759                 PLUSPLUS unary_expression
760         ;
761 predecrement_expression ::=
762                 MINUSMINUS unary_expression
763         ;
764 unary_expression_not_plus_minus ::=
765                 postfix_expression
766         |       COMP unary_expression
767         |       NOT unary_expression
768         |       cast_expression
769         ;
770 cast_expression ::=
771                 LPAREN primitive_type dims_opt RPAREN unary_expression
772         |       LPAREN expression RPAREN unary_expression_not_plus_minus
773         |       LPAREN name dims RPAREN unary_expression_not_plus_minus
774         ;
775 multiplicative_expression ::=
776                 unary_expression
777         |       multiplicative_expression MULT unary_expression
778         |       multiplicative_expression DIV unary_expression
779         |       multiplicative_expression MOD unary_expression
780         ;
781 additive_expression ::=
782                 multiplicative_expression
783         |       additive_expression PLUS multiplicative_expression
784         |       additive_expression MINUS multiplicative_expression
785         ;
786 shift_expression ::=
787                 additive_expression
788         |       shift_expression LSHIFT additive_expression
789         |       shift_expression RSHIFT additive_expression
790         |       shift_expression URSHIFT additive_expression
791         ;
792 relational_expression ::=
793                 shift_expression
794         |       relational_expression LT shift_expression
795         |       relational_expression GT shift_expression
796         |       relational_expression LTEQ shift_expression
797         |       relational_expression GTEQ shift_expression
798         |       relational_expression INSTANCEOF reference_type
799         ;
800 equality_expression ::=
801                 relational_expression
802         |       equality_expression EQEQ relational_expression
803         |       equality_expression NOTEQ relational_expression
804         ;
805 and_expression ::=
806                 equality_expression
807         |       and_expression AND equality_expression
808         ;
809 exclusive_or_expression ::=
810                 and_expression
811         |       exclusive_or_expression XOR and_expression
812         ;
813 inclusive_or_expression ::=
814                 exclusive_or_expression
815         |       inclusive_or_expression OR exclusive_or_expression
816         ;
817 conditional_and_expression ::=
818                 inclusive_or_expression
819         |       conditional_and_expression ANDAND inclusive_or_expression
820         ;
821 conditional_or_expression ::=
822                 conditional_and_expression
823         |       conditional_or_expression OROR conditional_and_expression
824         ;
825 conditional_expression ::=
826                 conditional_or_expression
827         |       conditional_or_expression QUESTION expression 
828                         COLON conditional_expression
829         ;
830 assignment_expression ::=
831                 conditional_expression
832         |       assignment
833         ;
834 assignment ::=  left_hand_side assignment_operator assignment_expression
835         ;
836 left_hand_side ::=
837                 name
838         |       field_access
839         |       array_access
840         ;
841 assignment_operator ::=
842                 EQ
843         |       MULTEQ
844         |       DIVEQ
845         |       MODEQ
846         |       PLUSEQ
847         |       MINUSEQ
848         |       LSHIFTEQ
849         |       RSHIFTEQ
850         |       URSHIFTEQ
851         |       ANDEQ
852         |       XOREQ
853         |       OREQ
854         ;
855 expression_opt ::=
856         |       expression
857         ;
858 expression ::=  assignment_expression
859         ;
860 constant_expression ::=
861                 expression
862         ;