You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to specify a language that has a sort of rudimentary module system. The idea is that a module consists of 0 or more imports (which are themselves modules), 0 or more definitions, and an expression. The names defined in the definitions are exported to clients of the module.
While working on this, I managed to trigger a contract violation error from substitution. Here's a cut-down version of what I was writing:
#lang racket
(require redex)
(define-language L
(x variable-not-otherwise-mentioned)
(e number x)
(decl (define x e) (define-const x number))
(imports (import prog ...))
(prog (unit
imports
decl ...
e))
#:binding-forms
(define x e) #:exports x
(define-const x number) #:exports x
(import prog_imports
#:...bind (imported-vars prog_imports (shadow imported-vars prog_imports))) #:exports imported-vars
(unit imports_libs decl_def #:...bind (defined-vars decl_def (shadow defined-vars decl_def)) e #:refers-to (shadow imports_libs defined-vars ...))
)
(define test-program
(term (unit (import) (define-const x 1) (define y x) y)))
(term (substitute ,test-program y 444) #:lang L)
I was trying to specify a language that has a sort of rudimentary module system. The idea is that a module consists of 0 or more imports (which are themselves modules), 0 or more definitions, and an expression. The names defined in the definitions are exported to clients of the module.
While working on this, I managed to trigger a contract violation error from substitution. Here's a cut-down version of what I was writing:
yields
The text was updated successfully, but these errors were encountered: