[antlr-interest] Re: When does AST construction go through factory?

Terence Parr parrt at jguru.com
Fri Jan 17 14:26:40 PST 2003


Hi Daniel,

We're hoping to release ASAP so anything you can do to expedite would 
be great! :D

Thanks,
Ter

On Friday, January 17, 2003, at 02:19 PM, slightlynew <gackle at shaw.ca> 
wrote:

> Micheal,
>
> Many thanks for the replies.  I will try to get something to you over
> the weekend.
>
> Daniel
>
> --- In antlr-interest at yahoogroups.com, "micheal_jor <open.zone at v...>"
> <open.zone at v...> wrote:
>>> Perhaps they have to do with a version mismatch between RC2 and
>>> the C# codegen? (The latest C# version if I am not mistaken is
>> 2.7.2a4?)
>>
>> ANTLR 2.7.2rc2 contains a matching C# codegen.
>>
>>> My previous example was something like this (where IDENT is a
> lexer
>> token
>>> and MYTOKEN is not):
>>>
>>> tokens {
>>>  IDENT<AST=MyIdentifierNode>;
>>>  MYTOKEN<AST=MyASTNode>;
>>> }
>>>
>>> (Problem 1) For IDENT, the parser does:
>>>
>>> astFactory.create(LT(1), "MyIdentifierNode");
>>
>> This would be a bug. ASTFactory.create(Token, string) doesn't exist
>> Can you post a simple repro-grammar please?
>>
>>> which is wonderful in that it is a call to the factory, but it
>> fails to
>>> compile against the C# runtime with an error that says "cannot
>> convert Token
>>> to int".
>>>
>>> (Problem 2) For MYTOKEN, I don't see any generated code that maps
> to
>>> MyASTNode.  The parser used to do this:
>>>
>>> astFactory.registerFactory(MYTOKEN, "MyASTNode");
>>>
>>> But that's gone, and I can't find anything in the generated code
>> that
>>> replaces it.  As a result, when the AST for MYTOKEN gets created,
>> its type
>>> is not MyASTNode but simply the default AST type.
>>
>> Hmm...this isn't right. Please post a repro-grammar and I'll fix it
>> before Ter's planned 2.7.2 release party  ;-)
>>
>>> Would anyone (Micheal? :) care to comment?
>>
>> Ahem..uh..well...
>>
>>> Based on a brief look at the
>>> improved ASTFactory class, there appear to be methods I can call
> to
>> set up
>>> the mappings in my own code, and bypass the Tokens section
>> altogether.  Does
>>> that sound like a valid workaround for now?
>>
>> Yes. Just remember that if the issues are reproducible here, they
>> will be fixed asap and you won't need the workarounds.
>>
>> Cheers,
>>
>> Micheal
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

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



More information about the antlr-interest mailing list