This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: String Rewriting Systems The first step in exploring the formal aspects of programming languages is the definition of their structure or syntax . In order to accomplish this we will use a formal system known as String Rewriting System (SRS). We begin with the definition of strings over an alphabet. String Rewriting Systems Definition: [Strings over an Alphabet] 1 A finite, nonempty set will be called an alphabet if its elements are symbols , or characters (i.e., elements with“primitive” graphical representations). A finite sequence of symbols from a given alphabet will be called a string over the alphabet . A string that consists of a sequence a 1 , a 2 , . . . , a n of symbols will be denoted by the juxtaposition a 1 a 2 . . . a n . The length of some string s is denoted by  s  and assumed to equal the number of symbols in the string. Strings that have zero symbols, called empty strings , will be denoted by with   = 0. 1 Based on material from the book “An Introduction to the Theory of Computation,” Eitan Gurari, Ohio State University,Computer Science Press, 1989. String Rewriting Systems Example: Γ 1 = { a , . . . , z } and Γ 2 = { , . . . , 9 } are alphabets. abb is a string over Γ 1 , and 123 is a string over Γ 2 . ba 12 is not a string over Γ 1 , because it contains symbols that are not in Γ 1 . Similarly, 314 . . . is not a string over Γ 2 , because it is not a finite sequence. On the other hand, is a string over any alphabet. The empty set ∅ is not an alphabet because it contains no element. The set of natural numbers is not an alphabet, because it is not finite. String Rewriting Systems Definition: [Kleene Closure] Given some alphabet Γ then the set...
View
Full Document
 Spring '09
 Staff
 Formal languages, Rewriting systems, String Rewriting Systems

Click to edit the document details