Skip to content

Cleaner EBNF grammar #155

Description

@brupelo

Would it be possible to modify the current ebnf grammar so instead the current
syntax where you're forced to have the first rule and colon after the rule name on
the same line:

grammar = '''
    rule : rule1
        | rule2
'''

you could have indented and clean blocks like this (fornmat used on glsl specs):

grammar = '''
    rule : 
        rule1
        rule2
'''

or maybe (not very clean one):

grammar = '''
    rule : 
         | rule1
         | rule2
'''

or:

grammar = '''
    rule 
         : rule1
         | rule2
'''

or (inspired from Antlr4 ):

grammar = '''
    rule 
         : rule1
         | rule2
         ;
'''

Rationale: That way the EBNF grammar will become much more readable and not only that, you'll be able to fold long grammars easily on your favourite text editor because the grammar now has proper indentation, example here.

Guess it's a matter to tweak a bit this file, even if you don't like the idea, could you explain how you'd do so?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions