Thanks! It is true I use ANTLRWorks v3.

Now I have try  an other grammar,  all is well,  without when I makes the 
debugger it shows me:  
"cannot launch the debugger.
Time-out waiting to connect to the remote parser"

 Or sometimes it shows me:
"Compiler exception:
java.io.IOException: Cannot run program"javac": CreateProcess errors=2, Le 
fichier spécifié est introuvable"

What is the wrong??

An other question please , when I use ANTLRWorks it is necessary to install 
ANTLR and how? Just add ANTLR.jar in Classpath? 
Thanks for your help.


________________________________
De : John B. Brodie <[email protected]>
À : Molka Tounsi <[email protected]>
Cc : antlr-interest <[email protected]>
Envoyé le : Mar 20 avril 2010, 16 h 59 min 36 s
Objet : Re: [antlr-interest] help please

Greetings!

On Tue, 2010-04-20 at 14:37 +0000, Molka Tounsi wrote:
> I tried this example on ANTLRWORK but it shows me errors.
> This is the code:
> class CalcParser extends Parser;
> options {
>     buildAST = true;    // uses CommonAST by default
> }
> 
> expr
>     :    mexpr (PLUS^ mexpr)* SEMI!
>     ;
> 
> mexpr
>     :    atom (STAR^ atom)*
>     ;
> 
> atom:    INT
>     ;
> 
> class CalcLexer extends Lexer;
> 
> WS    :    (' '
>     |    '\t'
>     |    '\n'
>     |    '\r')
>         { _ttype = Token.SKIP; }
>     ;
> 
> LPAREN:    '('
>     ;
> 
> RPAREN:    ')'
>     ;
> 
> STAR:    '*'
>     ;
> 
> PLUS:    '+'
>     ;
> 
> SEMI:    ';'
>     ;
> 
> protected
> DIGIT
>     :    '0'..'9'
>     ;
> 
> INT    :    (DIGIT)+
>     ;
> 
> class CalcTreeWalker extends TreeParser;
> 
> expr returns [float r]
> {
>     float a,b;
>     r=0;
> }
>     :    #(PLUS a=expr b=expr)    {r = a+b;}
>     |    #(STAR a=expr b=expr)    {r = a*b;}
>     |    i:INT            {r = (float)Integer.parseInt(i.getText());}
>     ;
> 
>  can you help me please ???
> 

This looks like an ANTLR version 2 grammar. 

Are you sure you are using an older (e.g. v2) ANTLRWorks and not a
newwer v3 oriented ANTLRWorks?

You might consider moving up to ANTLR version 3...


      

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