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
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---