You are on page 1of 11

formal Language

Transparency No. 1-1

Introduction

Transparency No. 1-2

Introduction

Introduction:
Why study theory:
It provides concepts and principles to understand the nature of discipline.
It provide some immediate and important application
Automata:
A plural of automaton
To model the hardware of a computer
An automaton is construct the indispensable features of a digital computer
It accepts input and produces the output
Formal Language:
Is an abstraction of the general characteristics of programming language
It consists of set of symbol and rules of formation
Is a set of all strings permitted by the rules of formation
Formal language theory: concentrate on Grammars; it use to generate the lang
uage
Automata theory: automaton is used to accept the language
Transparency No. 1-3

Introduction

Basic Conepts:
Three basic concepts:
Language,
Grammars,
Automata
Language:
Suitable for expression of certain ideas or concepts, including set of symbols a
nd rules for their manipulation.
Formal Language:
Alphabet:
Finite and nonempty set of symbols
= {a, b, .. z}
The elements a, b, z are the alphabets
String:
Combination of the individual symbols of set.
ababa, aaab
String name:
Can provide the name for the string by alphabet
u=ababa, v= aaab
Language:
Is a collection of appropriate strings. Language is defined using an input set. I
nput set is typically denoted as . For example:
= {, 0, 00, 000, 0000,.} here language is defined as any number of
zeros. Language is formed by appropriate strings and strings are formed by alpha
bets.
Transparency No. 1-4

Introduction

Cont.,

Transparency No. 1-5

Introduction

Cont.,

Transparency No. 1-6

Introduction

Grammars:
In 1959 N Chomsky define the mathematical model of the Grammar
A Grammar is defined as a quadruple.
G = (N, T, P, S)
N finite set of Non terminals.
T finite set of terminal symbols
S start or sentence symbol
P finite set of production rules
Formation of the mathematical model:
Take the sample sentence and create the parse
tree for the sentence: the sample sentence is
the man ate the fruit .
Production Rules:
<S> <NP1> <VP>
<NP1> <ART1> <N1>
<ART1> The
<N1> Man
<VP> <V> <NP2>
<V> ate
rewritten as
<NP2> <ART2> <N2>
=> directly derives
<ART2> the
<N2> fruit
Transparency No. 1-7

Introduction

Cont.,
Derivation of Sentence using Production rule(left most derivation):
Example of
Left & Right
most
derivation will
discuss in
chapter 4

Non Terminal is rewritten as something. (Noun Parse, Verb parse etc )


Terminal it cant be rewritten as something. It is terminate the derivation
Production Rules is a heart of the grammar. It specifies the grammar transfor
ms one string to another string.
Finally the grammar is consists of non terminals, terminals, production rules and
start or sentence symbol. So N Chomsky defined the Grammar: it consists of qu
adruples.
G = ( N, T, P, S)
Transparency No. 1-8

Introduction

Discussion
Grammar Types:
1. Type 0 - Unrestricted Grammar or Parse-Structure grammar
2. Type 1 - Context Sensitive Grammar
Types of
3. Type 2 - Context Free Grammar
Grammar will
4. Type 3 - Regular Grammar
discuss in
chapter 5

<S> <NP> <VP>


Meaning of this single arrow () is left side is rewritten as right side
=>
Meaning of the double arrow ( => ) deriving from the in one step

Meaning of the double arrow star ( ) obtained from the in zero or most step
s Example:
S
The man ate the fruit
- is called reflexive transitive closure of =>

Transparency No. 1-9

Introduction

Automata
Is an abstract model of digital computer
It is used to recognize the grammars
It includes some essential features:

It will assumed that the input is a string over a given alphabet and written on the input file.
It can read the input and not change
Input files is divided in to cells and each cell can hold one symbol
It will read the left to right, it can read one symbol at a time
It can find the end of file by end of file condition
I will produce the output based on input
It has temporary storage
It has a control unit
State of control unit is determined by the
transition function
Configuration means particular state of control
unit, input and temporary storage
Transition of automata from one configuration to
next is called move
Deterministic Automata
Nondeterministic Automata
Transparency No. 1-10

Introduction

Cont.,

Deterministic Automata:
Each move is uniquely determined by the current configuration. If we know the int
ernal state, input and content of temporary storage we can predict the future behavior
of the automata.
Nondeterministic Automata:
At a point in the nondeterministic automata has several possible moves. We can pr
edict the set of possible actions cant predict the future behavior of automata.
Different Automata:
Turing Machine
Linear Bounded Automata
Pushdown Automata
Finite State Automata
Applications of Automata theory:
It plays an important role for the compiler design
To prove the correctness of the program automata theory is used
It deals with the design finite state machine
Transparency No. 1-11

You might also like