Skip to content

ANTLR hangs in this deep parse tree #377

@masonwheeler

Description

@masonwheeler

Grammar file: https://github.com/uwol/proleap-vb6-parser/blob/master/src/main/antlr4/io/proleap/vb6/VisualBasic6.g4
Source file: https://github.com/smbx/smbx-legacy-source/blob/master/modNPC.bas

Attempting to parse this file with a C# parser generated off this grammar causes ANTLR to hang in what appears to be an infinite loop. The debugger says there's some very deep recursion going on deep within the bowels of ParserATNSimulator.AdaptivePredict. Memory usage remains constant during the hang.

It looks like the source file includes some extremely deep parse trees, such as the code following line 2400. This might be part of what's giving the parser trouble. Are there any known workaround for dealing with such issues?

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