Skip to content

Direct left recursion in grammar #3

Description

@kaby76

@XzuluX

Direct-left recursion is handled by Antlr, but I suspect that it is inefficient to use. I updated trgen/trperf to create a heat map of LT() along with a pop-up containing all the call stacks at the time of the call for that token. cover.zip What I found were problems for expressions--not surprising--involving rule name.

That's when I notice the rule name involves direct-left recursion. So, I ran the grammar over my script to find all direct-left recursion.

$ bash /c/Users/Kenne/Documents/GitHub/g4-scripts/find-direct-left-recursion.sh ONEParser.g4
Finding direct left recursive symbols in grammars...
L46: name
     ^
L805: type
      ^

I would recommend that rules name and type be rewritten using *-operators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions