Hello.<br><br>I have this reader in pltcollects/masm/lang/reader.ss<br><br>-------<br>(module reader syntax/module-reader<br> -ignored-<br> ;; Reads and expands the module; then, use process-body on the module definitions and<br>
;; expressions, to efectivelly remove (replace by (void)) the application expressions and<br> ;; define all variables to be null.<br> #:wrapper2<br> (lambda (in read stx?)<br> (let ([mod (let ([m (read in)])<br> (if stx? m (datum->syntax #f m)))])<br>
(syntax-case mod ()<br> [(module name lang* . body)<br> (let ([lang `(file ,(path->string (resolved-module-path-name masm-lang-path)))])<br> (with-syntax ([lang (datum->syntax #'lang* lang #'lang*)])<br>
(let ([expanded-mod (parameterize ([current-namespace (make-base-namespace)])<br> (expand #'(module name lang . body)))])<br> (let ([r (syntax-case expanded-mod ()<br>
[(module name lang (module-begin . body*))<br> (with-syntax ([body (process-body #'body*)])<br> (syntax/loc mod (module name lang (module-begin . body))))])])<br>
(if stx? r (syntax->datum r))))))])))<br><br> (require scheme/runtime-path)<br> (define-runtime-module-path masm-lang-path "../masm-lang.ss")<br><br> (define (process-body body)<br> (datum->syntax body (map process-form (syntax->list body))))<br>
<br> (define (process-form stx)<br> (syntax-case stx (define-values #%app)<br> [(define-values (id) value)<br> #'(define-values (id) (void))]<br> [(#%app . _)<br> #'(void)]<br> [_<br>
(error "unsupported form" (syntax->datum stx))]))<br> )<br>-------<br><br>and this in pltcollects/masm/masm-lang.ss<br><br>-------<br>#lang scheme<br><br>(define-syntax (_#%module-begin stx)<br> (syntax-case stx ()<br>
[(_ . forms)<br> #'(#%plain-module-begin . forms)]))<br><br>(provide (rename-out (_#%module-begin #%module-begin))<br> define<br> #%app<br> #%datum)<br>-------<br><br>. When I tried to use this language with the code<br>
<br>-------<br>#lang masm<br><br>(define x (2 1))<br><br>(1 2)<br>-------<br><br>I was expecting no error. But I got "pltcollects/masm/lang/reader.ss:36:7: unsupported form (#%app (quote 1) (quote 2))".<br>The process-form procedure matches the literal define-values, but not the literal #%app. Why does this happen?<br>
I tried to require #%app from scheme module both at phases 0 an 1, but it still does not work. I was thinking that the problem could be the (make-base-namespace), but using module->namespace with the masm-lang.ss module does not work. What am I missing?<br>
<br>Thanks.<br><br>Marco<br>