[PRL] use of variable-prefix ?

Carl Eastlund cce at ccs.neu.edu
Sat Jun 4 12:06:10 EDT 2011


On Sat, Jun 4, 2011 at 8:30 AM, Mitchell Wand <wand at ccs.neu.edu> wrote:
> I would like to distinguish constructors from variables, and constructor
> applications from ordinary applications, using variable-prefix.
> I'd like to write something like this:
>
> (define-language sample
>   [e
>    x
>    Kapp
>    app]
>   [app (x x)]
>   [Kapp (K x)]
>   [K (variable-prefix K)]
>   [x variable-not-otherwise-mentioned])
>
> But this doesn't work:  the symbol K1 matches both K and x, and (K1 x)
> matches both app and Kapp.
> Changing x to use variable-except doesn't do the job either, since
> variable-except allows only a finite number of exceptions, not a pattern.
>
> What am I missing?
>
> --Mitch

You can give x a different prefix from K, or you can give it a side
condition and write an explicit check, probably using redex-match,
that it doesn't match K.

--Carl



More information about the PRL mailing list