Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David McClain <David.McClain@Avisere.com>
To: Brian Hurt <bhurt@spnz.org>, caml-list@inria.fr
Subject: Re: [Caml-list] CFG's and OCaml
Date: Fri, 13 Aug 2004 09:04:27 -0700	[thread overview]
Message-ID: <73EC7D25-ED42-11D8-99DF-000A95C19BAA@Avisere.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0408131043200.4282-100000@localhost.localdomain>

Uhuhh... Yes, I did that same "evil" thing as well, even before 
discussing all these reduce/reduce conflicts/

What I find is that these screwball little tricks might help, and the 
might not. YACC is just too darned sensitive to minor and non-obvious 
perturbations in the input grammar specification. Realizing its legacy, 
indeed it does arise from the old IBM-360, or more properly PDP-10, 
days. That was the style of programming back then.. I remember it well.

I see that the root of the problem really lies in the reducion from 
LL(1) to LALR(1) where driver table entries are shared as much as 
possible to diminish the size of these tables. However, when that 
occurs, we end up getting mixes like we have between the distinct 
expression and pattern subtrees in the grammar.

Indeed these do appear syntactically similar, yet by way of 
specification, we are hoping to apply completely different semantic 
actions to these reductions. This is a dilemma.

I had though the other night about creating a common subtree of 
semantic actions and then let the higher levels unravel that subtree. 
That would probably work well here, but it is a lot more work.

David McClain
Senior Corporate Scientist
Avisere, Inc.

david.mcclain@avisere.com
+1.520.390.7738 (USA)


On Aug 13, 2004, at 08:49, Brian Hurt wrote:

> On Fri, 13 Aug 2004, David McClain wrote:
>
>> Okay... here's a case where when I do "exactly" what the gurus at 
>> Inria
>> do, I get a reduce/reduce conflict, and yet when I build OCaml it does
>> not report any such conflicts. [I say "exactly" because obviously I'm
>> not...]
>>
>> simple_expr:
>> 	constant
>> 	...
>>
>> simple_pattern:
>> 	signed_constant
>> 	...
>>
>> constant:
>> 	INT
>> | 	FLOAT
>>
>> signed_constant:
>> 	constant
>> |	MINUS INT
>> |	MINUS FLOAT
>>   ;; /*  ---------------------------------------------------------- */
>>
>> The reduce/reduce conflict comes on deciding whether to assign an INT
>> seen to signed_constant which will reduce to simple_pattern, or 
>> instead
>> to become constant which reduces to simple_expr. Both Inria and I do
>> completely different semantic reductions in these two cases, and so a
>> reduce/reduce conflict could be fatal here...
>
> When the compiler sees an int, which path should it take?
>
> My advice would be to remove the constant from signed_constant's 
> patterns.
>
>
>> So, as so often happens with the master's touch, everything works fine
>> for them, but it doesn't for me. Why should this be, in this example
>> case?
>
> They're doing something evil- take a look at line 355 of
> parsing/parser.mly in 3.08.0.
>
> -- 
> "Usenet is like a herd of performing elephants with diarrhea -- 
> massive,
> difficult to redirect, awe-inspiring, entertaining, and a source of
> mind-boggling amounts of excrement when you least expect it."
>                                 - Gene Spafford
> Brian
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-08-13 16:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-13 14:04 David McClain
2004-08-13 15:05 ` Damien Doligez
2004-08-13 15:26   ` David McClain
2004-08-13 16:12     ` Damien Doligez
2004-08-13 15:28   ` David McClain
2004-08-13 15:49 ` Brian Hurt
2004-08-13 16:04   ` David McClain [this message]
2004-08-13 16:29     ` Brian Hurt
2004-08-13 16:42       ` Xavier Leroy
2004-08-13 17:18         ` Ken Rose
2004-08-13 18:55         ` Brian Hurt
2004-08-14  0:25           ` Jon Harrop
2004-08-14  0:57             ` Erik de Castro Lopo
2004-08-14  8:52               ` Alan Schmitt
2004-08-14  3:33             ` Brian Hurt
2004-08-14  7:55             ` skaller
2004-08-14 20:19               ` Jon Harrop
2004-08-14 20:55                 ` Brian Hurt
2004-08-14 20:57                   ` Marcin 'Qrczak' Kowalczyk
2004-08-14 22:15                     ` skaller
2004-08-15  1:26                   ` Jon Harrop
2004-08-15  8:24                     ` skaller
2004-08-15 15:39                     ` Brian Hurt
2004-08-15 16:54                       ` Jon Harrop
2004-08-14 22:13                 ` skaller
2004-08-13 16:58     ` Paul Snively
  -- strict thread matches above, loose matches on Subject: below --
2004-08-12 19:15 David McClain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73EC7D25-ED42-11D8-99DF-000A95C19BAA@Avisere.com \
    --to=david.mcclain@avisere.com \
    --cc=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox