22. Reg Expr

22. Reg Expr - Maggie Johnson Handout#22 CS103B...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Maggie Johnson Handout #22 CS103B Languages & Regular Expressions Key Topics * Theory of Formal Languages * Some Definitions * Regular Expressions * Inductions in Formal Languages * Other Proofs for Regular Expressions ______________________________________________________________________ Theory of Formal Languages In the English language, we distinguish between three different identities: letter, word, sentence. There is a certain parallelism between the fact that a group of letters make up a word and a group of words make up a sentence. Not all collections of letters form valid words, and not all collections of words form valid sentences. This situation also exists with programming languages. Certain strings are recognizable words (FOR, WHILE, IF...). Certain strings of words are valid sentences in a programming language. These sentences together form a valid program. To construct a general language theory that unifies all these examples, it is necessary to adopt a definition of a "universal language structure", i.e, a structure in which the decision of whether a given string of units constitute a valid larger unit is not a matter of guesswork, but is based on explicitly stated rules. The study of such a set of rules operating on a set of symbols is called the Theory of Formal Languages . "Formal" in this sense refers to the fact that all the rules for creating valid structures in the language are explicitly stated in terms of what strings of symbols can occur. We are interested in the FORM of the string of symbols, not the meaning. So, our study of formal languages is concerned with language not as a method of communication, but as a valid sequence of symbols generated from the application of formal rules. This topic is important because we are now starting to study abstract machine models to get a better idea of what computers can and cannot do. All computers require a program to operate, and all programs are written in some language. The first step in understanding abstract machine models is to study the language structures that the machines can and cannot accept as input, and how the machine operates on this input. Formal language theory forms the basis for programming languages and compiler construction. Some Definitions 1) Symbol : this is an abstract entity that we shall not define formally (just as "point" and "line" are note defined in geometry). Letters, digits and punctuation are examples of symbols. 2) An alphabet is a finite set of symbols out of which we build larger structures. An alphabet is typically denoted using the Greek sigma S, e.g., S = {0,1}. 3) String: a finite sequence of symbols from a particular alphabet juxtaposed. For example: a, b, c, are symbols and abcb is a string....
View Full Document

This note was uploaded on 10/01/2011 for the course CS 103B taught by Professor Sahami,m during the Winter '08 term at Stanford.

Page1 / 7

22. Reg Expr - Maggie Johnson Handout#22 CS103B...

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

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