12.01.2013 Views

Tutorial Lex/Yacc - capsl

Tutorial Lex/Yacc - capsl

Tutorial Lex/Yacc - capsl

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Lex</strong>eme Token Type<br />

2 Number<br />

Simple Example Grammar<br />

+ Addition Operator<br />

2 Number<br />

- Subtraction Operator<br />

1 Number<br />

E � E + E<br />

� E - E<br />

� E * E<br />

� E / E<br />

� id<br />

Suppose we had the following tokens:<br />

2 + 2 - 1<br />

2/17/2012<br />

Next it will match<br />

one of the rules<br />

based on the next<br />

token because the<br />

parser know 2 is an<br />

expression.<br />

CAPSL<br />

37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!