Grammar for ISO-EBNF with python target

28 views
Skip to first unread message

Paul

unread,
Apr 1, 2017, 6:16:45 AM4/1/17
to antlr-discussion
Is there an ISO-EBNF grammar for ANTLR? I want to create a metagrammar so that my python program can parse EBNF grammars and act on them. Would it be hard to write such a grammar from scratch? I tried to use [1] to write a BNF grammar for PLY, but the description of EBNF in EBNF is confusing. For example, why are there two definitions of "syntax" on page 9?


Venkatram Akkineni

unread,
May 5, 2017, 11:58:19 PM5/5/17
to antlr-discussion
Apparantly it is not possible to create a Context-Free grammar for ISO EBNF. In case you haven't already found the SO link listed below.

http://stackoverflow.com/a/20179940/1056010

Eric Vergnaud

unread,
May 9, 2017, 12:26:15 PM5/9/17
to antlr-discussion
Hi,
you might be right, but ANTLR4 supports left recursion and implicit precedence (through rule order),
so the EBNF fragment in the SO example below could be implemented using ANTLR.
Eric
Reply all
Reply to author
Forward
0 new messages