# [plt-dev] Multi-color calculi in Redex

 From: Matthias Felleisen (matthias at ccs.neu.edu) Date: Thu May 14 13:27:28 EDT 2009 Previous message: [plt-dev] Multi-color calculi in Redex Next message: [plt-dev] Programmatic running of student programs Messages sorted by: [date] [thread] [subject] [author]

```On May 14, 2009, at 12:14 PM, Christos Dimoulas wrote:

> Robby Findler wrote:
>> Am I right that you want to define a parameterize grammar (where you
>> are counting the let nesting depth)?
>>
>  Not exactly, I am trying to paint the evaluation context with the
> color i of the deepest colored frame {E_0}_i
>
>> You can't do that like that; instead just define E that has all lets
>> in it, and when you wanted E_i for some i, write a metafunction that
>> counts the depth of the E and use a side-condition to ensure that the
>> size is i.
>>
>  Your suggestion may work in this case too. I will try to right a
> metafunction that returns the color of the evaluation context
>   instead of having the grammar keep track of it.

But you're not looking at size of E with i. You're looking at color.
How can the shape

([] \x.x)

tell you whether the context is green or red?

-- Matthias

>  Thanks.
>  .Christos
>
>> hth,
>> Robby
>>
>> On Thu, May 14, 2009 at 11:03 AM, Christos Dimoulas
>> <chrdimo at ccs.neu.edu> wrote:
>>
>>> I would like to define the following grammar in Redex:
>>>
>>> e := .... | let x = e in e | {e}_i
>>> E_0 := [] | let x=E_0 in e
>>>
>>> E_i := let x = E_i in e | {E_0}_i | {E_i}_j
>>>
>>> where i,j in N^*.
>>>
>>> Do you have any ideas how I could code that in Redex?
>>>
>>> Thank you.
>>>
>>> .Christos
>>> _________________________________________________