blob: 85ea0ce3cfdb49dc36a42b33bb03d34561ee0641 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#lang racket
(require syntax/location)
(require (for-syntax syntax/location))
(define-syntax-rule (dbg body)
(let ([res body])
(eprintf "[~a:~a] ~v = ~a~%"
(syntax-source-file-name #'body)
(syntax-line #'body)
'body
res)
res))
(define-syntax-rule (err msg)
(error 'error
(format "[~a:~a] ~a"
(syntax-source-file-name #'msg)
(syntax-line #'msg)
msg)))
(define-syntax-rule (note msg)
(eprintf "~a~%" msg))
(define-syntax (todo stx)
(with-syntax ([src (syntax-source-file-name stx)] [line (syntax-line stx)])
#'(error 'todo (format "[~a:~a] unimplemented" src line))))
; todo: write a trace macro
; todo: write a fmt alias to format
; todo: write a namer
(provide dbg err note todo)
; todo: how to provide everything??
|