You are on page 1of 7

ASSIGNMENT

TOPIC: CONTEXT SENSITIVE LANGUAGE AND ITS NORMAL FORM

CONTENTS:
1. CONTEXT SENSITIVE LANGUAGE a.Definition b.Example c.Properties 2. CONTEXT SENSITIVE GRAMMAR Defintion and example 3. KURODA NORMAL FORM a. Defintion b. Features c. Conversion of a grammar to kuroda normal form

SUBMITTED TO:
Lec. Sunny Sharma

SUBMITTED BY:
Meenakshi Dhiman MCA TYC(III) Roll no.2010 CSB 1029

CONTEXT SENSITIVE LANGUAGE AND ITS NORMAL FORM

DEFINITION : A context-sensitive language is a formal language that can be defined by a


context-sensitive grammar. A context-sensitive language is equivalent with a linear bounded nondeterministic Turing machine, also called a linear bounded automaton. That is a non-deterministic Turing machine with a tape of only kn cells, where n is the size of the input and k is a constant associated with the machine. This means that every formal language that can be decided by such a machine is a context-sensitive language, and every context-sensitive language can be decided by such a machine.

EXAMPLE:
An example of a context-sensitive language that is not context-free is L = { ap : p is a prime number }. L can be shown to be a context-sensitive language by constructing a linear bounded automaton which accepts L. The language can easily be shown to be neither regular nor context free by applying the respective pumping lemmas for each of the language classes to L.

PROPERTIES OF CONTEXT SENSITIVE LANGUAGE:


The union, intersection, and concatenation of two context-sensitive languages is context-sensitive. The complement of a context-sensitive language is itself context-sensitive. Every context-free language is context-sensitive. Membership of a string in a language defined by an arbitrary context-sensitive grammar, or by an arbitrary deterministic context-sensitive grammar, is a PSPACE-complete problem.

CONTEXT SENSITIVE GRAMMAR:


DEFIN ITION :
A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any production rules may be surrounded by a context of terminal and non-terminal symbols. Context-sensitive grammars are more general than context-free grammars but still orderly enough to be parsed by a linear bounded automaton.

The concept of context-sensitive grammar was introduced by Noam Chomsky in the 1950s as a way to describe the syntax of natural language where it is indeed often the case that a word may or may not be appropriate in a certain place depending upon the context. A formal language that can be described by a context-sensitive grammar is called a contextsensitive language.

FORMAL DEFINITION:
A context sensitive grammar or type 1 grammar G consists of four tuples (V,T,P,S) where 1. V is the finite set of variables also called non-terminals. 2. T is the finite set of symbols called terminals that form the strings of language generated by the grammar.(V T=). 3. S is the special symbol called the start variable(sV). 4. P is the finite set of rules called the production rules of the form. 5. P:A Where A is the single non terminal i.e.AV and are the strings of terminal and non-terminals . is the left context and is the right context where and (V T)*.The string and may be empty. is the non empty string of non terminals and terminals. A

EXAMPLE:
This grammar generates the canonical non-context-free language :

The generation chain for aaa bbb ccc is: S

More complicated grammars can be used to parse languages with even more letters. This language generates the non-context-free copy language,

, and other :

The generation chain for abab is: S

NORMAL FORMS FOR CONTEXT SENSITIVE LANGUAGE:


The production of the context sensitive grammar can be of the form: A Where A is the single non terminal i.e.AV and are the strings of terminal and non-terminals . is the left context and is the right context where and (V T)*.The string and may be empty. is the non empty string of non terminals and terminals. A That means the left hand side of the production rules must be equal to or less than the right hand side of the production rule. But if we impose restriction on the production rules of the

context sensitive grammar then it is said to be in normal form. The normal form in case of context sensitive grammar is KURODA NORMAL FORM.

KURODA NORMAL FORM: The Kuroda normal form is a concept of theoretical computer science , in connection with the context-sensitive languages is of interest. She is named after the linguist Sige-Yuki Kuroda named and describes a normal form of context-sensitive grammars , a subset of context-sensitive grammars, which loses over the amount of general context-sensitive grammars nothing in expressiveness. The importance of the Kuroda normal form is the very simple structure of the productions . The Kuroda normal form is a generalization of the Chomsky normal form , a normal form for context-free grammars.
DEFINITION: In formal language theory, a grammar is in Kuroda normal form if, and only if, all production rules are of the form:

AB CD or A BC or AB A where A, B, C and D are non terminal symbols and is a terminal symbol. Every grammar in Kuroda normal form is monotonic, and therefore, generates a contextsensitive language. Conversely, every context-sensitive language which does not generate the empty string can be generated by a grammar in Kuroda normal form. It is named for linguist S.Y. Kuroda.
FEATURES OF KURODA NORMAL FORM:

Every grammar in Kuroda normal form is a monotonic grammar . For each context-sensitive grammar G 1 with there exists a grammar G 2 in Kuroda normal form, which generates the same language, that is, L (G 1) = L (G 2). G 2 then also Kuroda normal form of context-sensitive grammar G is called 1.

CONVERSION OF A GRAMMAR TO KURODA NORMAL FORM :


Let G 1 = (V 1, , P 1, S) is a context-sensitive grammar = (2 V, , P 2, S) of G 1 can be constructed: . A Kuroda normal form G 2

All terminal symbols occurring in P 1 are replaced by a new variable terminal symbol a is the new productions introduced. Each production of the form be replaced by the following new productions: for all Here are Each production of the form For all For with , and . new variables.

A a,

and for each

, be replaced by the following new productions: :

all

. Here are new variables. The generated grammar is in Kuroda normal form and produces the same language as the grammar before.

You might also like