|
12 | 12 |
|
13 | 13 | ;; A rule represents "find-and-replacing" `input` by `output`. Both |
14 | 14 | ;; are patterns, meaning that symbols represent pattern variables. |
15 | | -(struct rule (name input output itypes otype tags) |
| 15 | +(struct rule (name input output tags) |
16 | 16 | #:methods gen:custom-write |
17 | 17 | [(define (write-proc rule port mode) |
18 | 18 | (fprintf port "#<rule ~a>" (rule-name rule)))]) |
|
31 | 31 | (define (*sound-rules*) |
32 | 32 | (filter (conjoin rule-enabled? rule-sound?) *all-rules*)) |
33 | 33 |
|
34 | | -; An analog of free-variables due to cycles in loading |
35 | | -(define (get-input-variables prog) |
36 | | - (match prog |
37 | | - [(? number?) '()] |
38 | | - [(? symbol?) (list prog)] |
39 | | - [(list _ args ...) (remove-duplicates (append-map get-input-variables args))])) |
40 | | - |
41 | | -(define (make-rule-context input output) |
42 | | - (map (curryr cons 'real) (set-union (get-input-variables input) (get-input-variables output)))) |
43 | | - |
44 | 34 | (define (add-unsound expr) |
45 | 35 | (match expr |
46 | 36 | [(list op args ...) (cons (sym-append "unsound-" op) (map add-unsound args))] |
|
49 | 39 | (define-syntax define-rule |
50 | 40 | (syntax-rules () |
51 | 41 | [(define-rule rname group input output) |
52 | | - (set! *all-rules* |
53 | | - (cons (rule 'rname 'input 'output (make-rule-context 'input 'output) 'real '(group sound)) |
54 | | - *all-rules*))] |
| 42 | + (set! *all-rules* (cons (rule 'rname 'input 'output '(group sound)) *all-rules*))] |
55 | 43 | [(define-rule rname group input output #:unsound) |
56 | | - (set! |
57 | | - *all-rules* |
58 | | - (cons |
59 | | - (rule 'rname 'input (add-unsound 'output) (make-rule-context 'input 'output) 'real '(group)) |
60 | | - *all-rules*))])) |
| 44 | + (set! *all-rules* (cons (rule 'rname 'input (add-unsound 'output) '(group)) *all-rules*))])) |
61 | 45 |
|
62 | 46 | (define-syntax-rule (define-rules group |
63 | 47 | [rname input output flags ...] ...) |
|
0 commit comments