Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cpl-atm:laboratoare:laborator1 [2013/10/18 11:48]
laura.vasilescu [Exemplu 1]
cpl-atm:laboratoare:laborator1 [2013/10/18 12:03] (current)
laura.vasilescu [Exemplu 1]
Line 22: Line 22:
 </​code>​ </​code>​
  
 +<​hidden>​
 +===== Exemplu 2 =======
  
 +<code js>
 +%lex
 +%%
 +
 +[0-9]+ ​   return '​NUMBER'​
 +'​+' ​  ​return '​+'​
 +'​-' ​  ​return '​-'​
 +'​*' ​  ​return '​*'​
 +'/' ​  ​return '/'​
 +
 +/lex
 +%%
 +
 +start : e+ { return $1; };
 +
 +e : m '​+'​ m { $$ = $1 + $3; }
 +     | m '​-'​ m { $$ = $1 - $3; }
 +     | m { $$ = $1; }
 +     ;
 +
 +m : f '​*'​ f { $$ = $1 * $3; }
 +  | f '/'​ f { $$ = $1 / $3; }
 +  | f { $$ = $1; }
 +  ;
 +
 +f : NUMBER { $$ = parseInt ($1); };
 +</​code>​
 +</​hidden>​
cpl-atm/laboratoare/laborator1.1382086119.txt.gz · Last modified: 2013/10/18 11:48 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