[antlr-interest] Please provide fix for the errors in STDC Grammar

vasanthi a vasanthi.ak at gmail.com
Thu Jan 8 03:27:36 PST 2009


Hi All

I get the below 3 errors

How do I fix the above 3 errors?

This is really very very important and urgent.. Please help me in this
regard.
Please provide fix for  the same.

1:

typedef unsigned short int USHORT;
typedef USHORT STATUS;
STATUS status;


When ever it tries to the read the token it gives the below

[ unexpected token: status ]



2:  extern word __extension__({ __uint16_t __swap16gen_x = (word w);
(__uint16_t)((__swap16gen_x & 0xff) << 8 | (__swap16gen_x & 0xff00) >> 8);
});



I get the below error

unexpected token: {

how to I fix it....  in the below code



translationUnit

:

{_cm.enterExternalScope(-1);}

(externalList)?

{_cm.exitExternalScope();}

;

externalList

: (externalDef)+

;

externalDef

{_cm.methodStartLine = _cm.lastIdLine;}

: ( "typedef" | declaration )=> declaration

| (functionDef) => functionDef

| functionDef

| asm_expr



;

asm_expr

: "asm"

("volatile")? LCURLY expr RCURLY (SEMI)+

;

attr_expr

: "__attribute__" LPAREN expr RPAREN

;

declaration

{_cm.beginFunctionDeclaration();}

: (SEMI)* declSpecifiers (initDeclList)? (SEMI)+

{_cm.endFunctionDeclaration();}

;

declSpecifiers

{_cm.lastType ="";_cm.qualifier = "";}

: ( options { warnWhenFollowAmbig = false;}:

storageClassSpecifier

| typeQualifier

| (options {generateAmbigWarnings = false;}:

"struct" | "union" | "enum" | typeSpecifier)=> typeSpecifier

)+

;



3:

 Token *pToken = __builtin_va_arg(ap, Token*);

i get the below error when it tries to read the above line..

unexpected token: *

additiveExpr

: multExpr

((PLUS|MINUS) multExpr)*

;

multExpr

: castExpr

((STAR|DIV|MOD) castExpr)*

;

castExpr

: (("___typeof")? LPAREN typeName RPAREN)=>

("___typeof")? LPAREN typeName RPAREN

(options {generateAmbigWarnings = false;}:castExpr)?

| unaryExpr

// Vasanthi --pearl

| (options {generateAmbigWarnings = false;}:

(typeQualifier)* (typeSpecifier)+ (STAR)?)

=>(typeQualifier)*(typeSpecifier)+ (STAR)?

;



How do I fix the above 3 errors?

This is really very very important and urgent.. Please help me in this
regard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090108/89a73a85/attachment.html 


More information about the antlr-interest mailing list