[plt-scheme] reduction-semantics with multiple languages
Consider the following definition of two (completely useless)
languages using the reduction-semantics collection:
(module toy mzscheme
(require (lib "reduction-semantics.ss" "reduction-semantics")
(lib "gui.ss" "reduction-semantics" ))
(define lang2
(language (e (x e)
(- e)
number)
(x (variable-except foo))))
(define lang
(language (e (x e)
(- e)
number)
(x (variable-except -))))
(define reductions
(list
(reduction lang
(x_ e_)
(term e_))
(reduction lang
(- e_)
(- (term e_)))))
(traces lang reductions '(- 27)))
The term (- 27) should have only one possible reduction in
LANG. However, if LANG2 is defined as above (and before LANG) the
tracer shows two possible reductions in LANG (27 and -27). The system
obviously uses LANG2's definition of X. Changing the definition of the
non-terminal X in LANG2 to LANG's definitions fixes the problem. I
don't think it's intensional that the definitions of the languages
affect each other. I'm using PLT 208p1. Can anybody tell me what's
going wrong here?
--
Martin