Hello ,

   Im working with ANTLRWORKS and i hve probelmes with my grammar if you can
help me to change it in a LL1 grammar help me.
 
grammar grammaire;
PROGRAMM     : 'programm ident' VARDECLLIST FUNCDECLLIST INSTR;         
VARDECLLIST  : EOF| VARDECL ';' VARDECLLIST;
VARDECL      : 'var' IDENTLIST ';' TYPENAME;
IDENTLIST    : 'ident' IDENT;
IDENT        : EOF|','IDENTLIST;        
TYPENAME     : ATOMICTYPE | ARRAYTYPE;
ATOMICTYPE   : 'unit' | 'bool' 
                      | 'int'; 
ARRAYTYPE    : 'array' '['RANGELIST']' 'of' ATOMICTYPE; 
RANGELIST    : 'int..int' RANG;
RANG         :  ',' RANGELIST|EOF;
FUNCDECLLIST : EOF| FUNCDECL ';' FUNCDECLLIST;
FUNCDECL     : 'function ident ('ARGLIST') : 'ATOMICTYPE VARDECLLIST INSTR;
ARGLIST      : ARG K| EOF;
K            :','ARGLIST|EOF;           
ARG          : 'ident :' TYPENAME| 'ref ident :' TYPENAME; 
INSTR        :  'if' EXPR 'then do 'INSTR SUITE 
                                | 'while' EXPR' do' INSTR 
                                | LVALUE' :='EXPR 
                                | 'return' X
                                | 'ident ('EXPRLIST')'
                                | 'begin' SEQUENCE 'end' 
                                | 'begin end'; 
SUITE        :EOF|' else' INSTR ;                                       
X            :EXPR|EOF; 
SEQUENCE     : INSTR SUIV; 
SUIV         :  ';'SEQUENCE|';'|EOF;
LVALUE       : 'ident' VALUE;
VALUE        :  '['EXPRLIST']'|EOF;
EXPRLIST     : EXPR T;
T            :','EXPRLIST |EOF; 
EXPR         : 'cte' R  | '('EXPR')' R
                        | 'opu' EXPR R
                        | 'ident' EXPRL R; 
   
R            :  'opb' EXPR R | EOF;
EXPRL        :  '('EXPRLIST')'|'['EXPRLIST']';


-- 
View this message in context: 
http://antlr.1301665.n2.nabble.com/problem-with-my-grammar-tp5865678p5865678.html
Sent from the ANTLR mailing list archive at Nabble.com.

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