michaelballantyne / syntax-spec

A metalanguage for creating sophisticated DSLs in Racket.
Other
27 stars 6 forks source link

`#:bind-literal-set` doesn't work with `#:binding-space` #16

Open camoy opened 9 months ago

camoy commented 9 months ago
(require (for-syntax syntax/parse)
         syntax-spec)

(syntax-spec
 (nonterminal nt
   #:bind-literal-set lits
   #:binding-space sp
   (foo e:racket-expr))

 (host-interface/expression
  (bar e:nt)
  #'(translate e)))

(define-syntax translate
  (syntax-parser
    #:literal-sets (lits)
    [(_ (foo e)) #'e]))

(bar (foo (+ 1 2)))

gives me

; /home/camoy/tmp/blah.rkt:14:4: translate: expected the identifier `foo'
;   at: foo
;   in: (translate (foo (#%host-expression (+ 1 2))))
;   Source locations:
;   /home/camoy/tmp/blah.rkt:10:4

but it works without the binding space.

michaelballantyne commented 6 months ago

I think supporting this combination would require adding support for binding spaces to syntax-parse and define-literal-set.