17.01.2015 Views

Course Notes on Formal Languages and Compilers

Course Notes on Formal Languages and Compilers

Course Notes on Formal Languages and Compilers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

46<br />

8. LEXICAL ANALYSIS<br />

5<br />

10<br />

15<br />

20<br />

The following example regular expressi<strong>on</strong> defines tokens of a language. It is<br />

written in a form that each line in the regular expressi<strong>on</strong> describes a<br />

different token in the language.<br />

BEGIN |<br />

END |<br />

IF |<br />

THEN |<br />

ELSE |<br />

letter (letter | digit)* |<br />

digit digit* |<br />

< |<br />

|<br />

>=<br />

The following two pages are from “Principles of Compiler Writing” by Aho<br />

<strong>and</strong> Ullman <strong>and</strong> show n<strong>on</strong>-deterministic <strong>and</strong> deterministic finite state<br />

automata for the above regular expressi<strong>on</strong>.

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

Saved successfully!

Ooh no, something went wrong!