I am trying to use ANTLR for parsing SAS jobs and creating parser based on that.
I am using SAS grammar from https://github.com/xueqilsj/sas-grammar and using ANTLR for parsing and lexical analyzer. I am also using the link provided here: https://shijinglu.wordpress.com/2015/01/22/write-a-primitive-sas-grammar-in-antlr4/ .
Just to clarify, every SAS gramamr is of the format:
grammar AbortStmt;
import CommonLexerRules;
abort_main
: (abort_stmt)* EOF
;
abort_stmt
: ABORT (ABEND | CANCEL (file_spec)? | RETURN )? INT? NOLIST? ';'
;
file_spec
: STRINGLITERAL
;
and I am having problem with the import statement. After I have created the autogenerated class using ANTLR , I am getting the following error:
- Can't load AbortStmtBaseListener.class as lexer or parser.
- Can’t import the Rules.
I am limited by the SAS imports that are defined in the grammar file(as every grammar file has a defined import). Any other ways to parse the grammar files and create decision trees?