Skip to content

NullPointerException #82

@wizardxz

Description

@wizardxz

Hi I am building antlr binary and use it to generate my parser and I saw a NPE in the runtime
Here is what I did

git clone -b rust-target https://github.com/rrevenantt/antlr4
git submodule update --init --recursive --remote
mvn -DskipTests install

Then I get

tool/target/antlr4-4.8-2-SNAPSHOT-complete.jar

Run it to against Expr.g4

grammar Expr;
prog:   (expr NEWLINE)* ;
expr:   expr ('*'|'/') expr
    |   expr ('+'|'-') expr
    |   INT
    |   '(' expr ')'
    ;
NEWLINE : [\r\n]+ ;
INT     : [0-9]+ ;
java -jar antlr4-4.8-2-SNAPSHOT-complete.jar -Dlanguage=Rust Expr.g4 -o generated/expr -visitor
error(31):  ANTLR cannot generate Rust code as of version 4.8
Exception in thread "main" java.lang.NullPointerException
        at org.antlr.v4.analysis.LeftRecursiveRuleAnalyzer.getArtificialOpPrecRule(LeftRecursiveRuleAnalyzer.java:211)
        at org.antlr.v4.analysis.LeftRecursiveRuleTransformer.translateLeftRecursiveRule(LeftRecursiveRuleTransformer.java:116)
        at org.antlr.v4.analysis.LeftRecursiveRuleTransformer.translateLeftRecursiveRules(LeftRecursiveRuleTransformer.java:71)
        at org.antlr.v4.semantics.SemanticPipeline.process(SemanticPipeline.java:71)
        at org.antlr.v4.Tool.processNonCombinedGrammar(Tool.java:382)
        at org.antlr.v4.Tool.process(Tool.java:369)
        at org.antlr.v4.Tool.processGrammarsOnCommandLine(Tool.java:328)
        at org.antlr.v4.Tool.main(Tool.java:172)

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