Re: Write unambiguously grammar.?



Trish wrote:

Can someone help. thanks

Certainly, your instructor can; if you approach him/her/it and explain your
reluctance to do your homework yourself to his/her/it satisfaction,
he/she/it may do it for you.

question:
<exp> ::= <int>|<exp> <op> <exp>
<op>::= + | *
is ambiguous. Rewrite the grammar so that it accepts the same language
unambiguous and honors the traditional interpretation of arithmetic
expressions. Using your grammar, provide a derivation of the expressions:
2*3+5*4 and 2+3*5*4

-- mecej4
.



Relevant Pages

  • O(n) Parsing For General Context-Free Grammars & Transductions
    ... a theory and calculus generalizing the "regular expressions" ... of translation based on a context-free or syntax-direct specification. ... grammars (i.e. the grammar that describes the entire set of possible ... translations corresponding a given input); ...
    (comp.theory)
  • Re: Why LL(1) Parsers do not support left recursion?
    ... languages are ambiguous and don't use deterministic language theory.) ... expressed using either left or right recursion in a grammar. ... the rest of what I said implying accepting ambiguity, ... I would write regular expressions if I wanted to emphasize the fact ...
    (comp.compilers)
  • Re: Constructibility of X -> X^2 bijection
    ... Consider the mapping from the ... enumerates exactly the elements of X (or a grammar that enumerates ... the first two characters in the alphabet. ... characters, changing the ordering of the expressions, thus changing ...
    (sci.math)
  • Re: cap. words refer to ?
    ... course on english now,i am not taking any assignment or homework on ... I am reading it only to develop my reading. ... I have subscribed newsweek magazine for 2 years. ... grammar is hard for me. ...
    (alt.usage.english)
  • Re: Why context-free?
    ... John, suggestion has a lot of merit, irrespective of error processing. ... to the problem of adding well-typed expressions to a grammar. ... form of functional programing language. ...
    (comp.compilers)