First import of rash-makefile

This commit is contained in:
2026-08-17 21:42:02 +02:00
parent ba34698037
commit 0c47f0169f
8 changed files with 226 additions and 14 deletions
+44
View File
@@ -0,0 +1,44 @@
#lang racket/base
(require (except-in racket-makefile make)
(only-in racket-makefile [make make/procedure])
(for-syntax racket/base
syntax/parse
linea/line-macro-prop))
(provide (except-out (all-from-out racket-makefile) make/procedure)
make)
;; In an ordinary Racket expression, `make` remains the first-class procedure
;; exported by racket-makefile. In Linea/Rash line syntax the same identifier
;; gets a second meaning: bare target names are converted to symbols before the
;; procedure is called.
(begin-for-syntax
(define (target-argument->expression stx)
(syntax-parse stx
[(quote value)
stx]
[id:id
#`(quote #,(syntax-e #'id))]
[_
stx]))
(struct make-line-binding (target)
#:property prop:procedure
(λ (self stx)
(syntax-parse stx
[id:id
(make-line-binding-target self)]
[(id argument ...)
#`(#,(make-line-binding-target self) argument ...)]))
#:property prop:line-macro
(λ (self stx)
(syntax-parse stx
[(_ argument ...)
(define arguments
(map target-argument->expression
(syntax->list #'(argument ...))))
#`(#,(make-line-binding-target self) #,@arguments)]))))
(define-syntax make
(make-line-binding #'make/procedure))