I'm just getting started using ANTLR, and want to try test parsing some simple PL/SQL statements using the plsql.g4 grammar. I am following the format used in Getting Started with ANTLR v4.
The following commands execute without issue:
antlr4 plsql.g4
java org.antlr.v4.Tool plsql.g4
javac plsql*.java
In the getting started example, they run the following command:
grun Hello r -tree
Where 'Hello' is the name of the grammar and 'r' is one of its production rules. The grammar indicates that the 'sql_script' production rule consists of zero or more unit statements or sqlplus commands followed by the end of the input stream:
sql_script
: (unit_statement | sql_plus_command)* EOF
;
So I am trying to invoke the PL/SQL parser like so:
grun plsql sql_script -tree
But I get the following error:
Can't load plsql as lexer or parser
What is the correct way to invoke the parser for this grammar to generate a parse tree for a simple PL/SQL statement? I am using JDK 8 on a Windows machine. Here is a screenshot showing the contents of my terminal window.
plsqlLexer.class
file. Are you sure you execute thegrun plsql sql_script -tree
command in the directory whereplsqlLexer.class
andplsqlParser$*.class
files are present? – quepasplsqlParser$*.class
files listed withls
command are enclosed with single quotation marks'
? – quepas