Sei sulla pagina 1di 13

ABSTRACT

“Analyzing Ambiguity of Context-Free Grammars”


 It has been known since 1962 that the ambiguity problem for context-free grammars
is undecidable. Ambiguity in context-free grammars is a recurring problem in
language design and parser generation, as well as in applications where grammars are
used as models of real-world physical structures. However, the fact that the problem
is undecidable does not mean that there are no useful approximations to the problem.
 We observe that there is a simple linguistic characterization of the grammar
ambiguity problem, and we show how to exploit this to conservatively approximate
the problem based on local regular approximations and grammar unfoldings. As an
application, we consider grammars that occur in RNA analysis in bioinformatics,
INTRODUCTION
 When using context-free grammars to describe formal languages, one has to
be aware of potential ambiguity in the grammars, that is, the situation where a
string may be parsed in multiple ways, leading to different parse trees.
 We propose a technique for detecting ambiguities in a given grammar.
 As the problem is in general undecidable we resort to conservative
approximation.
 This is much like, for example, building an LR(k) parse table for the given
grammar and checking for conflicts. The analysis we propose has two
significant advantages:
 The LR(k) condition has since its discovery by Knuth in 1965 been known

as a powerful test for unambiguity .

 An example of an even larger class of unambiguous grammars is LR-

Regular . However, not even LR-Regular

 is sufficient for a considerable class of grammars involving palindromic

structures, which our technique can handle.

 Additionally, unlike LR(k), our approach works well without separating

lexical descriptions from the grammars.

 The ambiguity warnings that our approach can produce if a potential

ambiguity is detected are more human readable than those typically

produced
LITERATURE REVIEW
 Vasudevan and Tratt (2012) discussed that there are more than one way to allow
input in programming language. Statically it is undecidable to detect ambiguity. In
this study, ambiguity searching techniques are introduced. In 2001, Flajolet (1987)
discussed the analytic method through which it is tested that CFG is inherently
ambiguous. To test this different theorems of context free language are used. It is
found by testing that some grammar inherently ambiguous and there are some
conditions through which that can be identified. In 2007, Schmid (2004) discussed
efficient parsing of highly ambiguous CFG with bit vector method. It represents
the efficient context free parsing. It provides analysis for context free Treebank
grammar and lays input sentences. Large CFG have big ambiguity tree with cause
problem in parsing. In 2002, Wich (2000) discussed that ambiguous grammar can
be found by the degree of ambiguity.
 Some tools are introduced for examining ambiguity of CFG; in this
manner ambiguity function is formed. This function records the number of
grammar and their maximum numbers of derivation trees which a
grammar can have. In 2008, Basten (2009) discussed that there are some
benefits of having ambiguity. Through ambiguity grammar can be
detected. In CFG there is no general method to detect ambiguity but there
are some methods through which ambiguity can be detected but they are
sometimes not effective. Three methods are being Gorn’s method: Gorn
(1963) proposed this method in 1963. In this method, it is discussed that
Turing machine can create all probable type of strings from a grammar
which is known as derivation generator.
PROBLEM IDENTIFICATION
Hard to reason (locally) about ambiguity:
 Intricate overall structural property of a grammar

Are "left-to-right" (or "right-to-left") biased:


 Cannot handle "palindromic grammars"

(...a serious problem for RNA analysis)!

Error messages:
 Hard to "pin-point ambiguity" (in terms of grammar)

 Also: would like "shortest examples" for debugging

(...especially for grammar non-experts)!


PROPOSED
 Characterization of grammar ambiguity that allows us to reason about the language

of the non-terminals in the grammar rather than the structure of the grammar. In

particular, we reformulate the ambiguity problem in terms of language roundabout

and overlap operations. Based on this characterization, we formulate a general

frame- work for conservatively approximating the Akshay Kanwar, IJECS Volume

2 Issue10 October,2013 Page No.2921-2026 Page 2922 ambiguity problem. In

another section we show how regular approximations can be used to obtain a

particular decidable approximation. Next section discusses applications in the area

of bio sequence analysis where context-free grammars are used to describe RNA

structures. It also summarizes a number of experiments that test the accuracy and

performance of the analysis.


METHDOLOGY
 Following are different methods which are used for

 detecting ambiguity in context free grammar:

 • Gorn’s method

 • Cheung’s and Uzgalis’smethod

 • Jampana’smethod

 • Brabrand’s, Giegerich’s and Moller’s method

 • Schmitz’s method

 The most used and current methods for detecting

 ambiguity in context free grammar are given below.


 Cheung’s and Uzgalis’s method: This method was proposed by Cheung (1995). This method

consists of breadth first search which help in reducing all the potential derivatives of the

grammar. It can also be known as optimized Gorn method. It produces every potential

statement of a grammar and search whether a statement has been duplicated. The method also

ceases the extension of statements due to specific reasons. The statement is terminated when

the result is unable to locate an ambiguous string or same type of statement is found. For

finding this, the production has to be compared with pre and post fixed of the desired

statements. For example, finding a statement that terminates different pre and post fix

terminals and it middle part expand independently. This helps in finding a repetitive pattern.

Following is a good example relating the pattern: A → X|Y X → xX|x Y → yY|y From the

above given example, it is shown that when start symbol A expands it results in string X and

Y. When string X expands it results in string xX and x. Similarly when string Y expands it

results in string yY and y. now the expansion will be terminated. Otherwise the string will be

duplicated. The pre fix, post fix and middle part of the terminal have been expanded in the
RESULT
 In this study, different ambiguity detection
 methods have been discussed and all the discussed
 methods have their strengths and weakness as well. The
 method proposed by Gorn does not assure the
 termination of the grammar and neither has it detected
 non ambiguity. This method cannot be considered best
 for detecting ambiguity. The Cheung’s and Uzgalis’s
 method does not assure termination, that’s why it is not
 considered the top method for ambiguity detection. The
 Jampana’s method does not show accuracy, that’s why
 it is not considered the best method for detectingambiguity.
CONCLUSION
 We have obtainable a technique for statically analyzing ambiguity of context-free
grammars. Based on a linguistic characterization, the technique allows the use of
grammar transformations, in particular regular approximation and recitation,
without sacrificing reliability. Moreover, the analysis is often able to identify
sources of ambiguity through existing examples being automatically generated.
The analysis may be used when LR(k) and related techniques are insufficient, for
example in bio-sequence analysis, as our examples show. Our experiments indicate
that the precision, the speed, and the quality of warning messages are ample to be
practically useful.
REFERENCES

1. http://en.wikipedia.org/wiki/Ambiguous_gram
mar
2. http://en.wikipedia.org/wiki/Contextfree_grammar
3. http://www.cs.odu.edu/~toida/nerzic/390teche
d/cfl/cfg.html
4. www.cs.rochester.edu/~nelson/courses/csc_17
3/grammars/cfg.html
5. lambda.uta.edu cse 17 notes node1 .html
6. cs.union.edu/~striegnk/courses/nlp-withprolog/html/node37.html
7. http: www.cs.cornell.edu people t svm light
svm cfg.html
8. http: www.cse.ohio-state.edu gurari theorybk theory-bk-threese
.html

Potrebbero piacerti anche