[866] 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 01:17:01 1995

From: "Scott Hudson" <hudson@cs.arizona.edu>
To: java-interest@java.sun.com
Date: Fri, 11 Aug 1995 16:39:47 -0700 (MST)

*** This is a repost due to apparent network failure.
*** Apologies if you get this twice.
*** Note: this is not my normal email address (but it does forward to me).

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