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 />

We start by parsing<br />

from the left. We<br />

find that we have an<br />

id.<br />

CAPSL<br />

35

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

Saved successfully!

Ooh no, something went wrong!