[racket] Redex question: parameterizing a language definition

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Apr 4 21:32:05 EDT 2013

On Thu, Apr 4, 2013 at 5:32 PM, Lindsey Kuper <lkuper at cs.indiana.edu> wrote:

> On Thu, Apr 4, 2013 at 11:15 AM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
> >
> > Lindsey, in your case, I believe the 'rabbit hole' can be avoided.
> >
> > From what I understand each family in lambdaLVar is (almost) uniformly
> > generated from a grammar 'functor' that receives a lattice (let's say
> > one for now), computes some grammatical clauses -- and may add some
> > primitive operations for working on the lattice, which is trivial --
> > and returns that grammar.
>
> Yes, that sounds very much like what I want to do.  Will this sort of
> thing be possible in a future-Redex-with-modules?
>
>
Yes.

One thing to watch out for, tho, is that redex uses source location
information to typeset grammars and when macros are involved, the source
locations (naturally) get mixed up. Since a macro can do arbitrary
computation at runtime, however, you can fiddle with the source locations
in the output of your macro to overcome this problem (but it isn't the
easiest thing in the world).

Robby


> > The reduction relation itself does not depend on the generated grammar
> > other than the notion of value you need for beta-v.
> >
> > So, I think that you could use _Racket_'s syntax system to compute
> > the grammar. This is quite different from extending a base grammar
> > with new features or value clauses but as I said at the beginning,
> > it is closer to the way you describe lambdaLVar.
>
> So, in other words, have a macro that generates a Redex grammar?  I
> can give that a try.  I did think that might be what I would end up
> doing, but wanted to see first if I could get the results I wanted
> without leaving Redex (and extending a base grammar was a kind of
> hacky attempt to stay within Redex).
>
> Thanks,
> Lindsey
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130404/8599f1a2/attachment.html>

Posted on the users mailing list.