plum-umd / abstracting-definitional-interpreters

Abstracting Definitional Interpreters
67 stars 2 forks source link

Compositional, really? #50

Closed dvanhorn closed 7 years ago

dvanhorn commented 7 years ago

I'm not sure that I would call the interpreters here strictly "compositional", though they are "syntax-directed". For instance, the interpretation of "if0" in Figure 2 is not a function of "(ev e1)" and "(ev e2)". My impression is that if the code were refactored in that form, the behaviour of later interpreters would change, right?

Got a point. Let's figure out how to clarify.

dvanhorn commented 7 years ago

Actually I disagree. Fig 2 is compositional. The if0 thing in question is because of (ev (if z? e1 e2)) but that the meaning of (ev (if0 e0 e1 e2)) is still a function of structural subterms. I think the reviewer would agree it's compositional had we written (if z? (ev e1) (ev e2)), but that's clearly equivalent.