[antlr-interest] Problem generating the Java parser for Oracle PL/SQL grammar

Johannes Luber jaluber at gmx.de
Mon Nov 3 07:54:58 PST 2008


Javier Luis Cánovas Izquierdo schrieb:
> Hi Johannes, thanks for your fast response.
> 
> Maybe I have not explined the problem correctly, sorry. I have just
> proved that changes.
> 
> I have specified the parameter for the JVM for increasing the memory
> limit of the JVM. Actually, it is "-Xms1024m -Xmx1024m" (will it need
> more? really?) and the options section does not contain the line which
> specifies the output language (it only contains the output and k
> options).
> 
> I did not check that the grammar does not contain C# code. However, I
> suppose that the parser process generation should not depends on the
> actions included by the user. The problem should appear once the
> parser is generated, is it true?. Anyway I have just checked the
> grammar and I have cleaned it to remove the C# actions. The problem
> keeps on.
> 
> I have tested the grammar with antlr 3.0.1 and 3.1.1 and both fail. I
> think that there should be some wrong (or maybe there is a problem
> with the antlr parser tool). I attach the grammar that I am using and
> the trace of the last execution.
> 
> Thanks!

Sorry for the delay. I've tested it myself and I can compile just fine
(although with some warnings). Could it be that you are doing the
options order wrong? I use

java -Xmx1024m -cp <paths to jars - use your own here> org.antlr.Tool
PLSQL3.g

Johannes

> 
> 2008/10/31 Johannes Luber <jaluber at gmx.de>:
>> Javier Luis Cánovas Izquierdo schrieb:
>>> Hi,
>>>
>>> I am working with ANTLRv3 and the Oracle PL/SQL grammar definition
>>> which is located in the antlr grammar list webpage and whose author is
>>> Andrey Kharitonkin. I need to enrich the grammar in order to create a
>>> data structure of the parsed plsql text. However, I have a problem on
>>> the first phase: I cannot generate the Java parser with ANTLR tool
>>> from the grammar of the webpage.
>>>
>>> The grammar has activated the backtrack and memoize options and the k
>>> value is *. When I try to generate the parser, I get a
>>> "java.lang.OutOfMemoryError: Java heap space" (firstTrace.txt file
>>> contains the stack trace of this situation). I have tried to
>>> deactivate the backtrack and memoize options and to set the k value to
>>> 1 (although it will cause warnings during the generation) and the
>>> problem keeps on (secondTrace.txt file contains the stack trace of
>>> this situation).
>>>
>>> I have changed the parameters of the JVM to increase the memory limit
>>> of the virtual machine to 1gb and again, the problem goes on .
>>> However, the memory charge of the java instance does not exceed 100mb.
>>> I cannot understand it.
>>>
>>> I have to be doing some wrong because the grammar that I am using is
>>> the same of the grammar list, I have not change anything. I have seen
>>> that the grammar has the "language=CSharp" option. Could that be the
>>> problem? Could you help me?
>>>
>>> Thanks
>> You have two problems: The first is that you need to tell the Java VM to
>> use more memory like "java -Xmx1024m ...". Adjust the number to your
>> needs. The second problem is that the grammar has been developed with C#
>> as the output language. Changing "CSharp" to "Java" (or removing that
>> line) won't help entirely, as all actions are written in C#. You have to
>> go trough them one by one and fix any incompatibilities.
>>
>> Johannes
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>>
>>
> 
> 
> 
> --
> Javier Luis Cánovas Izquierdo
> http://zirrus.es
> zirrus at gmail.com
> 



More information about the antlr-interest mailing list