[antlr-interest] Re: ANTLR cpp-generated example crashes on Cygwin (Solved)

Terence Parr parrt at cs.usfca.edu
Sat Dec 20 16:52:35 PST 2003


On Saturday, December 20, 2003, at 06:17 PM, Dario Gonzalez wrote:

>
> Just for the record:
>
> - The compiled antl.Tool class crashes when is called with no
> arguments (I don't know if this issue is present in stable versions):

Strange...works for me, but could be a weird thing on cygwin or  
something.  Oh, a compiled version... hmm...

Ter
>
> [~]$ antlr
> ANTLR Parser Generator   Version 2.7.3 (20031220-1)   1989-2003  
> jGuru.com
> #$%%*&@# internal error: java.lang.StringIndexOutOfBoundsException:
> String index
>  out of range: 0
> [complain to nearest government official
>  or send hate-mail to parrt at jguru.com;
>  please send stack trace with report.]
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>         at java.lang.String.charAt(String.java:444)
>         at antlr.preprocessor.Tool.processArguments(Tool.java:124)
>         at antlr.preprocessor.Tool.<init>(Tool.java:25)
>         at antlr.Tool.doEverything(Tool.java:215)
>         at antlr.Tool.main(Tool.java:399)
>
> I'm not a java expert, so I don't know how to get the stack-trace
> (BTW, I won't send hate-mail to Mr. Parr ;) ), but it seems that the
> issue is very reproducible and obvious.
>
> - The link to the latest Klaren's snapshot is broken. Due a typo (I
> assume) it actually links to the previous one. Here is the correct one
> (guessed from the name):
> http://wwwhome.cs.utwente.nl/~klaren/antlr/antlr-20031211.tar.gz
> There is no problem generating the static library with this version in
> MSVC 6.0/SP5
>
> --- In antlr-interest at yahoogroups.com, "Dario Gonzalez"
> <darioglzl at y...> wrote:
>> OK, I know why the snapshot didn't build: There is a bunch of missing
>> *.class files in the antlr/ dir (among them the antlr.Tool class)
>> which are present in the 2.7.2 version.
>>
>> I used "bootstrap" make's target to generate them and now I have the
>> test-snapshot working in Cygwin. I had to modify script/config.make's
>> ANTLR_BOOTSTRAP variable (similar to the Cygwin-working-recipe):
>>
>> ANTLR_BOOSTRAP = $(JAVA) -cp "<windows/path/to/your/antlr.jar>" \
>>        antlr.Tool
>>
>> Hope this one works... if don't, be sure I'll be here soon.
>>
>>
>> Thanx
>>
>>
>> --- In antlr-interest at yahoogroups.com, "Dario Gonzalez"
>> <darioglzl at y...> wrote:
>>> Thanks Ric,
>>>
>>> In the mean time I happily made ANTLR-cpp-generated files work on
>>> Cygwin (with both MinGW and CygWin)... It seems that the cpp-example  
>>> I
>>> used is outdated regarding the ASTFactory-initialization-stuff (which
>>> BTW, I've not understood very well, but I'm in the learning process).
>>>
>>> Now my concern is with MSVC++ 6.0/SP5(Yes, I need it to work in both
>>> CygWin and MSVC++): The first try of creating the library from
>>> Klaren's snapshot, threw 1042 errs (here's only a taste):
>>>
>>> ...\lib\cpp\antlr\circularqueue.hpp(23) : error C2039: '_Vector_val'  
>>> :
>>> is not a member of 'std'
>>> ...\lib\cpp\antlr\circularqueue.hpp(23) : error C2143: syntax error :
>>> missing ';' before '<'
>>> ...\lib\cpp\antlr\circularqueue.hpp(23) : error C2079: '_Vector_val'
>>> uses undefined class 'std'
>>> ...\lib\cpp\antlr\circularqueue.hpp(23) : error C2059: syntax error
>> : '<'
>>> ...\lib\cpp\antlr\circularqueue.hpp(23) : error C2027: use of
>>> undefined type 'std'
>>>         ...\lib\cpp\antlr\circularqueue.hpp(23) : see declaration of
>> 'std'
>>> ...\lib\cpp\antlr\circularqueue.hpp(24) : error C2027: use of
>>> undefined type 'std'
>>>         ...\lib\cpp\antlr\circularqueue.hpp(23) : see declaration of
>> 'std'
>>> ...\lib\cpp\antlr\circularqueue.hpp(24) : error C2143: syntax error :
>>> missing ';' before '<'
>>> ...\lib\cpp\antlr\circularqueue.hpp(24) : error C2079: 'vector' uses
>>> undefined class 'std'
>>> ...\lib\cpp\antlr\circularqueue.hpp(24) : error C2059: syntax error
>> : '<'
>>>
>>> Since the source of this errors were #conditional compilation, my
>>> first reaction was to comment out all the lines that caused them. And
>>> surprisingly it worked!, but I couldn't try it because the
>>> ANTLR-generated CPP files had being produced with antlr2.7.2  
>>> (Abstract
>>> classes weren't being fully imlplemented according to the headers of
>>> the snapshot). So I tryed to compile the full test snapshot following
>>> the same cygwing-recipe... it didn't work:
>>>
>>> =============================
>>> Making antlr ...
>>> =============================
>>> make[1]: Entering directory `/redo/antlr-20031029/antlr'
>>> Makefile:77: warning: overriding commands for target `install'
>>> /redo/antlr-20031029/scripts/Rules.make:383: warning: ignoring old
>>> commands for tar
>>> get `install'
>>> java.exe -cp "C:\cygwin\redo\antlr-20031029" antlr.Tool   antlr.g
>>> Exception in thread "main" java.lang.NoClassDefFoundError: antlr/Tool
>>> make[1]: *** [.antlr.g] Error 1
>>> make[1]: Leaving directory `/redo/antlr-20031029/antlr'
>>> make: *** [subdirs] Error 2
>>>
>>> Obviously, the work-recipe doesn't apply...
>>> So I'm stuck here. Please advice .
>>>
>>>
>>>
>>>
>>> --- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...>  
>>> wrote:
>>>> Hi,
>>>>
>>>> On Thu, Dec 18, 2003 at 05:28:15PM -0000, darioglzl wrote:
>>>>> Sorry if you get this message twice (anyway I've added some
> comments
>>>>> that missed in the first one).
>>>>
>>>> Only saw this one...
>>>>
>>>>> Since I need to use the cpp option, I followed another of the
>>>>> getting-started examples
>>>>> (http://www.merrells.com/john/blog/archives/000100.html) to see if
>>>>> everithing was set ok. The build-process works fine
>>>>> (cppp/hpp files are generated, compiled, and linked against
>>>>> libantlr.a), but the program crashes with segm-fault when typing a
>>>>> line that matches an expresion defined in the *.g file (If I
> typed a
>>>>> non-matching expression an error is displayed that looks like
>>>>> normal, but the segm-fault is still present).
>>>>>
>>>>> As a comment, I'm initializing the ASTFactory (there's a similar
>>>>> problem in the group that was solved by inserting such
>> initialization
>>>>> in the main program:
>>>>> http://groups.yahoo.com/group/antlr-interest/message/8322).
>>>>
>>>> What antlr version are you using? 2.7.2 ? If so please try a
>> development
>>>> snapshot first (http://wwwhome.cs.utwente.nl/~klaren/antlr/) Do the
>>> bundled
>>>> examples work ? Could you provide a backtrace of the error (run the
>>> binary
>>>> in gdb make it crash en do a 'bt')
>>>>
>>>> Cheers,
>>>>
>>>> Ric
>>>> --  
>>>>
>>>
>>
> ----- 
> +++++*****************************************************+++++++++---- 
> ---
>>>>     ---- Ric Klaren ----- j.klaren at u... ----- +31 53 4893722  ----
>>>>
>>>
>>
> ----- 
> +++++*****************************************************+++++++++---- 
> ---
>>>>   Chaos often breeds life, when order breeds habit.
>>>>   --- Henry B. Adams, The Education of Henry Adams
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
>  http://groups.yahoo.com/group/antlr-interest/
>
> To unsubscribe from this group, send an email to:
>  antlr-interest-unsubscribe at yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
>  http://docs.yahoo.com/info/terms/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list