[antlr-interest] Problem with PLSQLGrammar.g

Michiel Vermandel MVerma at ferranti.be
Fri Mar 18 07:36:27 PST 2005


Hi,
 
First of all I'm brand new in using AntLr.
I was looking for a PLS/QL code parser and came across AntLr.
While trying to generate the classes out of the PLSQLGrammar.g file I
stumbled on an error.
Given my lack of experience with AntLr I'm stuck.
 
This is what I did:
 
I installed AntLr version 2.7.5 on a Win2k machine and downloaded the
PLSQLGrammar.g file (version: Krupa Benhur Sun Feb 6, 2005 21:04).
 
Running "antlr.Tool PLSQLGrammar.g" results in a number of java files.
PLSqlParser.java
PLSqlLexer.java
and others...
 
During the generation a lot of warnings are show.
At the bottom of this mail you find some of them in section A.
I dumpt the warning output into a file which is in total about 382kb.
I can send the complete file upon request.
 
Though, because I only found warnings and the .java files were created I
continued with compiling these .java files.
 
I use javac.exe. 
I can't find out how to get the version of it but it's installed
together with a java.exe which says this:
 java version "1.3.1_02"
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
 Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
 
While compiling the .java files I get the errors as mentioned in section
B.
 
It seems to be going wrong on the AST class definition of
"SELECT_EXPRESSIONNode".
 
That's what I came up with...
 
But I don't have a clue how to fix this.
 
Hopefully someone does!
 
Thanks in advance.
 
Michiel
 
------------------------------------------------------------------------
---------------------------------------------------------------------
Section A:
------------
 
ANTLR Parser Generator   Version 2.7.5 (20050128)   1989-2005 jGuru.com
PLSQLGrammar.g: warning:lexical nondeterminism between rules IDENTIFIER
and ANY_CHARACTER upon
PLSQLGrammar.g:     k==1:'a'..'z'
PLSQLGrammar.g:     k==2:<end-of-token>
PLSQLGrammar.g: warning:lexical nondeterminism between rules DOT and
NUMBER upon
PLSQLGrammar.g:     k==1:'.'
PLSQLGrammar.g:     k==2:<end-of-token>
PLSQLGrammar.g: warning:lexical nondeterminism between rules PLUS and
NUMBER upon
PLSQLGrammar.g:     k==1:'+'
PLSQLGrammar.g:     k==2:<end-of-token>
PLSQLGrammar.g: warning:lexical nondeterminism between rules MINUS and
NUMBER upon
PLSQLGrammar.g:     k==1:'-'
PLSQLGrammar.g:     k==2:<end-of-token>
PLSQLGrammar.g: warning:lexical nondeterminism between rules DOUBLEDOT
and NUMBER upon
PLSQLGrammar.g:     k==1:'.'
PLSQLGrammar.g:     k==2:'.'
PLSQLGrammar.g:2064:35: warning:lexical nondeterminism between alts 1
and 2 of block upon
PLSQLGrammar.g:2064:35:     k==1:'\n'
PLSQLGrammar.g:2064:35:     k==2:<end-of-token>,'\t','\n','\r',' '
PLSQLGrammar.g:62:9: warning:nondeterminism between alts 1 and 2 of
block upon
PLSQLGrammar.g:62:9:     k==1:"package"
PLSQLGrammar.g:62:9:
k==2:"replace",QUOTED_STRING,"abs","ceil","floor","power","round","sign"
,"sqrt","trunc","chr","initcap","lower","lpad","ltrim","rpad","rtrim","s
oundex","substr","translate","upper","ascii","instr","length","concat","
count","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_c
har","to_date","to_number","decode","dump","greatest","least","nvl","use
renv","vsize","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:62:9:     k==3:"is","as",DOT
PLSQLGrammar.g:62:9:
k==4:"replace","subtype","cursor","type","procedure","function",QUOTED_S
TRING,"abs","ceil","floor","power","round","sign","sqrt","trunc","chr","
initcap","lower","lpad","ltrim","rpad","rtrim","soundex","substr","trans
late","upper","ascii","instr","length","concat","count","chartorowid","c
onvert","hextoraw","rawtohex","rowidtochar","to_char","to_date","to_numb
er","decode","dump","greatest","least","nvl","userenv","vsize","user","s
ysdate","intersect",IDENTIFIER
PLSQLGrammar.g:75: warning:nondeterminism upon
PLSQLGrammar.g:75:
k==1:"replace",QUOTED_STRING,"abs","ceil","floor","power","round","sign"
,"sqrt","trunc","chr","initcap","lower","lpad","ltrim","rpad","rtrim","s
oundex","substr","translate","upper","ascii","instr","length","concat","
count","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_c
har","to_date","to_number","decode","dump","greatest","least","nvl","use
renv","vsize","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:75:
k==2:"replace",DOT,"exception",QUOTED_STRING,"abs","ceil","floor","power
","round","sign","sqrt","trunc","chr","initcap","lower","lpad","ltrim","
rpad","rtrim","soundex","substr","translate","upper","ascii","instr","le
ngth","concat","count","chartorowid","convert","hextoraw","rawtohex","ro
widtochar","to_char","to_date","to_number","decode","dump","greatest","l
east","nvl","userenv","vsize","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:75:
k==3:"replace","is","as",SEMI,DOT,"not",ASSIGNMENT_EQ,OPEN_PAREN,PERCENT
AGE,"return",QUOTED_STRING,"abs","ceil","floor","power","round","sign","
sqrt","trunc","chr","initcap","lower","lpad","ltrim","rpad","rtrim","sou
ndex","substr","translate","upper","ascii","instr","length","concat","co
unt","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_cha
r","to_date","to_number","decode","dump","greatest","least","nvl","usere
nv","vsize","user","sysdate","intersect",IDENTIFIER
PLSQLGrammar.g:75:
k==4:"create","replace","is","as","end",SEMI,"begin",DOT,"not","null",AS
SIGNMENT_EQ,OPEN_PAREN,"exception",COLON,"goto","exit","binary_integer",
"natural","positive","number",NUMBER,"char","long","raw","boolean","date
","smallint","real","numeric","int","integer","double
precesion","decimal","dec","varchar2","varchar","character","mlslabel",P
ERCENTAGE,"return","table",PLUS,MINUS,"raise","while","for","loop","true
","false",QUOTED_STRING,"commit","if","select","abs","ceil","floor","mod
","power","round","sign","sqrt","trunc","chr","initcap","lower","lpad","
ltrim","rpad","rtrim","soundex","substr","translate","upper","ascii","in
str","length","concat","avg","count","max","min","stddev","sum","varianc
e","chartorowid","convert","hextoraw","rawtohex","rowidtochar","to_char"
,"to_date","to_number","decode","dump","greatest","least","nvl","uid","u
serenv","vsize","user","sysdate","intersect","update","insert","set","cl
ose","fetch","lock","open","rollback","savepoint",IDENTIFIER
PLSQLGrammar.g:75:     between alt 1 and exit branch of block
...
 
 
 
------------------------------------------------------------------------
---------------------------------------
Section B
------------
 
C:\Program Files\AntLr\PlSql>"C:\ids9\jdk\bin\javac.exe" -classpath
".;C:\Program Files\AntLr\antlr-2.7.5\antlr-2.7.5.jar" *.java
PLSqlParser.java:9350: cannot resolve symbol
symbol  : class SELECT_EXPRESSIONNode
location: class MyParser.PLSqlParser
                                select_expression_AST =
(AST)astFactory.make( (new
ASTArray(2)).add((SELECT_EXPRESSIONNode)astFactory.create(SELECT_EXPRESS
ION,"select_expression","SELECT_EXPRESSIONNode")).add(select_expression_
AST));
 
                     ^
PLSqlParser.java:14706: cannot resolve symbol
symbol  : class SELECT_EXPRESSIONNode
location: class MyParser.PLSqlParser
                tokenTypeToASTClassMap.put(new Integer(8),
SELECT_EXPRESSIONNode.class);
                                                           ^
2 errors
 
 
Michiel Vermandel
System Design Architect
N.V. Ferranti Computer Systems S.A.
www.ferranti.be <http://www.ferranti.be/> 
Michiel.Vermandel at ferranti.be <outbind://7/mverma@ferranti.be> 
tel: +32 (0)3.540.49.11
fax: +32 (0)3.542.63.28

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050318/541c8360/attachment-0001.html


More information about the antlr-interest mailing list