Introduction to Languages, Grammars, and Automata, Study notes of Design and Analysis of Algorithms

An introduction to the concepts of languages, grammars, and automata. Languages are sets of strings made up of symbols from a finite alphabet. Grammars are used to generate and describe languages through productions. Automata are abstract models of digital computers that process input and produce output based on their current state and input symbol.

Typology: Study notes

2010/2011

Uploaded on 09/01/2011

visir66
visir66 🇮🇳

4.4

(74)

97 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Three Basic Concepts
Languages
Grammars
Automata
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Introduction to Languages, Grammars, and Automata and more Study notes Design and Analysis of Algorithms in PDF only on Docsity!

Three Basic Concepts

• Languages

• Grammars

• Automata

Languages

  • (^) Alphabet: a finite and nonempty set of symbols  = {a, b}
  • (^) String: finite sequence of symbols from  w = abaaa : empty string : the set of all strings on  (+^ = ^  {})

Languages

  • (^) Example 1:  = {a, b} *^ = {, a, b, aa, ab, ba, aaa, ...} L 1 = {a, aa, aab} (finite language) L 2 = {anbn^ | n  0} = {, ab, aabb, ...}

Languages

  • (^) Language concatenation: L 1 L 2 = {xy | xL 1 , yL 2 } Ln^ = L L ... L (n times) L^0 = {}

Languages

  • (^) Example 2: L = {anbn^ | n  0} L^2 = {anbnambm^ | n  0, m  0}

Languages

  • (^) Star-closure: L*^ = L^0  L^1  L^2 ...
  • (^) Positive closure: L+^ = L^1  L^2 ...

Grammars

  • (^) Formal grammar: G = (V, T, S, P) V: finite set of variables T: finite set of terminal symbols SV: start variable P: finite set of productions

Grammars

  • (^) Productions: x  y x(VT)+^ y(VT)*
  • (^) w = uxv derives z = uyv w  z w 1 *^ wn (w 1  w 2  ...  wn | w 1 = wn) w 1 +^ wn

Grammars

  • (^) Example 3: G = ({S}, {a, b}, S, P) P: S  aSb S   S  aSb  aaSbb  aabb aabb: sentence aaSbb: sentential form

Grammars

  • (^) Example 3: G = ({S}, {a, b}, S, P) P: S  aSb S  

Grammars

  • (^) Example 4: G 1 = ({A, S}, {a, b}, S, P 1 ) P 1 : S  aAb |  A  aAb | 

Grammars

  • (^) Example 4: G 1 = ({A, S}, {a, b}, S, P 1 ) P 1 : S  aAb |  A  aAb |  L(G 1 ) = {anbn^ | n  0} G and G 1 are equivalent

Grammars

  • (^) Example 5: G 2 = ({S}, {a, b}, S, P 2 ) P 2 : S  SS S   S  aSb S  bSa L(G 2 ) = {w | na(w) = nb(w)}

Automata

An abstract model of digital computer: Control unit Input file Output Storage