diff --git a/remix/datalog0.rkt b/remix/datalog0.rkt index 6abcb9c..7d95789 100644 --- a/remix/datalog0.rkt +++ b/remix/datalog0.rkt @@ -2,7 +2,7 @@ (require datalog/runtime (prefix-in stx: datalog/stx) (for-syntax racket/base - remix/raw-stx0 + remix/stx/raw0 datalog/private/compiler datalog/parse syntax/parse)) diff --git a/remix/raw-stx0.rkt b/remix/stx/raw0.rkt similarity index 100% rename from remix/raw-stx0.rkt rename to remix/stx/raw0.rkt diff --git a/remix/stx/singleton-struct0.rkt b/remix/stx/singleton-struct0.rkt new file mode 100644 index 0000000..9a71c33 --- /dev/null +++ b/remix/stx/singleton-struct0.rkt @@ -0,0 +1,29 @@ +#lang racket/base +(require syntax/parse/define) + +(module singleton racket/base + (require (for-syntax racket/base + syntax/parse + racket/syntax)) + (define-syntax (singleton-struct stx) + (syntax-parse stx + [(singleton-struct . struct-args) + (with-syntax ([the-singleton (generate-temporary (syntax-local-name))]) + (syntax/loc stx + (let () + (struct the-singleton () . struct-args) + (the-singleton))))])) + (provide singleton-struct)) +(require (submod "." singleton) + (for-syntax (submod "." singleton))) + +(define-simple-macro (define/singleton-struct singleton:id . struct-args) + (define singleton (singleton-struct . struct-args))) +(define-simple-macro (define-syntax/singleton-struct singleton:id . struct-args) + (define-syntax singleton (singleton-struct . struct-args))) + +(provide + singleton-struct + (for-syntax singleton-struct) + define/singleton-struct + define-syntax/singleton-struct) diff --git a/remix/stx0.rkt b/remix/stx0.rkt index 287f8b0..34eb742 100644 --- a/remix/stx0.rkt +++ b/remix/stx0.rkt @@ -6,6 +6,7 @@ racket/syntax syntax/parse) syntax/parse/define + remix/stx/singleton-struct0 racket/stxparam) ;; xxx add extensibility @@ -51,27 +52,6 @@ (syntax/loc stx (remix-block . body))])) -(module singleton racket/base - (require (for-syntax racket/base - syntax/parse - racket/syntax)) - (define-syntax (singleton-struct stx) - (syntax-parse stx - [(singleton-struct . struct-args) - (with-syntax ([the-singleton (generate-temporary (syntax-local-name))]) - (syntax/loc stx - (let () - (struct the-singleton () . struct-args) - (the-singleton))))])) - (provide singleton-struct)) -(require (submod "." singleton) - (for-syntax (submod "." singleton))) - -(define-simple-macro (define/singleton-struct singleton:id . struct-args) - (define singleton (singleton-struct . struct-args))) -(define-simple-macro (define-syntax/singleton-struct singleton:id . struct-args) - (define-syntax singleton (singleton-struct . struct-args))) - (begin-for-syntax (define-generics binary-operator (binary-operator-precedence binary-operator))