Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Ambiguous grammars


Related Topics

In the News (Wed 30 Dec 09)

  
  Ambiguous grammar - Wikipedia, the free encyclopedia
In computer science, a grammar is said to be an ambiguous grammar if there is some string that it can generate in more than one way (i.e., the string has more than one parse tree or more than one leftmost derivation).
A language is inherently ambiguous if it can only be generated by ambiguous grammars.
For programming languages, ambiguous grammars can lead to difficulties for some compilers.
en.wikipedia.org /wiki/Ambiguous_grammar   (156 words)

  
 1 Using VoiceXML Grammars
An application grammar may be a grammar you've defined specifically for a particular application or it may part of a general library of grammars you have access to for reuse in multiple VoiceXML applications.
Grammar in a grammar file of any format, using the grammar's root rule to start recognition.
Grammar in a GSL compiled grammar file; the file identifies its root rule from which to start recognition.
cafe.bevocal.com /docs/grammar/using.html   (3832 words)

  
 Bending grammars to your will
An ambiguous grammar is one that gives more than one way of understanding a single piece of text in the language.
It may be that, as for C above, the language itself is ambiguous (at the grammatical level - there is no ambiguity at the semantic level) or it may be that, as in this example, the language itself is unambigous but the person who wrote the grammar made a mistake.
A confusing grammar is what, for the purposes of this discussion, I am calling an unambiguous grammar that is still too complicated for the parsing algorithm you are trying to use.
www.cs.man.ac.uk /~pjj/complang/grammar.html   (1318 words)

  
 3 Grammars   (Site not responding. Last check: 2007-10-20)
A common construct in grammars is for matching a list of patterns, sometimes separated with delimiters such as commas or semicolons.
we saw the classic if/then/else ambiguity, which occurs because the ``else...'' portion of an ``if...then...else...'' construct is optional.
The ambiguity is that if an ``else'' is present, it is not clear whether you want it parsed immediately or if you want it to be parsed by the outer ``if''.
theory.stanford.edu /~amitp/Yapps/yapps2/manual/node3.html   (1105 words)

  
 BioMed Central | Full text | Evaluation of several lightweight stochastic context-free grammars for RNA secondary ...
If a grammar is structurally ambiguous, then we cannot equate the probability of a parse tree with the probability of its structure [43].
Determining grammar ambiguity in the usual formal language sense is undecidable [40,41].
Ambiguity is an issue for optimal structure prediction, but the summed Inside calculation (the analog of the summed partition function calculation) gives the correct result even for ambiguous grammars.
www.biomedcentral.com /1471-2105/5/71   (7989 words)

  
 AN LL(1) PARSER GENERATOR WITH LOOKAHEAD - LALL
Ambiguity in the grammar of a language occurs when a single sentence of the language can be interpreted in two different ways.
Two grammars may describe the same language, and one grammar be ambiguous, and one not be ambiguous (the meaning attached to the tokens within the grammar is what is ambiguous).
In context free grammars, parser generators have dealt with ambiguity by assigning a priority to one of the distinct trees that represent the input sentence when the parser is generated.
www.gen7software.com /lall/lallthes.htm   (12495 words)

  
 CSC 4170 Ambiguous Grammars, Ambiguous Languages   (Site not responding. Last check: 2007-10-20)
Ambiguous grammars are undesirable because the derivation tree provides considerable information about the semantics of a program; conflicting derivation trees provide conflicting information.
Ambiguity is a property of a grammar, and it is usually (but not always) possible to find an equivalent unambiguous grammar.
An inherently ambiguous language is a language for which no unambiguous grammar exists.
www.seas.upenn.edu /~cit596/notes/dave/parsing7.html   (110 words)

  
 ANTLR-centric Language Glossary
Ambiguous languages always yield ambiguous grammars unless you can find a way to encode semantics (actions or predicates etc...) that resolve the ambiguity.
A grammar where recognition of a particular construct does not depend on whether it is in a particular syntactic context.
Formally, LL(k) represents a class of parsers and grammars that parse symbols from left-to-right (beginning to end of input stream) using a leftmost derivation and using k symbols of lookahead.
www.antlr.org /doc/glossary.html   (2473 words)

  
 [No title]
A parser is an algorithm that determines whether a given input string is in a language (and, as a side-effect, usually produces a parse tree for the input).
As written, this grammar is ambiguous with respect to the precedence of the arithmetic operators.
According to our grammar, expressions consist of the sum or difference of terms (or a single term), where a term consists of the product or division of factors (or a single factor), and a factor is a nested expression or a number.
www.cs.rochester.edu /u/scott/173/notes/05_grammars   (4702 words)

  
 3. Grammars   (Site not responding. Last check: 2007-10-20)
In section 3.1 we saw the classic if/then/else ambiguity, which occurs because the ``else...'' portion of an ``if...then...else...'' construct is optional.
Yapps will deal with the situation by reporting that there is an ambiguity (warning you that the parser may not work), but it will still produce a parser.
If you have the if/then/else ambiguity in your grammar, be sure to put the ``else'' clause before the empty clause.
theory.stanford.edu /~amitp/Yapps/yapps-doc/node3.html   (1000 words)

  
 Bison 1.875   (Site not responding. Last check: 2007-10-20)
In brief, in these grammars, it must be possible to tell how to parse any portion of an input string with just a single token of look-ahead.
(1) grammars are deterministic, meaning roughly that the next grammar rule to apply at any point in the input is uniquely determined by the preceding input and a fixed, finite portion (called a look-ahead) of the remaining input.
These are represented in the grammar of C by nonterminal symbols `expression', `statement', `declaration' and `function definition'.
www.delorie.com /gnu/docs/bison/bison_7.html   (901 words)

  
 Ambiguous and confusing grammars
Ambiguous grammars are, by definition, going to be difficult to handle no matter what tools we use.
Luckily, for most good tools, you are unlikely to come across such a grammar, and if you do, you can usually modify the grammar to overcome the problems but still recognise the same language.
Once an ambiguity has been pointed out in a grammar, it is usually clear enough to the user what the problem is, even if it isn't obvious what to do about it.
www.cs.man.ac.uk /~pjj/cs2121/ho/node7.html   (1594 words)

  
 CS362 2004S : Class 13: Ambiguous Grammars
Some grammars are ambiguous in that there is more than one parse tree for the same statement.
Ambiguity is bad, particularly as the structure of a parse tree may give information about desired interpretations.
When rewriting the grammar, we decide upon categories of things that are and are not allowed in particular places, and write rules for those kinds of things.
www.cs.grinnell.edu /~rebelsky/Courses/CS362/2004S/Outlines/outline.13.html   (320 words)

  
 Bison 1.875   (Site not responding. Last check: 2007-10-20)
Ambiguous grammars, since they have strings with more than one possible sequence of reductions cannot have deterministic parsers in this sense.
Usually, non-determinism in a grammar is local--the parser is "in doubt" only for a few tokens at a time.
On (1) portions of a grammar, in particular, it is only slightly slower than with the default Bison parser.
www.delorie.com /gnu/docs/bison/bison_90.html   (665 words)

  
 SmaCC by Refactory, Inc.
The directives section is used to tell SmaCC how to handle ambiguous grammars as well as how it should generate the code for the parser.
It allows your grammar to be under the same version control system as your Smalltalk code.
However, for a moderate sized grammar (e.g., Java), this comment can be a few MB in size.
www.refactory.com /Software/SmaCC/Parser.html   (1759 words)

  
 GLR parsing with Happy
This means it can parse ambiguous grammars and produce a directed acyclic graph representing all possible parses.
grammar with 20 numerals (ie 39 symbols) of input in a fraction of a second.
This will improve efficiency for grammars with local ambiguity which is generally resolved by the end of parsing.
www.dur.ac.uk /p.c.callaghan/happy-glr   (804 words)

  
 Blindfold Grammars
A blindfold annotated grammar is written in Extended Backus-Naur Form (EBNF) with embedding instruction to blindfold, detailing what facts (RDF triples) should be inferred from particular expressions in the language.
The order of alternatives in a pattern is significant: if the grammar is ambiguous, the first alternative which leads to a correct parse will be used.
BNF grammar specifications, as above, can be used to determine if a sequence of characters is or is not a valid expression in the language.
www.w3.org /2001/06/blindfold/grammar   (1225 words)

  
 Comp.compilers: Re: detecting ambiguous grammars   (Site not responding. Last check: 2007-10-20)
Re: detecting ambiguous grammars world!bobduff@uunet.uu.net (Robert A Duff) (2001-04-10)
grammars in the class are [un]ambiguous--but where there are grammars
decide that a grammar is unambiguous (for any arbitrary grammar).
compilers.iecc.com /comparch/article/01-02-102   (957 words)

  
 Siber Systems BtYacc: BackTracking Yacc
These statements are used to: - Introduce modularity into a grammar by breaking it into several *.y files and assembling different grammars from the *.y modules using %include and %ifdef.
In yacc grammars for C, a standard hack, know as the "lexer feedback hack" is used to find typedef names.
Anyone who has ever looked at Jim Roskind public domain C++ yacc grammar, or the yacc-based grammar used in g++ knows how difficult this is. BTYACC is very useful for parsing any ambiguous grammar, particularly ones that come from trying to merge two (or more) complete grammars.
www.siber.com /btyacc   (3123 words)

  
 [No title]   (Site not responding. Last check: 2007-10-20)
The algorithm does not require any changes to be made to the grammar, and can parse with respect to any grammar non-terminal as the start symbol.
It is possible to generate all possible parse trees of the input string in the presence of ambiguous grammars.
This algorithm is also applicable to batch-oriented language processors, especially during the development of new languages, where frequent changes are made to the language syntax and new prototype parsers need to be developed quickly.
www-db.stanford.edu /TR/CSL-TR-93-562.html   (216 words)

  
 Elkhound and Elsa
Similarly, ambiguity is handled by letting potential parses be coalesced, with special action taken to handle the ambiguous region of the input.
Programmers can start with a grammar that is convenient (but perhaps slower to parse with), and gradually modify it to conform to LALR(1) in places for improved performance.
Grammars that are already LALR(1) will work in Elkhound unmodified (though the input syntax is different), and with parsing speeds within a few percent of Bison-generated parsers.
www.cs.berkeley.edu /~smcpeak/elkhound   (2930 words)

  
 Canonical, Ambiguous   (Site not responding. Last check: 2007-10-20)
A grammar is ambiguous if a word has two different left canonical derivations.
There is but one canonical derivation for every word in the language, the grammar is not ambiguous, and the language is not ambiguous.
Since each intermediate string produced by a regular grammar has precisely one nonterminal, all regular grammars are unambiguous, and all regular languages are unambiguous.
www.mathreference.com /lan-cfl,amb.html   (499 words)

  
 Comp.compilers: Re: detecting ambiguous grammars   (Site not responding. Last check: 2007-10-20)
ambiguous input is parsed by two or more distinct derivations).
ambiguous or not (even if we don't know which applies).
grammars that are both ambiguous and non-ambiguous at the same time.
compilers.iecc.com /comparch/article/01-03-175   (441 words)

  
 Comp.compilers: Re: detecting ambiguous grammars   (Site not responding. Last check: 2007-10-20)
But there are better algorithms for some classes of grammars.
given grammar is LR or LL you just send it through a parser generator.
grammar is also ambiguous, and in fact it's difficult to specify a
compilers.iecc.com /comparch/article/01-03-020   (699 words)

  
 Grammars   (Site not responding. Last check: 2007-10-20)
An ambiguous grammar is one that gives more than one way of understanding a...
grammars are, by definition, going to be difficult to handle no...
There are no early treatises on the structure and composition of the Gaelic language, such as the ancient MS writings which still exist on Irish Grammar.
www.bookfizz.co.uk /k.php?qkw=Grammars&type=s   (272 words)

  
 ipedia.com: Ambiguous grammar Article   (Site not responding. Last check: 2007-10-20)
In computer science, a grammar is an ambiguous grammar if some string in the language can be generated in more than one way.
A language is inherently ambiguous if it can only be generated by ambiguous...
In computer science, a grammar is an ambiguous grammar if some string in the language can be generated in more than one way (i.e., it has more more than one parse tree or more than one leftmost derivation).
www.ipedia.com /ambiguous_grammar.html   (179 words)

  
 Affix Grammars for Natural Languages - Koster (ResearchIndex)   (Site not responding. Last check: 2007-10-20)
Abstract: Affix Grammars over a Finite Lattice (agfls), a simple form of two-level grammars admitting quite efficient implementations, are proposed as a formalism to express the syntax of natural languages.
A brief example is given of their use in describing a fragment of the English language, followed by a discussion of issues like parsing and ambiguity.
1999] which describes the context in which the grammar is to be used.
citeseer.ist.psu.edu /koster91affix.html   (697 words)

  
 Fundamentals of Computer Science
A grammar is a recursive definition of a pattern
It is possible to have grammars such that two or more parse trees have the same yield
Can show that the language for a given grammar cannot be generated by a regular expression
engr.smu.edu /~diaz/5311.fall98/notes/chapter11.html   (500 words)

  
 [No title]   (Site not responding. Last check: 2007-10-20)
grammar G1 (left recursive)ª  Ÿ¨ES -> E E -> E - T E -> T T -> T / F T -> F F -> (E) F -> identifier¡F!Fª F ó  Ÿ¨ ex.
Note: yacc encourages the use of ambiguous grammars but provides ways of removing uncertainty from the parse.¡´(]£ªb    \  ;  c ó Ÿ¨An Ambiguous English Sentenceª  Ÿ¨Time flies like a green arrow.
A man, a plan, a canal, Panama.ª q óŸ¨!Implications of Theory for Parserª " Ÿ¨¦Some languages which we can define by a context free grammar cannot be parsed by a deterministic finite state automaton.
www.csee.wvu.edu /~vanscoy/CS236LEC07.PPT   (1331 words)

  
 Ambiguous grammars for unambiguous languages
So the reductions are of "rulebody", which occurs in 3 places in the grammar, and as one of those is at the extreme right of a rule, we need to start expanding it.
I believe the problem is that the original grammar was unambiguous and so when we tried to decide the shift/reduce conflict in favour of the shift we can no longer input some legal programs.
In fact, I'm not even convinced that, in this case, the final modification does cause the grammar to perform a shift in preference to a reduction.
www.cs.man.ac.uk /~pjj/complang/howto2.html   (2071 words)

  
 [No title]
however, languages we wish to recognize in practice are typically not fully describable by conventional grammars.
grammars are capable of describing most, but not all, of the syntax of practical programming languages
a grammar is ambiguous if two or more parse trees exist for the same string
doc.ece.uci.edu /~klefstad/s/142/lectures/parse.html   (1699 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.