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

Javier Luis Cánovas Izquierdo zirrus at gmail.com
Wed Nov 5 01:27:28 PST 2008


Hi,

I have been testing the different situations to generate the parser
with the ANTLR tool in Windows and in Linux. The problem is the ant
task for ANTLR. It seems that the memory is limited by the ant
environment, I do not know.

The solution is to generate the parser in a "traditional way" (default
way). You have to use the java command and to execute the
org.antlr.Tool class. It works in Windows and in Linux.

Regards!

2008/11/4 Javier Luis Cánovas Izquierdo <zirrus at gmail.com>:
> Hi again!
>
> I have located the problem: The operative system. In Windows (under
> Eclipse platform or under MSDOS) it fails. Now, I am using a linux
> system and it works. I do not understand the real reason but I prefer
> to be able to generate the parser.
>
> Can the operative system be the problem? It is very odd, isn't it? It
> is important to note that I am using the ANT task to execute the ANTLR
> Tool in Windows, maybe the problem is that. I do not know.
>
> Anyway, thanks for all!
>
> Regards
>
> 2008/11/3 Johannes Luber <jaluber at gmx.de>:
>> 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
>>>
>>
>>
>
>
>
> --
> Javier Luis Cánovas Izquierdo
> http://zirrus.es
> zirrus at gmail.com
>



-- 
Javier Luis Cánovas Izquierdo
http://zirrus.es
zirrus at gmail.com


More information about the antlr-interest mailing list