On 5/2/2017 3:39 PM, Alex Buckley wrote:
On 5/2/2017 7:07 AM, Jayaprakash Arthanareeswaran wrote:
Chapter 2 in [1] describes context-free grammars. The addition to "3.9
Keywords" defines "restricted keywords", which prevent the grammar for
ModuleDeclaration from being context-free. This prevents compilers from
using common parser generators, since those typically only support
context-free grammars. The lexical/syntactic grammar split defined in
chapter 2 is not of much use for actual implementations of
module-info.java parsers.
The spec at least needs to point out that the given grammar for
ModuleDeclaration is not actually context-free.

The syntactic grammar in JLS8 was not context-free either; the opening
line of Chapter 2 has been false for years. For JLS9, I will remove the
claim that the lexical and syntactic grammars are context-free, and
perhaps a future JLS can discuss the difficulties in parsing the

Jan Lahoda pointed out privately that the syntactic grammar in JLS8 and JLS9 is in fact context-free -- it's just not LL(1). Not being LL(1) is what I should have said the grammar hasn't been for a long time.

Alex

Reply via email to