Skip to content

trparse error: Grammar must have exactly one start rule. #569

Description

@davdres

I am working with a derivation of the Antlr4 grammars PlSqlLexer.g4 and PlSqlParser.g4. In this derivation the lexer and parser have been combined. I have generated and built a parser using trgen. I am using the Java target. I passed the start rule into trgen when I generated the parser. I am in the Generated-Java directory, when I execute 'trparse PlSql.g4 | tranalyze' and get the error,
System.Exception: Grammar must have exactly one start rule.
at tranalyze.Grammar..ctor(UnvParseTreeNode root) in C:\Users\Kenne\Documents\GitHub\Trash\src\tranalyze\Command.cs:line 187
at tranalyze.Command.AnalyzeDoc(UnvParseTreeNode[] trees) in C:\Users\Kenne\Documents\GitHub\Trash\src\tranalyze\Command.cs:line 78
at tranalyze.Command.Execute(Config config) in C:\Users\Kenne\Documents\GitHub\Trash\src\tranalyze\Command.cs:line 70
at tranalyze.Program.MainInternal(String[] args) in C:\Users\Kenne\Documents\GitHub\Trash\src\tranalyze\Program.cs:line 69
at tranalyze.Program.Main(String[] args) in C:\Users\Kenne\Documents\GitHub\Trash\src\tranalyze\Program.cs:line 14

I have formatted the output of trparse with trjson and I can see in Command.cs where the error is being thrown. But it is not quite clear to me what is causing start.Count to be greater than one.

Attached is the grammar file I am attempting to analyze.

Questions

  1. Are there any debugging options for the commands?

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