Laborator 1

Exemplu 1

%lex
%%
 
[0-9]+    return 'NUMBER'
'+'   return '+'
'-'   return '-'
 
/lex
%%
 
expr : NUMBER '+' NUMBER { alert(parseInt($1)+parseInt($3)); }
     | NUMBER '-' NUMBER { alert(parseInt($1)-parseInt($3)); }
     | NUMBER { $$ = parseInt($1); }
     ;
cpl-atm/laboratoare/laborator1.txt · Last modified: 2013/10/18 12:03 by laura.vasilescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0