Re: Grammar ambiguity

"Joachim Durchholz" <>
27 Feb 2000 02:49:21 -0500

          From comp.compilers

Related articles
[5 earlier articles]
Re: Grammar ambiguity (Joachim Durchholz) (2000-02-12)
Re: grammar ambiguity (Chris F Clark) (2000-02-12)
Re: Grammar ambiguity (Charles E. Bortle, Jr.) (2000-02-13)
Re: Grammar ambiguity (Jocelyn Coulmance) (2000-02-19)
Re: grammar ambiguity (2000-02-21)
Re: grammar ambiguity world! (Chris F Clark) (2000-02-27)
Re: Grammar ambiguity (Joachim Durchholz) (2000-02-27)
Re: grammar ambiguity (Joachim Durchholz) (2000-02-27)
Re: Grammar ambiguity (Jocelyn Coulmance) (2000-03-03)
Grammar ambiguity (Vassilis Kostakos) (2000-03-06)
Re: Grammar ambiguity (2000-03-11)
Re: Grammar ambiguity (Rodrigo Augusto Barbato Ferreira) (2000-03-11)
| List of all articles for this month |

From: "Joachim Durchholz" <>
Newsgroups: comp.compilers
Date: 27 Feb 2000 02:49:21 -0500
Organization: Compilers Central
References: 00-02-015 00-02-049
Keywords: parse, tools

Jocelyn Coulmance <> schrieb in im Newsbeitrag:
> Maybe you should try to write a LALR(k) grammar rather than a LALR(1)
> one. LALR(k) grammars allow much more natural constructs. In this
> case VisualParse is a nice tool than can save you a lot of time.

Thanks for the pointer.

> As for the semicolon issue, - if you are talking about Eiffel,

Yes. (How did you know? <g>)

> you can insert an optional semicolon in the grammar and resolve the
> conflict in favour of a shift. The parser will accept some illegal
> inputs but later stages will correctly discard them.

I'm *very* suspicious of such changes. You have to fully understand
all the consequences to be 100% sure that the change affects just the
grammar and doesn't inadvertently change the recognized language as

> - if you are talking about a new language, get rid of this rule ;) A
> way to do so is to treat semicolons and line terminations as
> equivalent and force one of them in certain places:
> p1
> (a+b).p2 -- 2 different instructions since there is a line
> termination in between
> p1; (a+b).p2 -- idem since there is a semicolon
> p1(a+b).p2 -- only one instruction

Hmm... yes, I've been thinking along these lines. Unfortunately, this
prevents me from having multi-line expressions. I've tried to work
around this, but the results were not encouraging.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.