lect18_1

lect18_1 - Strings A string over a set A is a finite...

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

View Full Document Right Arrow Icon
1 Strings A string over a set A is a finite sequence of elements from A. Definition. An alphabet is a nonempty, finite set of indivisible symbols. We are going to denote it by Σ . Any program is a string of keywords, variable names, and permissible symbols. The set of elements from which the strings are built is called an alphabet. A programming language should satisfy general rules (grammar) to be understood by computer (compiler). These rules are studied by the formal theory of programming languages.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Definition . A string w over an alphabet Σ is a sequence of symbols, w = a 1 a 2 a n , where each a i Σ , 1 i n. The number of symbols is called the length of the string, | w |= n . There is one special string that has zero length (contains no symbol It is called the empty string and has special notation , λ . | w |=0 w = λ . λ is not an element of any alphabet, λ∉ Σ . Example. Let Σ = { a , bb, c }. Find all possible strings with length less or equal 3 built from Σ . Length 0: λ Length 1: a bb c Length 2: aa abb ac bba bbbb bbc ca cbb cc Length 3: aaa aabb aac abba abbbb abbc aca acbb …
Background image of page 2
3 Two strings u and v can be concatenated to form a single string uv , that consists of the symbols of string u , followed by symbols of of string v . The length | uv | = | u|+| v |. λ u = u λ = u Concatenation is associative: ( uv ) w = u ( vw ), but not commutative: uv vu (the order is important!).
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Definition . Any set of strings over some alphabet is called a language . Alphabet itself is a language as well (the language of all
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

lect18_1 - Strings A string over a set A is a finite...

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

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