<div dir="ltr">Thanks for the pull request (and sorry for the delay in replying here). I've pushed your commit and another one that covers things like docs and otherwise a few other changes to your commit. Please let me know if things don't work out for you.<div>
<br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 28, 2013 at 10:47 PM, William J. Bowman <span dir="ltr"><<a href="mailto:wjb@williamjbowman.com" target="_blank">wjb@williamjbowman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am at Northeastern. I use my own address as a central point for the<br>
multiple present and past addresses, and usually don't bother<br>
spoofing the `from' header. Perhaps I'll add a note about that to my<br>
email signature.<br>
<br>
Thanks for the tips about reduction semantics!<br>
<br>
I've created a pull request.<br>
<span class="HOEnZb"><font color="#888888"><br>
William Bowman<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Feb 28, 2013 at 08:18:12PM -0600, Robby Findler wrote:<br>
> Yeah, I agree it does make sense to do this kind of merging with examples<br>
> like the one you posted or else you get very very bad performance in<br>
> matching. And the merging is coming about because of the way the language<br>
> is structured; it isn't accidental "lucky" merging; you expect the same<br>
> productions to show up multiple times because of the way the grammars are<br>
> constructed.<br>
><br>
> Overall, I agree with you that this is a reasonable request. I would be<br>
> happier if I could say that Redex's module language were anywhere close to<br>
> being ready because if it were, there would be a better way to do this. But<br>
> in the meantime, I think your extension is a good one. Your email suggests<br>
> that you are unaffiliated but I think you're actually at Northeastern? Can<br>
> someone there help you make this push? If not, I'd be happy to do it.<br>
><br>
> Meanwhile, as to your Redex code, two points about reduction-semantics<br>
> style: you should put both "v" and "E" into the extension not the<br>
> originals: typically both concepts are a part of standard reduction. But,<br>
> if you have a need of values in the original language, (for, say, defining<br>
> Eval) then you should make it a separate non-terminal, not a production of<br>
> 'e'. In your specific example, you run into trouble if you want to make<br>
> pair strict, since you want only (pair v v) in the v non-terminal, but<br>
> (pair e e) in the e non-terminal. FWIW.<br>
><br>
> Robby<br>
><br>
><br>
> On Thu, Feb 28, 2013 at 3:04 PM, William J. Bowman<br>
> <<a href="mailto:wjb@williamjbowman.com">wjb@williamjbowman.com</a>>wrote:<br>
><br>
> > By the way, when I was tinkering, I originally got my example working<br>
> > *without* merging nts (lines 1967-1983). I only added it after<br>
> > inspecting the output of `compiled-lang-lang'. The resulting<br>
> > union-language had the same nonterminal in a language several times with<br>
> > overlapping right-hand-sides, so I merged them<br>
> ><br>
> > William Bowman<br>
> ><br>
> > On Thu, Feb 28, 2013 at 02:05:59PM -0600, Robby Findler wrote:<br>
> > > The reason I didn't do that is very much related to lines 1967-1983 in<br>
> > your<br>
> > > diff.<br>
> > ><br>
> > > That isn't a good idea: what you really want to do there is check to see<br>
> > if<br>
> > > different patterns generate the same languages or not. But that's not<br>
> > > something that is easily done (I'm guessing it is computable, but very<br>
> > very<br>
> > > expensive. It may not be computable, tho, for all I know.)<br>
> > ><br>
> > > One could allow unioning by just keeping all productions, and I guess I<br>
> > > wouldn't mind an extension to define-union-language via a keyword that<br>
> > did<br>
> > > that, tho.<br>
> > ><br>
> > > In your case, is there not a way to refactor your grammars so that you<br>
> > > don't need this capability? Could you maybe make a small, representative<br>
> > > example to post to the list? I find that kind of thing to be quite<br>
> > helpful<br>
> > > for me to understand what the best change to Redex is.<br>
> > ><br>
> > > Robby<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Thu, Feb 28, 2013 at 1:46 PM, William J. Bowman<br>
> > > <<a href="mailto:wjb@williamjbowman.com">wjb@williamjbowman.com</a>>wrote:<br>
> > ><br>
> > > > Hello all,<br>
> > > ><br>
> > > > I've been hacking on some languages in Redex, and found myself<br>
> > > > abstracting commons parts into base languages, and gradually building<br>
> > new<br>
> > > > languages via `define-extended-language' and `define-union-language'.<br>
> > > > Unfortunately, I hit a wall when I discovered `define-union-language'<br>
> > > > doesn't like to union languages that define the same nonterminals.<br>
> > > ><br>
> > > > Consider this toy example:<br>
> > <a href="https://gist.github.com/bluephoenix47/5054403" target="_blank">https://gist.github.com/bluephoenix47/5054403</a><br>
> > > ><br>
> > > > This seems like a sensible thing to want to do, so I forked racket<br>
> > wrote a<br>
> > > > patch:<br>
> > > ><br>
> > > ><br>
> > <a href="https://github.com/bluephoenix47/racket/commit/0a7781b2be2643778f8d8d10d771ab1ce2dc622b" target="_blank">https://github.com/bluephoenix47/racket/commit/0a7781b2be2643778f8d8d10d771ab1ce2dc622b</a><br>
> > > ><br>
> > > > Unfortunately, several Redex tests fail (<a href="http://sprunge.us/fPHU" target="_blank">http://sprunge.us/fPHU</a>)<br>
> > because<br>
> > > > they expect an error when languages which define the same nonterminals<br>
> > > > are used in `define-union-language'.<br>
> > > ><br>
> > > > Is this *desired* behavior? If so, why? It seems very reasonable to<br>
> > want<br>
> > > > to merge the nonterminals of languages.<br>
> > > ><br>
> > > > --<br>
> > > ><br>
> > > > William J. Bowman<br>
> > > ><br>
> > > > _________________________<br>
> > > > Racket Developers list:<br>
> > > > <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
> > > ><br>
> > > ><br>
> ><br>
</div></div></blockquote></div><br></div>