SlideShare a Scribd company logo
1 of 11
Download to read offline
EDUCATION HOLE PRESENTS
2014
www.edhole.com
Introduction to defining language........................................................................................... 2
Recognized language ............................................................................................................................................3
Recognizable languages........................................................................................................................................3
Keene closures......................................................................................................................... 3
Definition and notation.........................................................................................................................................4
Kleene plus............................................................................................................................................................4
Grammar................................................................................................................................. 4
The syntax of grammars...................................................................................................................5
Finite-State Automata......................................................................................................................6
Chomsky hierarchy .................................................................................................................. 7
Context-free grammars ....................................................................................................................7
Regular grammars.................................................................................................................................................8
Other forms of generative grammars ...............................................................................................8
Recursive grammars .............................................................................................................................................9
Transition graph...................................................................................................................... 9
Generalized transition graph................................................................................................. 10
Introduction to defining language
An automaton is supposed to run on some given sequence of inputs in discrete time steps. An
automaton gets one input every time step that is picked up from a set of symbols or letters, which
is called an alphabet. At any time, the symbols so far fed to the automaton as input form a finite
sequence of symbols, which is called a word. An automaton contains a finite set of states. At
each instance in time of some run, the automaton is in one of its states. At each time step when
the automaton reads a symbol, it jumps or transitions to another state that is decided by a
function that takes the current state and symbol as parameters. This function is called the
transition function. The automaton reads the symbols of the input word one after another and
transitions from state to state according to the transition function, until the word is read
completely. Once the input word has been read, the automaton is said to have stopped and the
state at which automaton has stopped is called the final state. Depending on the final state, it's
said that the automaton either accepts or rejects an input word. There is a subset of states of the
automaton, which is defined as the set of accepting states. If the final state is an accepting state,
then the automaton accepts the word. Otherwise, the word is rejected. The set of all the words
accepted by an automaton is called the language recognized by the automaton.
A deterministic finite automaton is represented formally by a 5-tuple (Q,Σ,δ,q0,F), where:
• Q is a finite set of states.
• Σ is a finite set of symbols, called the alphabet of the automaton.
• δ is the transition function, that is, δ: Q × Σ → Q.
• q0 is the start state, that is, the state of the automaton before any input has been
processed, where q0∈ Q.
• F is a set of states of Q (i.e. F⊆Q) called accept states.
Recognized language
An automaton can recognize a formal language. The language L ⊆ Σ* recognized by an
automaton is the set of all the words that are accepted by the automaton.
Recognizable languages
The recognizable languages are the set of languages that are recognized by some automaton. For
the above definition of automata the recognizable languages are regular languages. For different
definitions of automata, the recognizable languages are different.
Keene closures
In mathematical logic and computer science, the Kleene star (or Kleene operator or Kleene
closure) is a unary operation, either on sets of strings or on sets of symbols or characters. In
mathematics it is more commonly known as the free monoid construction. The application of the
Kleene star to a set V is written as V*
. It is widely used for regular expressions, which is the
context in which it was introduced by Stephen Kleene to characterise certain automata, where it
means "zero or more".
1. If V is a set of strings then V*
is defined as the smallest superset of V that contains the
empty string ε and is closed under the string concatenation operation.
2. If V is a set of symbols or characters then V*
is the set of all strings over symbols in V,
including the empty string.
The set V*
can also be described as the set of finite-length strings that can be generated by
concatenating arbitrary elements of V allowing the use of the same element multiple times. If V
is a nonempty finite set then V*
is a countably infinite set.
Definition and notation
Given a set V define
V0 = { ε } (the language consisting only of the empty string),
V1 = V
and define recursively the set
Vi+1 = { wv : w ∈ Vi and v ∈ V } for each i>0.
If V is a formal language, then Vi, the i-th power of the set V, is a shorthand for the
concatenation of set V with itself i times. That is, Vi can be understood to be the set of all strings
that can be represented as the concatenation of i strings in V.
The definition of Kleene star on V is[2]
Kleene plus
In some formal language studies, (e.g. AFL Theory) a variation on the Kleene star operation
called the Kleene plus is used. The Kleene plus omits the V0 term in the above union. In other
words, the Kleene plus on V is
For every set L, the Kleene plus L+
equals the concatenation of L with L*
. Conversely, L*
can be
written as { ε } ∪ L+
.
Grammar
A formal grammar is a set of rules for rewriting strings, along with a "start symbol" from which
rewriting starts. Therefore, a grammar is usually thought of as a language generator. However, it
can also sometimes be used as the basis for a "recognizer"—a function in computing that
determines whether a given string belongs to the language or is grammatically incorrect. To
describe such recognizers, formal language theory uses separate formalisms, known as automata
theory. One of the interesting results of automata theory is that it is not possible to design a
recognizer for certain formal languages. Parsing is the process of recognizing an utterance (a
string in natural languages) by breaking it down to a set of symbols and analyzing each one
against the grammar of the language. Most languages have the meanings of their utterances
structured according to their syntax—a practice known as compositional semantics. As a result,
the first step to describing the meaning of an utterance in language is to break it down part by
part and look at its analyzed form (known as its parse tree in computer science, and as its deep
structure in generative grammar).
The syntax of grammars
In the classic formalization of generative grammars first proposed by Noam Chomsky in the
1950s, a grammar G consists of the following components:
• A finite set N of nonterminal symbols, that is disjoint with the strings formed from G.
• A finite set of terminal symbols that is disjoint from N.
• A finite set P of production rules, each rule of the form
where is the Kleene star operator and denotes set union. That is, each production rule
maps from one string of symbols to another, where the first string (the "head") contains
an arbitrary number of symbols provided at least one of them is a nonterminal. In the case
that the second string (the "body") consists solely of the empty string – i.e., that it
contains no symbols at all – it may be denoted with a special notation (often , e or ) in
order to avoid confusion.
• A distinguished symbol that is the start symbol, also called the sentence symbol.
A grammar is formally defined as the tuple . Such a formal grammar is often
called a rewriting system or a phrase structure grammar in the literature.
Example
start symbol = S
non-terminals = {S}
terminals = {a, b}
production rules: S → aSb, S → ba
S → aSb → abab
S → aSb → aaSbb → aababb
L = {abab, aababb, ...}
As in purely mathematical automata, grammar automata can produce a wide variety of complex
languages from only a few symbols and a few production rules. Chomsky's hierarchy defines
four nested classes of languages, where the more precise aclasses have stricter limitations on
their grammatical production rules.
The formality of automata theory can be applied to the analysis and manipulation of actual
human language as well as the development of human-computer interaction (HCI) and artificial
intelligence (AI).
Finite-State Automata
A finite-state transducer whose output components are ignored is called a finite-state automaton.
Formally, a finite-state automaton M is a tuple <Q, , , q0, F>, where Q, , q0, and F are
defined as for finite-state transducers, and the transition table is a relation from Q × ( { }) to
Q.
Transition diagrams similar to those used for representing finite-state transducers can also be
used to represent finite-state automata. The only difference is that in the case of finite-state
automata, an edge that corresponds to a transition rule (p, , p) is labeled by the string .
Example 2.3.1 The finite-state automaton that is induced by the finite-state transducer of
Figure 2.2.2 is <Q, , , q0, F>, where Q = {q0, q1}, = {a, b}, = {(q0, a, q1), (q0, b, q1), (q1, b,
q1), (q1, a, q0)}, and F = {q0}.
The transition diagram in Figure 2.3.1 represents the finite-state automaton.
Figure
2.3.1
A finite-state automaton that corresponds to the finite-state transducer of
Figure 2.2.2.
The finite-state automaton M is said to be deterministic if, for each state q in Q and for each
input symbol a in , the union (q, a) (q, ) is a multiset that contains at most one element.
The finite-state automaton is said to be nondeterministic if it is not a deterministic finite-state
automaton. A transition rule (q, , p) of the finite-state automaton is said to be an transition rule
if = . A finite-state automaton with no transition rules is said to be an -free finite-state
automaton.
Chomsky hierarchy
When Noam Chomsky first formalized generative grammars in 1956, he classified them into
types now known as the Chomsky hierarchy. The difference between these types is that they
have increasingly strict production rules and can express fewer formal languages. Two important
types are context-free grammars (Type 2) and regular grammars (Type 3). The languages that
can be described with such a grammar are called context-free languages and regular languages,
respectively. Although much less powerful than unrestricted grammars (Type 0), which can in
fact express any language that can be accepted by a Turing machine, these two restricted types of
grammars are most often used because parsers for them can be efficiently implemented. For
example, all regular languages can be recognized by a finite state machine, and for useful subsets
of context-free grammars there are well-known algorithms to generate efficient LL parsers and
LR parsers to recognize the corresponding languages those grammars generate.
Context-free grammars
A context-free grammar is a grammar in which the left-hand side of each production rule
consists of only a single no terminal symbol. This restriction is non-trivial; not all languages can
be generated by context-free grammars. Those that can are called context-free languages.
The language defined above is not a context-free language, and
this can be strictly proven using the pumping lemma for context-free languages, but for example
the language (at least 1 followed by the same number of 's) is context-free,
as it can be defined by the grammar with , , the start symbol, and
the following production rules:
1.
2.
A context-free language can be recognized in time (see Big O notation) by an algorithm
such as Earley's algorithm. That is, for every context-free language, a machine can be built that
takes a string as input and determines in time whether the string is a member of the
language, where is the length of the string.[7]
Deterministic context-free languages is a subset
of context-free languages that can be recognized in linear time. There exist various algorithms
that target either this set of languages or some subset of it.
Regular grammars
In regular grammars, the left hand side is again only a single no terminal symbol, but now the
right-hand side is also restricted. The right side may be the empty string, or a single terminal
symbol, or a single terminal symbol followed by a no terminal symbol, but nothing else.
(Sometimes a broader definition is used: one can allow longer strings of terminals or single no
terminals without anything else, making languages easier to denote while still defining the same
class of languages.)
The language defined above is not regular, but the language
(at least 1 followed by at least 1 , where the numbers may be
different) is, as it can be defined by the grammar with , ,
the start symbol, and the following production rules:
1.
2.
3.
4.
5.
All languages generated by a regular grammar can be recognized in linear time by a finite state
machine. Although, in practice, regular grammars are commonly expressed using regular
expressions, some forms of regular expression used in practice do not strictly generate the
regular languages and do not show linear recognition performance due to those deviations.
Other forms of generative grammars
Many extensions and variations on Chomsky's original hierarchy of formal grammars have been
developed, both by linguists and by computer scientists, usually either in order to increase their
expressive power or in order to make them easier to analyze or parse. Some forms of grammars
developed include:
• Tree-adjoining grammars increase the expressiveness of conventional generative
grammars by allowing rewrite rules to operate on parse trees instead of just strings.
• Affix grammars and attribute grammars allow rewrite rules to be augmented with
semantic attributes and operations, useful both for increasing grammar expressiveness
and for constructing practical language translation tools.
Recursive grammars
A recursive grammar is a grammar which contains production rules that are recursive. For
example, a grammar for a context-free language is left-recursive if there exists a non-terminal
symbol A that can be put through the production rules to produce a string with A as the leftmost
symbol. All types of grammars in the Chomsky hierarchy can be recursive.
Transition graph
Transition diagram for a finite state machine modeling a turnstile, a common introductory
example used to explain state machines. The turnstile has two states, Locked and Unlocked.
There are two inputs affecting the state: depositing a coin in the turnstile, coin, and pushing on
the turnstile’s bar, pushes. The turnstile bar is initially locked, and pushing on it has no effect.
Putting a coin in changes the state to Unlocked unlocking the bar so it can turn. A customer
pushing through the turnstile changes the state back to Locked so additional customers can't get
through until another coin is deposited. The arrow into the Locked node from the black dot
indicates it is the initial state.
 Deterministic: For a given current state and an input symbol, if an automaton can only
jump to one and only one state then it is a deterministic automaton.
 Nondeterministic: An automaton that, after reading an input symbol, may jump into any
of a number of states, as licensed by its transition relation. Notice that the term transition
function is replaced by transition relation: The automaton non-deterministically decides
to jump into one of the allowed choices. Such automata are called nondeterministic
automata.
 Alternation: This idea is quite similar to tree automaton, but orthogonal. The automaton
may run its multiple copies on the same next read symbol. Such automata are called
alternating automata. Acceptance condition must satisfy all runs of such copies to accept
the input.
Generalized transition graph
A finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state
machine, is a mathematical model of computation used to design both computer programs and
sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite
number of states. The machine is in only one state at a time; the state it is in at any given time is
called the current state. It can change from one state to another when initiated by a triggering
event or condition; this is called a transition. A particular FSM is defined by a list of its states,
and the triggering condition for each transition. The behavior of state machines can be observed
in many devices in modern society which perform a predetermined sequence of actions
depending on a sequence of events with which they are presented. Simple examples are vending
machines which dispense products when the proper combination of coins is deposited, elevators
which drop riders off at upper floors before going down, traffic lights which change sequence
when cars are waiting, and combination locks which require the input of combination numbers in
the proper order. Finite-state machines can model a large number of problems, among which are
electronic design automation, communication protocol design, language parsing and other
engineering applications. In biology and artificial intelligence research, state machines or
hierarchies of state machines have been used to describe neurological systems and in
linguistics—to describe the grammars of natural languages. Considered as an abstract model of
computation, the finite state machine is weak; it has less computational power than some other
models of computation such as the Turing machine.[1]
That is, there are tasks which no FSM can
do, but some Turing machines can. This is because the FSM has limited memory. The memory is
limited by the number of states.
Transition diagram for a finite state machine modeling a turnstile, a common introductory
example used to explain state machines. The turnstile has two states, Locked and Unlocked.
There are two inputs effecting the state: depositing a coin in the turnstile, coin, and pushing on
the turnstile's bar, push. The turnstile bar is initially locked, and pushing on it has no effect.
Putting a coin in changes the state to Unlocked unlocking the bar so it can turn. A customer
pushing through the turnstile changes the state back to Locked so additional customers can't get
through until another coin is deposited. The arrow into the Locked node from the black dot
indicates it is the initial state.

More Related Content

What's hot

Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of LanguageDipankar Boruah
 
Word level language identification in code-switched texts
Word level language identification in code-switched textsWord level language identification in code-switched texts
Word level language identification in code-switched textsHarsh Jhamtani
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingHemantha Kulathilake
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishHemantha Kulathilake
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsCS, NcState
 
NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar Hemantha Kulathilake
 
A new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageA new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageRyoma Sin'ya
 
Ldml - public
Ldml - publicLdml - public
Ldml - publicseanscon
 
A course on mathematical logic
A course on mathematical logicA course on mathematical logic
A course on mathematical logicSpringer
 
Ilja state2014expressivity
Ilja state2014expressivityIlja state2014expressivity
Ilja state2014expressivitymaartenmarx
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfDrIsikoIsaac
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelHemantha Kulathilake
 

What's hot (18)

Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Word level language identification in code-switched texts
Word level language identification in code-switched textsWord level language identification in code-switched texts
Word level language identification in code-switched texts
 
NLP_KASHK:POS Tagging
NLP_KASHK:POS TaggingNLP_KASHK:POS Tagging
NLP_KASHK:POS Tagging
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological Parsing
 
NLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for EnglishNLP_KASHK:Context-Free Grammar for English
NLP_KASHK:Context-Free Grammar for English
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause Grammars
 
NLP_KASHK:Morphology
NLP_KASHK:MorphologyNLP_KASHK:Morphology
NLP_KASHK:Morphology
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
 
NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar NLP_KASHK:Parsing with Context-Free Grammar
NLP_KASHK:Parsing with Context-Free Grammar
 
A new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a languageA new technique for proving non regularity based on the measure of a language
A new technique for proving non regularity based on the measure of a language
 
Ldml - public
Ldml - publicLdml - public
Ldml - public
 
A course on mathematical logic
A course on mathematical logicA course on mathematical logic
A course on mathematical logic
 
NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions NLP_KASHK:Regular Expressions
NLP_KASHK:Regular Expressions
 
Ilja state2014expressivity
Ilja state2014expressivityIlja state2014expressivity
Ilja state2014expressivity
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdf
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
NLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language ModelNLP_KASHK:Evaluating Language Model
NLP_KASHK:Evaluating Language Model
 

Viewers also liked

Viewers also liked (9)

Dada hirak jayanti
Dada hirak jayantiDada hirak jayanti
Dada hirak jayanti
 
Laboratorio 1
Laboratorio 1Laboratorio 1
Laboratorio 1
 
Spring 2014 4th Meeting
Spring 2014 4th MeetingSpring 2014 4th Meeting
Spring 2014 4th Meeting
 
Welcome
WelcomeWelcome
Welcome
 
A-C Tooling
A-C ToolingA-C Tooling
A-C Tooling
 
Unit 4.6
Unit 4.6Unit 4.6
Unit 4.6
 
Network graphs n’at
Network graphs n’atNetwork graphs n’at
Network graphs n’at
 
Siddhartha
SiddharthaSiddhartha
Siddhartha
 
Mod
ModMod
Mod
 

Similar to Free Ebooks Download ! Edhole

INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptLamhotNaibaho3
 
Lecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdfLecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdfDeptii Chaudhari
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammarmeresie tesfay
 
ChomskyPresentation.pdf
ChomskyPresentation.pdfChomskyPresentation.pdf
ChomskyPresentation.pdfNiteshJaypal
 
Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfDeptii Chaudhari
 
Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsRosnaPHaroon
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithmsRaghu nath
 
Formal language
Formal languageFormal language
Formal languageRajendran
 
7. ku gr.sem 2013: Syntax
7. ku gr.sem 2013: Syntax7. ku gr.sem 2013: Syntax
7. ku gr.sem 2013: SyntaxTikaram Poudel
 
contextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdfcontextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdfry54321288
 
01-Introduction&Languages.pdf
01-Introduction&Languages.pdf01-Introduction&Languages.pdf
01-Introduction&Languages.pdfTariqSaeed80
 
A language can be seen as a system suitable for expression of certai.pdf
A language can be seen as a system suitable for expression of certai.pdfA language can be seen as a system suitable for expression of certai.pdf
A language can be seen as a system suitable for expression of certai.pdfanudamobileshopee
 
MorphologyAndFST.pdf
MorphologyAndFST.pdfMorphologyAndFST.pdf
MorphologyAndFST.pdfssuser97943d
 
ToC_M1L3_Grammar and Derivation.pdf
ToC_M1L3_Grammar and Derivation.pdfToC_M1L3_Grammar and Derivation.pdf
ToC_M1L3_Grammar and Derivation.pdfjaishreemane73
 
A statistical model for morphology inspired by the Amis language
A statistical model for morphology inspired by the Amis languageA statistical model for morphology inspired by the Amis language
A statistical model for morphology inspired by the Amis languageIJwest
 
A Statistical Model for Morphology Inspired by the Amis Language
A Statistical Model for Morphology Inspired by the Amis LanguageA Statistical Model for Morphology Inspired by the Amis Language
A Statistical Model for Morphology Inspired by the Amis Languagedannyijwest
 

Similar to Free Ebooks Download ! Edhole (20)

INFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.pptINFO-2950-Languages-and-Grammars.ppt
INFO-2950-Languages-and-Grammars.ppt
 
Lecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdfLecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdf
 
FLAT Notes
FLAT NotesFLAT Notes
FLAT Notes
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
ChomskyPresentation.pdf
ChomskyPresentation.pdfChomskyPresentation.pdf
ChomskyPresentation.pdf
 
Lecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdfLecture Notes-Finite State Automata for NLP.pdf
Lecture Notes-Finite State Automata for NLP.pdf
 
Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering students
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithms
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Formal language
Formal languageFormal language
Formal language
 
7. ku gr.sem 2013: Syntax
7. ku gr.sem 2013: Syntax7. ku gr.sem 2013: Syntax
7. ku gr.sem 2013: Syntax
 
Grammar Syntax(1).pptx
Grammar Syntax(1).pptxGrammar Syntax(1).pptx
Grammar Syntax(1).pptx
 
contextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdfcontextfreegrammars-120925004035-phpapp02.pdf
contextfreegrammars-120925004035-phpapp02.pdf
 
01-Introduction&Languages.pdf
01-Introduction&Languages.pdf01-Introduction&Languages.pdf
01-Introduction&Languages.pdf
 
A language can be seen as a system suitable for expression of certai.pdf
A language can be seen as a system suitable for expression of certai.pdfA language can be seen as a system suitable for expression of certai.pdf
A language can be seen as a system suitable for expression of certai.pdf
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
MorphologyAndFST.pdf
MorphologyAndFST.pdfMorphologyAndFST.pdf
MorphologyAndFST.pdf
 
ToC_M1L3_Grammar and Derivation.pdf
ToC_M1L3_Grammar and Derivation.pdfToC_M1L3_Grammar and Derivation.pdf
ToC_M1L3_Grammar and Derivation.pdf
 
A statistical model for morphology inspired by the Amis language
A statistical model for morphology inspired by the Amis languageA statistical model for morphology inspired by the Amis language
A statistical model for morphology inspired by the Amis language
 
A Statistical Model for Morphology Inspired by the Amis Language
A Statistical Model for Morphology Inspired by the Amis LanguageA Statistical Model for Morphology Inspired by the Amis Language
A Statistical Model for Morphology Inspired by the Amis Language
 

More from Edhole.com

Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbaiEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 

More from Edhole.com (20)

Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbai
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 

Recently uploaded

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

Free Ebooks Download ! Edhole

  • 2. Introduction to defining language........................................................................................... 2 Recognized language ............................................................................................................................................3 Recognizable languages........................................................................................................................................3 Keene closures......................................................................................................................... 3 Definition and notation.........................................................................................................................................4 Kleene plus............................................................................................................................................................4 Grammar................................................................................................................................. 4 The syntax of grammars...................................................................................................................5 Finite-State Automata......................................................................................................................6 Chomsky hierarchy .................................................................................................................. 7 Context-free grammars ....................................................................................................................7 Regular grammars.................................................................................................................................................8 Other forms of generative grammars ...............................................................................................8 Recursive grammars .............................................................................................................................................9 Transition graph...................................................................................................................... 9 Generalized transition graph................................................................................................. 10 Introduction to defining language An automaton is supposed to run on some given sequence of inputs in discrete time steps. An automaton gets one input every time step that is picked up from a set of symbols or letters, which is called an alphabet. At any time, the symbols so far fed to the automaton as input form a finite sequence of symbols, which is called a word. An automaton contains a finite set of states. At each instance in time of some run, the automaton is in one of its states. At each time step when the automaton reads a symbol, it jumps or transitions to another state that is decided by a function that takes the current state and symbol as parameters. This function is called the transition function. The automaton reads the symbols of the input word one after another and transitions from state to state according to the transition function, until the word is read completely. Once the input word has been read, the automaton is said to have stopped and the state at which automaton has stopped is called the final state. Depending on the final state, it's said that the automaton either accepts or rejects an input word. There is a subset of states of the
  • 3. automaton, which is defined as the set of accepting states. If the final state is an accepting state, then the automaton accepts the word. Otherwise, the word is rejected. The set of all the words accepted by an automaton is called the language recognized by the automaton. A deterministic finite automaton is represented formally by a 5-tuple (Q,Σ,δ,q0,F), where: • Q is a finite set of states. • Σ is a finite set of symbols, called the alphabet of the automaton. • δ is the transition function, that is, δ: Q × Σ → Q. • q0 is the start state, that is, the state of the automaton before any input has been processed, where q0∈ Q. • F is a set of states of Q (i.e. F⊆Q) called accept states. Recognized language An automaton can recognize a formal language. The language L ⊆ Σ* recognized by an automaton is the set of all the words that are accepted by the automaton. Recognizable languages The recognizable languages are the set of languages that are recognized by some automaton. For the above definition of automata the recognizable languages are regular languages. For different definitions of automata, the recognizable languages are different. Keene closures In mathematical logic and computer science, the Kleene star (or Kleene operator or Kleene closure) is a unary operation, either on sets of strings or on sets of symbols or characters. In mathematics it is more commonly known as the free monoid construction. The application of the Kleene star to a set V is written as V* . It is widely used for regular expressions, which is the context in which it was introduced by Stephen Kleene to characterise certain automata, where it means "zero or more". 1. If V is a set of strings then V* is defined as the smallest superset of V that contains the empty string ε and is closed under the string concatenation operation. 2. If V is a set of symbols or characters then V* is the set of all strings over symbols in V, including the empty string. The set V* can also be described as the set of finite-length strings that can be generated by concatenating arbitrary elements of V allowing the use of the same element multiple times. If V is a nonempty finite set then V* is a countably infinite set.
  • 4. Definition and notation Given a set V define V0 = { ε } (the language consisting only of the empty string), V1 = V and define recursively the set Vi+1 = { wv : w ∈ Vi and v ∈ V } for each i>0. If V is a formal language, then Vi, the i-th power of the set V, is a shorthand for the concatenation of set V with itself i times. That is, Vi can be understood to be the set of all strings that can be represented as the concatenation of i strings in V. The definition of Kleene star on V is[2] Kleene plus In some formal language studies, (e.g. AFL Theory) a variation on the Kleene star operation called the Kleene plus is used. The Kleene plus omits the V0 term in the above union. In other words, the Kleene plus on V is For every set L, the Kleene plus L+ equals the concatenation of L with L* . Conversely, L* can be written as { ε } ∪ L+ . Grammar A formal grammar is a set of rules for rewriting strings, along with a "start symbol" from which rewriting starts. Therefore, a grammar is usually thought of as a language generator. However, it can also sometimes be used as the basis for a "recognizer"—a function in computing that determines whether a given string belongs to the language or is grammatically incorrect. To describe such recognizers, formal language theory uses separate formalisms, known as automata theory. One of the interesting results of automata theory is that it is not possible to design a
  • 5. recognizer for certain formal languages. Parsing is the process of recognizing an utterance (a string in natural languages) by breaking it down to a set of symbols and analyzing each one against the grammar of the language. Most languages have the meanings of their utterances structured according to their syntax—a practice known as compositional semantics. As a result, the first step to describing the meaning of an utterance in language is to break it down part by part and look at its analyzed form (known as its parse tree in computer science, and as its deep structure in generative grammar). The syntax of grammars In the classic formalization of generative grammars first proposed by Noam Chomsky in the 1950s, a grammar G consists of the following components: • A finite set N of nonterminal symbols, that is disjoint with the strings formed from G. • A finite set of terminal symbols that is disjoint from N. • A finite set P of production rules, each rule of the form where is the Kleene star operator and denotes set union. That is, each production rule maps from one string of symbols to another, where the first string (the "head") contains an arbitrary number of symbols provided at least one of them is a nonterminal. In the case that the second string (the "body") consists solely of the empty string – i.e., that it contains no symbols at all – it may be denoted with a special notation (often , e or ) in order to avoid confusion. • A distinguished symbol that is the start symbol, also called the sentence symbol. A grammar is formally defined as the tuple . Such a formal grammar is often called a rewriting system or a phrase structure grammar in the literature. Example start symbol = S non-terminals = {S} terminals = {a, b} production rules: S → aSb, S → ba S → aSb → abab S → aSb → aaSbb → aababb L = {abab, aababb, ...}
  • 6. As in purely mathematical automata, grammar automata can produce a wide variety of complex languages from only a few symbols and a few production rules. Chomsky's hierarchy defines four nested classes of languages, where the more precise aclasses have stricter limitations on their grammatical production rules. The formality of automata theory can be applied to the analysis and manipulation of actual human language as well as the development of human-computer interaction (HCI) and artificial intelligence (AI). Finite-State Automata A finite-state transducer whose output components are ignored is called a finite-state automaton. Formally, a finite-state automaton M is a tuple <Q, , , q0, F>, where Q, , q0, and F are defined as for finite-state transducers, and the transition table is a relation from Q × ( { }) to Q. Transition diagrams similar to those used for representing finite-state transducers can also be used to represent finite-state automata. The only difference is that in the case of finite-state automata, an edge that corresponds to a transition rule (p, , p) is labeled by the string . Example 2.3.1 The finite-state automaton that is induced by the finite-state transducer of Figure 2.2.2 is <Q, , , q0, F>, where Q = {q0, q1}, = {a, b}, = {(q0, a, q1), (q0, b, q1), (q1, b, q1), (q1, a, q0)}, and F = {q0}. The transition diagram in Figure 2.3.1 represents the finite-state automaton. Figure 2.3.1 A finite-state automaton that corresponds to the finite-state transducer of Figure 2.2.2. The finite-state automaton M is said to be deterministic if, for each state q in Q and for each input symbol a in , the union (q, a) (q, ) is a multiset that contains at most one element. The finite-state automaton is said to be nondeterministic if it is not a deterministic finite-state automaton. A transition rule (q, , p) of the finite-state automaton is said to be an transition rule
  • 7. if = . A finite-state automaton with no transition rules is said to be an -free finite-state automaton. Chomsky hierarchy When Noam Chomsky first formalized generative grammars in 1956, he classified them into types now known as the Chomsky hierarchy. The difference between these types is that they have increasingly strict production rules and can express fewer formal languages. Two important types are context-free grammars (Type 2) and regular grammars (Type 3). The languages that can be described with such a grammar are called context-free languages and regular languages, respectively. Although much less powerful than unrestricted grammars (Type 0), which can in fact express any language that can be accepted by a Turing machine, these two restricted types of grammars are most often used because parsers for them can be efficiently implemented. For example, all regular languages can be recognized by a finite state machine, and for useful subsets of context-free grammars there are well-known algorithms to generate efficient LL parsers and LR parsers to recognize the corresponding languages those grammars generate. Context-free grammars A context-free grammar is a grammar in which the left-hand side of each production rule consists of only a single no terminal symbol. This restriction is non-trivial; not all languages can be generated by context-free grammars. Those that can are called context-free languages. The language defined above is not a context-free language, and this can be strictly proven using the pumping lemma for context-free languages, but for example the language (at least 1 followed by the same number of 's) is context-free, as it can be defined by the grammar with , , the start symbol, and the following production rules: 1. 2. A context-free language can be recognized in time (see Big O notation) by an algorithm such as Earley's algorithm. That is, for every context-free language, a machine can be built that takes a string as input and determines in time whether the string is a member of the language, where is the length of the string.[7] Deterministic context-free languages is a subset of context-free languages that can be recognized in linear time. There exist various algorithms that target either this set of languages or some subset of it.
  • 8. Regular grammars In regular grammars, the left hand side is again only a single no terminal symbol, but now the right-hand side is also restricted. The right side may be the empty string, or a single terminal symbol, or a single terminal symbol followed by a no terminal symbol, but nothing else. (Sometimes a broader definition is used: one can allow longer strings of terminals or single no terminals without anything else, making languages easier to denote while still defining the same class of languages.) The language defined above is not regular, but the language (at least 1 followed by at least 1 , where the numbers may be different) is, as it can be defined by the grammar with , , the start symbol, and the following production rules: 1. 2. 3. 4. 5. All languages generated by a regular grammar can be recognized in linear time by a finite state machine. Although, in practice, regular grammars are commonly expressed using regular expressions, some forms of regular expression used in practice do not strictly generate the regular languages and do not show linear recognition performance due to those deviations. Other forms of generative grammars Many extensions and variations on Chomsky's original hierarchy of formal grammars have been developed, both by linguists and by computer scientists, usually either in order to increase their expressive power or in order to make them easier to analyze or parse. Some forms of grammars developed include: • Tree-adjoining grammars increase the expressiveness of conventional generative grammars by allowing rewrite rules to operate on parse trees instead of just strings. • Affix grammars and attribute grammars allow rewrite rules to be augmented with semantic attributes and operations, useful both for increasing grammar expressiveness and for constructing practical language translation tools.
  • 9. Recursive grammars A recursive grammar is a grammar which contains production rules that are recursive. For example, a grammar for a context-free language is left-recursive if there exists a non-terminal symbol A that can be put through the production rules to produce a string with A as the leftmost symbol. All types of grammars in the Chomsky hierarchy can be recursive. Transition graph Transition diagram for a finite state machine modeling a turnstile, a common introductory example used to explain state machines. The turnstile has two states, Locked and Unlocked. There are two inputs affecting the state: depositing a coin in the turnstile, coin, and pushing on the turnstile’s bar, pushes. The turnstile bar is initially locked, and pushing on it has no effect. Putting a coin in changes the state to Unlocked unlocking the bar so it can turn. A customer pushing through the turnstile changes the state back to Locked so additional customers can't get through until another coin is deposited. The arrow into the Locked node from the black dot indicates it is the initial state.  Deterministic: For a given current state and an input symbol, if an automaton can only jump to one and only one state then it is a deterministic automaton.  Nondeterministic: An automaton that, after reading an input symbol, may jump into any of a number of states, as licensed by its transition relation. Notice that the term transition function is replaced by transition relation: The automaton non-deterministically decides to jump into one of the allowed choices. Such automata are called nondeterministic automata.  Alternation: This idea is quite similar to tree automaton, but orthogonal. The automaton may run its multiple copies on the same next read symbol. Such automata are called alternating automata. Acceptance condition must satisfy all runs of such copies to accept the input.
  • 10. Generalized transition graph A finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state machine, is a mathematical model of computation used to design both computer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a transition. A particular FSM is defined by a list of its states, and the triggering condition for each transition. The behavior of state machines can be observed in many devices in modern society which perform a predetermined sequence of actions depending on a sequence of events with which they are presented. Simple examples are vending machines which dispense products when the proper combination of coins is deposited, elevators which drop riders off at upper floors before going down, traffic lights which change sequence when cars are waiting, and combination locks which require the input of combination numbers in the proper order. Finite-state machines can model a large number of problems, among which are electronic design automation, communication protocol design, language parsing and other engineering applications. In biology and artificial intelligence research, state machines or hierarchies of state machines have been used to describe neurological systems and in linguistics—to describe the grammars of natural languages. Considered as an abstract model of computation, the finite state machine is weak; it has less computational power than some other models of computation such as the Turing machine.[1] That is, there are tasks which no FSM can do, but some Turing machines can. This is because the FSM has limited memory. The memory is limited by the number of states. Transition diagram for a finite state machine modeling a turnstile, a common introductory example used to explain state machines. The turnstile has two states, Locked and Unlocked. There are two inputs effecting the state: depositing a coin in the turnstile, coin, and pushing on the turnstile's bar, push. The turnstile bar is initially locked, and pushing on it has no effect. Putting a coin in changes the state to Unlocked unlocking the bar so it can turn. A customer pushing through the turnstile changes the state back to Locked so additional customers can't get
  • 11. through until another coin is deposited. The arrow into the Locked node from the black dot indicates it is the initial state.