Compiling Java 9

Stephan Herrmann stephan.herrmann at berlin.de
Wed Nov 16 23:28:14 UTC 2016


On 11/17/2016 12:10 AM, Alex Buckley wrote:
> On 11/16/2016 3:03 PM, Stephan Herrmann wrote:
>> On 11/16/2016 11:57 PM, Alex Buckley wrote:
>>> On 11/16/2016 2:26 PM, Stephan Herrmann wrote:
>>>> And we may safely assume regularity of the grammar, i.e.,
>>>> the above approach will never lead to ambiguities, right?
>>>>
>>>> Fictitious counter example
>>>>
>>>>     ModuleDeclaration:
>>>>       module open Identifier ModuleBody;
>>>>       module Identifier ModuleBody;
>>>>
>>>> With this the second token could be keyword or identifier, and we're
>>>> stuck, aren't we?
>>>>
>>>> May we assume that the grammar will not be extended in such ambiguous
>>>> ways?
>>>
>>> There is already a production like this:
>>>
>>> ModuleStatement:
>>>   requires transitive ModuleName ;
>>>   requires ModuleName ;
>>
>> Outch!!
>>
>> So when you read "requires transitive" which rule are you parsing against?
>> When do you decide whether transitive is a keyword or an identifier?
>> I guess we have to wait until we matched the full rule.
>> That requires backtracking, or what am I missing?
>
> Yes, you need to lookahead to a ;
>
> Alex

So everything points at ';' to the rescue.

Unfortunately, while a user types a line of text, this essential
character will be missing until the very end, so tool support
for incomplete lines will not be great.

Not much we can do, I guess.

OK, thanks to you both, I believe I understand the intention.

I guess I made my point that I see tremendous difficulties
in providing good tool support, and that I'm not convinced
that the current definition matches to the intended solution.

I mentioned that all this could probably be avoided by using
an escape mechanism.

That said I will stop harping on these points,
Stephan





More information about the jigsaw-dev mailing list