system programming introduction, Slides of Introduction to Computing

Regular Language Representation

Typology: Slides

2017/2018

Uploaded on 12/26/2018

mmelsherbiny1
mmelsherbiny1 🇪🇬

5

(2)

25 documents

1 / 79

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
System Programming
Lecture #2, #3
Language Representation
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f

Partial preview of the text

Download system programming introduction and more Slides Introduction to Computing in PDF only on Docsity!

System Programming

Lecture #2,

Language Representation

2

  • Human Languages
  • Programming Languages
  • Formal Languages

Languages

4

C, Java, Python, Prolog, Pascal,...

When is a program:

  1. syntactically correct?

  2. compilable?

  3. free from fatal exceptions at runtime?

  4. free from deadlock or infinite loops?

  5. a correct implementation of its

specification?

Programming Languages

Formal Languages Definition ---

Study of “strings of symbols,” including their

 descriptions, properties,

 generations, recognitions,

 compiling, applications, … Strings of symbols include those of

 natural languages,  computer languages,  discrete signals, …

Language Definition

Dr. Gouda

Language Definition

Dr. Gouda

Strings

 The empty string will be denoted by e

 Examples

A string over alphabet S is a finite sequence

of symbols in S.

abfbz is a string over S 1 = {a, b, c, d, …, z} 9021 is a string over S 2 = {0, 1, …, 9} ab#bc is a string over S 3 = {a, b, …, z, #} ))()(() is a string over S 4 = {(, )}

Languages

 Languages can be used to describe problems

with “yes/no” answers, for example:

A language is a set of strings over an alphabet.

L 1 = The set of all strings over S 1 that contain the substring “fool” L 2 = The set of all strings over S 2 that are divisible by 7 = {7, 14, 21, …} L 3 = The set of all strings of the form s#s where s is any string over {a, b, …, z} L 4 = The set of all strings over S 4 where every ( can be matched with a subsequent )

EXAMPLE 1 The language defined by the expression aba language (aba) = {aa aba abba abbba abbbba ...}**

EXAMPLE 2 The language of the expression ab language(ab) = {λ a b aa ab bb aaa aab abb bbb aaaa ...} we should be very careful to observe that ab ≠ (ab)***

EXAMPLE 3 Consider the language T defined over the alphabet Σ = {a, b, c} T = {a c ab cb abb cbb abbb cbbb abbbb cbbbb ...} T = language ((a + c)b) = language (either a or c then some b's)*

EXAMPLES 1- Consider a finite language L that contains all the strings of a's and b's of length exactly three. L = {aaa aab aba abb baa bab bba bbb} we may write L = language ((a + b)(a + b)(a + b)) or for short, L = language ((a + b)^3 ) 2- The set of all possible strings of a's and b's of any length whatsoever we could write, (a + b)*

3- We can describe all words that begin with the letter a simply as: a(a + b) 4- All words that begin with an a and end with a b can be defined by the expression a(a + b)b = a (arbitrary string) b**

Definition

 For primitive regular expressions:

L() =

L(λ ) = {λ}

L(a) = {a}