(define-module (system base syntax)
#:export (%compute-initargs)
#:export-syntax (define-type define-record record-case))
-(export-syntax |) ;; emacs doesn't like the |
\f
;;;
;;; Type
;;;
-(define-macro (define-type name sig) sig)
+(define-macro (define-type name . rest)
+ `(begin ,@(map (lambda (def) `(define-record ,def)) rest)))
+
;;;
;;; Record
(if (assq 'else clauses)
clauses
(append clauses `((else (error "unhandled record" ,r))))))))))
-
-
-\f
-;;;
-;;; Variants
-;;;
-
-(define-macro (| . rest)
- `(begin ,@(map (lambda (def) `(define-record ,def)) rest)))
;;;
(define-type <ghil>
- (|
- ;; Objects
- (<ghil-void> env loc)
- (<ghil-quote> env loc obj)
- (<ghil-quasiquote> env loc exp)
- (<ghil-unquote> env loc exp)
- (<ghil-unquote-splicing> env loc exp)
- ;; Variables
- (<ghil-ref> env loc var)
- (<ghil-set> env loc var val)
- (<ghil-define> env loc var val)
- ;; Controls
- (<ghil-if> env loc test then else)
- (<ghil-and> env loc exps)
- (<ghil-or> env loc exps)
- (<ghil-begin> env loc exps)
- (<ghil-bind> env loc vars vals body)
- (<ghil-mv-bind> env loc producer vars rest body)
- (<ghil-lambda> env loc vars rest meta body)
- (<ghil-call> env loc proc args)
- (<ghil-mv-call> env loc producer consumer)
- (<ghil-inline> env loc inline args)
- (<ghil-values> env loc values)
- (<ghil-values*> env loc values)))
+ ;; Objects
+ (<ghil-void> env loc)
+ (<ghil-quote> env loc obj)
+ (<ghil-quasiquote> env loc exp)
+ (<ghil-unquote> env loc exp)
+ (<ghil-unquote-splicing> env loc exp)
+ ;; Variables
+ (<ghil-ref> env loc var)
+ (<ghil-set> env loc var val)
+ (<ghil-define> env loc var val)
+ ;; Controls
+ (<ghil-if> env loc test then else)
+ (<ghil-and> env loc exps)
+ (<ghil-or> env loc exps)
+ (<ghil-begin> env loc exps)
+ (<ghil-bind> env loc vars vals body)
+ (<ghil-mv-bind> env loc producer vars rest body)
+ (<ghil-lambda> env loc vars rest meta body)
+ (<ghil-call> env loc proc args)
+ (<ghil-mv-call> env loc producer consumer)
+ (<ghil-inline> env loc inline args)
+ (<ghil-values> env loc values)
+ (<ghil-values*> env loc values))
+
\f
;;;
(define-record (<glil-vars> nargs nrest nlocs nexts))
(define-type <glil>
- (|
- ;; Meta operations
- (<glil-asm> vars meta body)
- (<glil-bind> vars)
- (<glil-mv-bind> vars rest)
- (<glil-unbind>)
- (<glil-source> loc)
- ;; Objects
- (<glil-void>)
- (<glil-const> obj)
- ;; Variables
- (<glil-argument> op index)
- (<glil-local> op index)
- (<glil-external> op depth index)
- (<glil-toplevel> op name)
- (<glil-module> op mod name public?)
- ;; Controls
- (<glil-label> label)
- (<glil-branch> inst label)
- (<glil-call> inst nargs)
- (<glil-mv-call> nargs ra)))
+ ;; Meta operations
+ (<glil-asm> vars meta body)
+ (<glil-bind> vars)
+ (<glil-mv-bind> vars rest)
+ (<glil-unbind>)
+ (<glil-source> loc)
+ ;; Objects
+ (<glil-void>)
+ (<glil-const> obj)
+ ;; Variables
+ (<glil-argument> op index)
+ (<glil-local> op index)
+ (<glil-external> op depth index)
+ (<glil-toplevel> op name)
+ (<glil-module> op mod name public?)
+ ;; Controls
+ (<glil-label> label)
+ (<glil-branch> inst label)
+ (<glil-call> inst nargs)
+ (<glil-mv-call> nargs ra))
\f
;;;