ANTLR (ANother Tool for Language Recognition) is apowerful parser generator for reading, processing, executing, ortranslating structured text or binary files. It's widely used to buildlanguages, tools, and frameworks. From a grammar, ANTLR generates aparser that can build and walk parse trees.
$pip install antlr4-tools
grammarExpr;prog: (exprNEWLINE)* ;expr:expr ('*'|'/')expr |expr ('+'|'-')expr |INT | '('expr ')' ;NEWLINE : [\r\n]+ ;INT : [0-9]+ ; | $antlr4-parse Expr.g4 prog -gui10+20*30^D$antlr4 Expr.g4 # gen code$ls ExprParser.javaExprParser.java | ![]() |