[antlr-interest] missing attribute access with c runtime
Jim Idle
jimi at temporal-wave.com
Wed Jul 1 10:04:02 PDT 2009
Carter Cheng wrote:
> Hi,
>
> I have been trying to build a compiler with the c runtime (an old project which I am relooking at) but I could not get ANTLR 3.1.3 to accept the following rules:
>
> formals returns [std::vector< std::pair<Type*, Symbol> > v]
> : f0=formal { v.push_back($f0.var); } (COMMA f1=formal { v.push_back($f1); } )*
>
> formal returns [std::pair<Type*, Symbol> p]
> : type Ident {p.first = $type; p.second = (char*)$Ident.text->chars; }
>
> What is the correct attribute to access the return value?
>
> Thanks in advance.
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
ANTLR does not accept elements for the returns that are as complicated
as this I am afraid, the argument parser is relatively simple. Try a
typedef instead. Also remember that the return is a struct which
contains the tree and any returns parameters so you must return pointers
to things.
Jim
More information about the antlr-interest
mailing list