[antlr-interest] Re: Problem with Heterogenous AST antlr 2.7.2a6
Terence Parr
parrt at jguru.com
Sat Dec 21 10:19:21 PST 2002
On Saturday, December 21, 2002, at 07:01 AM, beeh1973
<hastur4711 at bigfoot.com> wrote:
> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...>
> wrote:
>
>>> So the class is really called "org.mydomain.ExistOperator"
>>>
>>> Have you tried the following?
>>> tokens {
>>> EXIST <AST=org.mydomain.ExistOperator>;
>>> }
>>>
>>> I'm not sure whether your example with just the classname should
> work
>>> as well. Ter?
>
> it worked with antlr 2.7.2a2
>
>> You should have to use the full classname unless your parser is in
> the
>> org.mydomain package (in Java).
> it is in the same package
>
> i compared the code generated by v2.7.2a2 and v2.7.2.a6
>
> v2.7.2a2 generates
> ...
> ExistOperator tmp35_AST = null;
> tmp35_AST = new ExistOperator(LT(1));
> ...
>
> v2.7.2a6 generates:
> ...
> ExistOperator tmp35_AST = null;
> tmp35_AST = (ExistOperator)astFactory.create(LT(1),"ExistOperator");
> ...
>
> as far as i understand the change.
>
> v2.7.2a2: if parser and astclasses
> reside in the same package you can use unqualified names in the
> grammar.
>
> v2.7.2a6: you need to use full qulified classnames for astclasses in
> the
> grammar.
>
> right?
>
> so i am changing my grammar.
Hi. Makes sense. Yep, the ASTFactory now creates them not the parser.
Ah ha! I'll add to doc.
Ter
--
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