[antlr-interest] [Help] Question about CTarget of ANTLR

Yang, Y. Y.Yang at tue.nl
Mon Oct 20 12:42:38 PDT 2008


Hi, Johannes

Thanks, it works now.:-)

Best regards

Yang


-----Original Message-----
From: Johannes Luber [mailto:jaluber at gmx.de]
Sent: Mon 10/20/2008 3:56 PM
To: Yang, Y.
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] [Help] Question about CTarget of ANTLR
 
Yang, Y. schrieb:
> Dear All
> 
> When I try to compiler the tree parser example in example-V3 c
> directory, I encountered the following problem in Visual Stuido.
> 
>> d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(83) : error
> C2061: syntax error : identifier 'tree'
> 1>d\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(85) : error
> C2059: syntax error : '}'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(94) : error
> C2061: syntax error : identifier 'tree'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(96) : error
> C2059: syntax error : '}'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(105) :
> error C2061: syntax error : identifier 'tree'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(107) :
> error C2059: syntax error : '}'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(123) :
> error C2061: syntax error : identifier 'LangParser_start_return'
> 1>d:\antlr\examples-v3\examples-v3\c\treeparser\langparser.h(124) :
> error C2143: syntax error : missing ')' before '*'
> 
> And I browse the langparser.h and found 
> 
> typedef struct LangParser_start_return_struct
> {
>     /** Generic return elements for ANTLR3 rules that are not in tree
> parsers or returning trees
>      */
>     pANTLR3_COMMON_TOKEN    start;
>     pANTLR3_COMMON_TOKEN    stop;
>     	tree;
>    
> }
>     LangParser_start_return;
> 
> 
> It seems the tree missing the type, however it is generated by ANTLR. Is
> it a bug or I missing sth,
> 
> Best regards
> 
> Yang

I believe you have to put into the options

ASTLabelType= pANTLR3_BASE_TREE;

to get things working.

Johannes
> 
> 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