20100902 - Both the above formalisms lead to algorithms for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
============================ CS 441 Fall 2010 -- JWJ Pre-class notes - do not distribute Thursday, September 2, 2010 ============================ Scope: ------ Regular expressions and Nondeterministic Finite State Automata. Thompson's construction. Outline: ------- Concepts and definitions: There are two theoretical pillars that support good practices of developing lexical analyzers: formalism for describing patterns and formalism for accepting strings (matching them with patterns). Describing patterns: for typical programming languages lexical definitions of tokens place them in a specific language category -- namely, regular languages. This gives us an immediate access to numerous formalisms such as regular expressions (RegEx) or Regular Grammars. On the other side, of acceptors, the regularity of the language for typical tokens gives us access to the Finite State machine formalism.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Both the above formalisms lead to algorithms for constructing acceptors, or lexical analyzers, provided that we have well-defined tokens, for example with RegExs. One of such algorithms is due to Thompson [and also McNathon and Yamada] (see Section 3.7.4) Instance: a regular expression r Question: what is a NFA M that accepts L(r)? (i.e., L(r) = M(r)) Examples:-------Regular definition for numbers (see our textbook). Regular expression for dates (such as Sep 2, 2010, 2010-09-02, 09/02/2010) Regular expression for well-formed e-mail addresses (defined in RFC 5322). Finite automata for various sets of binary numbers. Assignments:---------See the class Web-page for hw2 and for practice (not hw) pertaining to RegEx, Thompson's construction. Similarly, see the course Web-page for a programming assignment....
View Full Document

This document was uploaded on 12/14/2010.

Ask a homework question - tutors are online