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

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

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.

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

View Full Document
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 …
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!).

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

View Full Document
4 Definition . Any set of strings over some alphabet is called a language . Alphabet itself is a language as well (the language of all
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 07/14/2011.

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