ted@computing-maths.cardiff.ac.uk (Ted Lawson) (07/22/89)
There are two parts of the Eiffel grammar published in OOSC that
could be represented in ways that reflect their semantics better.
Both concern expressions.
1) The production
Expression = {Unqualified_expression "." ...}
allows tokens other than class features to follow a ".". For example
the following nonsensical constructs will be recognised as Expressions
"1.2.3"
"x.Current.Current"
"x.( 1 + 2 )"
etc.
I suggest this as an alternative:
Expression = Unqualified_expression |
Expression "." Entity |
Expression "." Unqualified_call
2) The syntax defining Multiary_expressions
Expression = {Unqualified_expression "." ...}
Unqualified_expression = Constant | (omitted) |
Operator_expression
Multiary_expression = {Expression Multiary ... }+
is (if I understand Bertrand Meyer's use of the {...} notation correctly)
semantically rather curious. For example, it means that
"123"
is a Multiary_expression.
An alternative:
Multiary_expression = Expression Multiary
{Expression Multiary ... }+
or recursively:
Multiary_expression = Expression Multiary Expression |
Multiary_expression Multiary Expression
================================
Any comments on these remarks are very welcome.
Ted Lawson
ted@uk.ac.cf.cm