[876] in java-interest

home help back first fref pref prev next nref lref last post

More syntactic ambiguity

daemon@ATHENA.MIT.EDU (Scott Hudson)
Sat Aug 12 03:39:30 1995

From: hudson@cc.gatech.edu (Scott Hudson)
To: java-interest@java.sun.com
Date: Wed, 9 Aug 1995 21:05:34 -0400 (EDT)


The language spec grammar contains the productions:

  variableinitializer = 
      expression
  |   '{' (variableinitializer ( ',' variableinitializer )* ','? )? '}'

Under this grammar, the construct: "{a,b}" is ambiguous since "a,b" could
be a single expression (using the comma operator) or a list of 
variableinitializers.

The same ambiguity occurs in:

  arglist = expression (',' expression )*

This is normally handled by not allowing a full expression in these
contexts, but instead using the expression construct for the operator
with the next higher precedence than the comma operator within the
precedence separated productions (assignment_expr in the ANSI C
grammar).  Unfortunately, this grammar has no such production.  This
probably needs to be fixed.

Scott


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post