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

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

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

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

View Full Document
Union R 1 | R 2 R 1 R 2 ε ε ε ε Kleene Star R * R ε ε Example: draw the ﬁnite automaton for this regular expression, (1 | 0) * 1 . Summary. Recall that our original goal was to investigate domain-speciﬁc languages for text processing. I
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online