Skip to content

Antlr4 generates invalid go parser #4150

@Rini-Tikki

Description

@Rini-Tikki

I am trying to generate lexer, parser, listener and all standard files in Golang for the following grammar:
https://github.com/trinodb/trino/blob/master/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4

Environment
Go version: 1.19
Antlr runtime: I tried all the releases from 4.9 to 4.12, and generated parser is always in some error state like :
Unresolved type 'ParserRuleContext'
Duplicate method 'GetStart'
Cannot use 'localctx' (type IFrameExtentContext) as the type ParserRuleContextType does not implement 'ParserRuleContext' as some methods are missing:SetStart(Token)
Impossible type assertion: '*FrameExtentContext' does not implement 'IFrameExtentContext'

And we cannot modify the auto-generated files it seems to fix the issue.

Can someone take a look into this?

Many thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions