[antlr-interest] PLSQLGrammar.g

Ed Delaney edelaney at sungardsct.com
Mon Mar 21 11:44:17 PST 2005


Hey Michiel,
Can you tell me how you generated it? I have not figured out Eclipse and 
the Antlr plug-in, so I'm just trying from dos.
java antlr.Tool plsqlgrammar.g

It generates PLSqlLexer.java and PLSqlParser.java, but in the process 
generates a huge amount of output that looks like the stuff below.

So you have any idea what it's problem is?

Can you tell me a little about what you are interested in doing? 

My interest is first just learning about antlr and parsers and lexers. 
Specifically, I want to be able to create a tool that does this:

1) recognizes pl/sql, sqlplus, and sql code inside a file. All our source 
is stored as sqlplus build scripts that may contain all of these in one 
file, including sqlplus substitution variables. I'd like my tool to be 
aware of the substitution variables so it doesn't choke on them or force 
me to always extract the code from the database first.

2) for plsql, a) a code formatter, b) a syntax checker c) a style checker 
(with our custom style rules)

3) finally, once I can get a complete parse tree, I want to create a 
language that can edit and query the parse tree in a syntax sensitive way 
and generate new plsql code. That is, I want to be able to answer 
questions such as "list all the procedure names in the package that 
contain a call to function X with  the first paramter = 'ABC'"
or
Select every procedure or function definition that does not contain a call 
to function 'B'.
or
Read the package and for every procedure called 'A', insert text at a 
specific point in the code.

thanks,
ed

--------------------------------------------------------------
...
PLSQLGrammar.g:1196:25:     k==1:OPEN_PAREN
PLSQLGrammar.g:1196:25:     k==2:NUMBER
PLSQLGrammar.g:1196:25:     k==3:CLOSE_PAREN
PLSQLGrammar.g:1196:25: 
k==4:NULL_TREE_LOOKAHEAD,"or","replace","is","as",SE
MI,"not",ASSIGNMENT_EQ,"default",OPEN_PAREN,COMMA,CLOSE_PAREN,"then","in",PLUS,M
INUS,"and","like","between",DOUBLEDOT,ASTERISK,DIVIDE,QUOTED_STRING,"abs","ceil"
,"floor","power","round","sign","sqrt","trunc","chr","initcap","lower","lpad","l
trim","rpad","rtrim","soundex","substr","translate","upper","ascii","instr","len
gth","concat","count","chartorowid","convert","hextoraw","rawtohex","rowidtochar
","to_char","to_date","to_number","decode","dump","greatest","least","nvl","user
env","vsize","user","sysdate",EQ,LT,GT,NOT_EQ,LE,GE,"intersect",IDENTIFIER
PLSQLGrammar.g:1684:11: warning:nondeterminism between alts 1 and 2 of 
block upo
n
PLSQLGrammar.g:1684:11: 
k==1:"replace",QUOTED_STRING,"abs","ceil","floor","p
ower","round","sign","sqrt","trunc","chr","initcap","lower","lpad","ltrim","rpad
","rtrim","soundex","substr","translate","upper","ascii","instr","length","conca
t","count","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_char"
,"to_date","to_number","decode","dump","greatest","least","nvl","userenv","vsize
","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:1684:11:     k==2:DOT
PLSQLGrammar.g:1684:11: 
k==3:"replace",QUOTED_STRING,"abs","ceil","floor","p
ower","round","sign","sqrt","trunc","chr","initcap","lower","lpad","ltrim","rpad
","rtrim","soundex","substr","translate","upper","ascii","instr","length","conca
t","count","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_char"
,"to_date","to_number","decode","dump","greatest","least","nvl","userenv","vsize
","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:1684:11:     k==4:DOT
PLSQLGrammar.g:1634: warning:nondeterminism between alts 1 and 2 of block 
upon
...

---------------------------------------------------
Ed Delaney
SunGard SCT
Advisory Software Engineer
Phone Number (Office): 765-939-0533
Time Zone: US Indiana
edelaney at sungardsct.com
www.sungardsct.com

Leadership - Choices - Excellence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050321/e2db71cd/attachment.html


More information about the antlr-interest mailing list