Filipe David Manana schrieb:
> Hello,
> 
> I've just started learning and playing with ANTLR.
> I am writing a subset of the JavaScript grammar (as the examples at
> antlr.org <http://antlr.org> don't work for me).
> In ANTLRWorks, when I use the interpreter, the second rule generates two
> errors with messages:
> 
> first node -> "FailedPredicateException(sourceElements, {can't deal with
> predicates yet}?)"
> second node -> "FailedPredicateException(sourceElements,
> {synpred3_JavaScript}?)"
> 
> (parse tree with the error nodes can be found in the attachment)
> 
> However, if I use the debugger, the parsing is successful.
> Why is this so?

Because Jean Bovet hasn't done the effort required to make the
interpreter capable to deal with predicates yet. Considering that such
predicates can do everything like actions doing so is a lot of work,
compared to just using the debugger and improving the editor with other
features.

Johannes
> 
> My grammar is the following (also in attachment):
> 
> grammar JavaScript;
> 
> options {
>     backtrack=true;
>     memoize=true;
> }
> 
> program
>     : sourceElements EOF
>     ;
>    
> sourceElements
>     : LT* ( sourceElement LT* )*
>     ;
>    
> sourceElement
>     : functionDeclaration
>     | statement
>     ;
>    
> functionDeclaration
>     : 'function' LT* Identifier LT* formalParameterList LT* functionBody
>     ;
>    
> formalParameterList
>     : '(' LT* ( Identifier ( LT* ',' LT* Identifier )* )? LT* ')'
>     ;
> 
> functionBody
>     : '{' sourceElements '}'
>     ;
> 
> statement
>     : emptyStatement
>     | blockStatement
>     ;
>    
> emptyStatement
>     : ';'
>     ;
>    
> blockStatement
>     : '{' LT* statementList? LT* '}'
>     ;
>    
> statementList
>     : statement ( LT* statement )*
>     ;
> 
> 
> Identifier
>     : IdentifierStart IdentifierPart*
>     ;
>    
> fragment IdentifierStart
>     : UnicodeLetter
>     | '$'
>     | '_'
>         ;
>        
> fragment IdentifierPart
>     : IdentifierStart
>     | UnicodeDigit
>     ;
>    
> fragment UnicodeLetter
>     : 'a'..'z' | 'A'..'Z'
>     ;
> 
> fragment UnicodeDigit
>     : '0'..'9'
>     ;
> 
> LT
>     : '\n' | '\r'
>     ;
>    
> MultilineComment
>     : '/*' (options { greedy=false; } : .)* '*/' { $channel=HIDDEN; }
>     ;
> 
> LineComment
>     : '//' ~(LT)* { $channel=HIDDEN; }
>     ;
>    
> WhiteSpace
>     :  ( ' ' | '\t' | '\v' | '\f' )  { $channel=HIDDEN; }
>     ;
> 
> 
> 
> Thank you,
> regards
> 
> 
> -- 
> Filipe David Manana,
> [email protected] <mailto:[email protected]>
> PGP key - http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC569452B
> <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC569452B>
> 
> "Reasonable men adapt themselves to the world.
> Unreasonable men adapt the world to themselves.
> That's why all progress depends on unreasonable men."
> 
> 
> ------------------------------------------------------------------------
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


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

Reply via email to