(module forms mzscheme (provide interface module* module/impl invoke compound module-begin) (require-for-syntax "syntax-indirection.scm" "syntax-errors.scm" "expansion.scm") (define-syntax interface expand-interface) (define-syntax invoke expand-invoke) (define-syntax compound expand-compound) (define-syntax module/impl expand-module/impl) (define-syntax (module* stx) (syntax-case stx () [(m . rest) (quasisyntax/loc stx (module/impl impl #,stx . rest))])) (define-for-syntax top-level-error-message "only INTERFACE, MODULE, COMPOUND, or INVOKE allowed at top level") (define-syntax (module-term stx) (syntax-case stx () [(mt term) (syntax-case #'term (interface module* invoke compound) [(interface . _) #'term] [(module* . _) #'term] [(invoke . _) #'term] [(compound . _) #'term] [_ (syntax/loc #'term ((current-print) term))])])) (define-syntax (module-begin stx) (syntax-case/error stx () [(mb form ...) (syntax/loc stx (#%plain-module-begin (module-term form) ...))])) )