Hyphenated keywords interacts badly with operator overloading

John Rose john.r.rose at oracle.com
Wed Jan 23 23:18:29 UTC 2019

On Jan 23, 2019, at 3:00 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> the lexer is greedy so there is no ambiguity at parser level.

Exercise for your students:  Characterize the set of all strings of the form `A+"-"+B` which can occur (as three tokens) in some valid Java program, where `A` and `B` are Java keywords or identifiers, but not both are identifiers.

Example solutions:
`A=m,B=int` in `int m=0, n = m-int.class.hashCode()`
`A=assert,B=m` in `assert-m>0`.

`A=B=do` in `x=redo-done`.

More information about the amber-dev mailing list