L04 - rst gave some example applications. We looked at...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2010 Lecture 4 — September 21, 2010 Patrick Lam version 1 Implementation Details for using Regular Expressions So far, we have seen NFAs, DFAs, and regular expressions. We want to execute regular expressions, but we only know how to execute NFAs and DFAs. We will use an abstract syntax tree for the regular expression, e.g. ( ac | de * ) + . + | a c d * e We will walk this tree and emit an NFA, using the following rules. When we have two regular expressions R 1 and R 2 , assume that they look like this: R 1 R 2 The rules: Literal a a Concatenation R 1 R 2 R 1 R 2 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Union R 1 | R 2 R 1 R 2 ε ε ε ε Kleene Star R * R ε ε Example: draw the finite automaton for this regular expression, (1 | 0) * 1 . Summary. Recall that our original goal was to investigate domain-specific languages for text processing. I
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rst gave some example applications. We looked at manually-written scanner code, trying to extract the what (declarations) from the how (plumbing code). We saw that we were actually implementing a nite automaton. OK, so how do we specify a nite automaton? Regular expressions! I introduced the rst syntax and semantics of a language here, the language of regular expressions. We then introduced the notions of deterministic and nondeterministic automata. NFA, DFA, and regular expressions have the same expressive power. (What does that mean, and how do you prove it?) We will now continue with real-world string manipulation languages. 2...
View Full Document

Page1 / 2

L04 - rst gave some example applications. We looked at...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online