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 syntactic grammar.

Alex

Reply via email to