On Tue, Jun 27, 2017 at 09:21:59AM -0700, Justin Pombrio wrote: > I'm trying to define a language in Redex that includes a list of top-level > function definitions: > > (p ::= .... > (prog (defun (x x) e) ... e)) > > And all function names should be in scope in all function bodies (other > things should be in scope as well, but I'm ignoring them here for simplicity): > > (prog (defun (x_fun x_param) e_body #:refers-to (shadow x_fun ...)) ... > e_main)) This looks ill-formed to me. Inside e_body, there is only one x_fun bound, so x_fun ... doesn't make sense. This would make sense if you had a multi-argument functions, e.g., (prog (defun (x_fun x ...) e_body #:refers-to (shadow x ...)) ... e_main))
You're trying to express a more complicated binding pattern than merely a list of binders. This is expressing that each definition d inside (prog d ...) exports a name that is bound for all other definitions. You need #:exports. Maybe something like (defun (x_fun x ...) e_body #:refers-to (shadow x ...)) #:exports x_fun (prog d #:...bind (defs d (shadows defs d)))) This may not be quite right yet. (Unfortunately, there is a known bug in Redex that #...bind is undocumented, so you had no way to know about this) -- William J. Bowman -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Description: PGP signature