[antlr-interest] Compiling C runtime & linking

Yves Weißig weissig at rbg.informatik.tu-darmstadt.de
Tue Oct 25 15:14:55 PDT 2011


output = AST;

Java forgives me this error...

I will look at that tomorrow and will try to change the rules according
to your suggestion. Thanks!

Yves

Am 25.10.2011 20:50, schrieb Jim Idle:
> You cannot add different return types to 'children' like that. put the alts
> in a subrule in the same order and accumulate the subrule. What is your
> output= option?
> 
> Jim
> 
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Yves Weißig
>> Sent: Tuesday, October 25, 2011 9:28 AM
>> To: antlr-interest at antlr.org
>> Subject: Re: [antlr-interest] Compiling C runtime & linking
>>
>> Hi,
>> does anybody have an answer to this?
>> The structs do not match. I think this results from my rule:
>> group		:	(OPEN
>> 				children+=space*
>> 				(
>> 				children+=group children+=space* |
>> 				children+=plaintext children+=space* |
>> 				(children+=command | children+=escape)
>> 				(children+=delimiter children+=space+ |
>> children+=delimiter | )
>> 				)+
>> 			CLOSE) -> ^(GROUP $children*) ;
>> Do you have a workaround?
>> Best regards, Yves
>>
>> Am 24.10.2011 18:32, schrieb Yves Weißig:
>>> I attached the generated code...
>>> static RtfParser_group_return
>>> group(pRtfParser ctx)
>>> begins at line 2015.
>>> first error is thrown at line 2113.
>>> maybe my rule is wrong? but output to java works fine.
>>> best regards, yves
>>>
>>> Am 24.10.2011 17:16, schrieb Jim Idle:
>>>> To link statically you need to reference the .a version of the
>>>> library I think. I don't know what your other errors are as I can’t
>>>> see your source code.
>>>>
>>>>
>>>> Jim
>>>>
>>>>> -----Original Message-----
>>>>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>>>>> bounces at antlr.org] On Behalf Of Yves Weißig
>>>>> Sent: Monday, October 24, 2011 8:12 AM
>>>>> Cc: antlr-interest at antlr.org
>>>>> Subject: Re: [antlr-interest] Compiling C runtime & linking
>>>>>
>>>>> Hi again,
>>>>> this seems to be a problem with Windows (still the same error), but
>>>>> I tried the same under Linux and everything went fine. Compiled
>> with
>>>>> ./configure, then make & make install. After that:
>>>>>
>>>>> g++ -I/usr/local/include -shared -oRtfToolkit.lib -static
>>>>> -L/usr/local/lib -lantlr3c RtfLexer.c RtfParser.c
>>>>>
>>>>> Without Parser it works fine, with Parser it throws several:
>>>>>
>>>>> RtfParser.c: In function ‘RtfParser_group_return
>>>>> group(RtfParser_Ctx_struct*)’:
>>>>> RtfParser.c:2113: error: no match for ‘operator=’ in ‘children =
>>>>> space(ctx)’
>>>>> RtfParser.h:198: note: candidates are:
>>>>> RtfParser_delimiter_return_struct&
>>>>> RtfParser_delimiter_return_struct::operator=(const
>>>>> RtfParser_delimiter_return_struct&)
>>>>>
>>>>> I don't know what that means...
>>>>>
>>>>> The grammar rule looks like:
>>>>>
>>>>> group		:	(OPEN
>>>>> 				children+=space*
>>>>> 				(
>>>>> 				children+=group children+=space* |
>>>>> 				children+=plaintext children+=space* |
>>>>> 				(children+=command | children+=escape)
>>>>> 				(children+=delimiter children+=space+ |
>>>>> children+=delimiter | )
>>>>> 				)+
>>>>> 			CLOSE) -> ^(GROUP $children*) ;
>>>>>
>>>>> And one final question, how can I link the ANTLR runtime
>> statically...
>>>>> the above statement (without compiling the Parser) generates a
>> small
>>>>> lib of 16kb, so the ANTLR runtime is not linked static, or am I
>>>>> missing a point here?
>>>>>
>>>>> Best regards, Yves
>>>>>
>>>>> Am 24.10.2011 12:34, schrieb Yves Weißig:
>>>>>> Hi list,
>>>>>> I successfully compiled the C runtime for ANTLR with VS 2010.
>>>>>> Now I want to compile the generated code (Lexer and Parser) with
>>>>>> this
>>>>>> command:
>>>>>> g++ -Iantlrinclude -static -L. -lantlr3c RtfLexer.c RtfParser.c
>>>>>> as you may notice, antlr.h and all includefiles are in
>> antlrinclude
>>>>>> and the antlr3c.lib (copied from the Release dir of VS solution)
>>>>>> lies in the current working dir. I would like to include the
>>>>>> runtime statically ("-static").
>>>>>> But it throws:
>>>>>>
>> C:\Users\Yves\AppData\Local\Temp/ccctgQP2.o:RtfLexer.c:(.text+0xb9):
>>>>>> undefined reference to `antlr3LexerNewStream'
>>>>>> which makes me believe the library is not correctly linked... what
>>>>>> is wrong here?
>>>>>> Best regards, Yves
>>>>>>
>>>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>>>> Unsubscribe:
>>>>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-
>>>>> address
>>>>>
>>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>>> Unsubscribe:
>>>>> http://www.antlr.org/mailman/options/antlr-interest/your-
>>>>> email-address
>>>>
>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>> Unsubscribe:
>>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-
>> addres
>>>> s
>>>>
>>>>
>>>>
>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>> Unsubscribe:
>>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-
>> addres
>>>> s
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
>> email-address
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list