Skip to content

Commit 55fd399

Browse files
authored
Merge pull request #1360 from herbie-fp/codex/define-default-flags-and-debug-flags
Refactor flag configuration
2 parents e1e8720 + 51070af commit 55fd399

File tree

1 file changed

+15
-33
lines changed

1 file changed

+15
-33
lines changed

src/config.rkt

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
#lang racket
22

3+
(require racket/hash)
4+
35
(provide (all-defined-out))
46

57
;;; Flags
68

7-
(define all-flags
8-
#hash([precision . (double fallback)]
9-
[setup . (simplify search)]
10-
[localize . (costs errors)]
11-
[generate . (rr taylor simplify better-rr proofs egglog evaluate)]
12-
[reduce . (regimes avg-error binary-search branch-expressions simplify)]
13-
[rules
14-
. (arithmetic polynomials
15-
fractions
16-
exponents
17-
trigonometry
18-
hyperbolic
19-
numerics
20-
special
21-
bools
22-
branches)]
23-
[dump . (egg rival egglog)]))
24-
259
(define default-flags
2610
#hash([precision . ()]
2711
[setup . (search)]
@@ -31,22 +15,20 @@
3115
[rules . (arithmetic polynomials fractions exponents trigonometry hyperbolic)]
3216
[dump . ()]))
3317

18+
(define deprecated-flags
19+
#hash([precision . (double fallback)]
20+
[setup . (simplify)]
21+
[localize . (costs errors)]
22+
[generate . (better-rr simplify)]
23+
[reduce . (avg-error simplify)]
24+
[rules . (numerics special bools branches)]))
25+
26+
(define debug-flags #hash([generate . (egglog)] [dump . (egg rival egglog)]))
27+
28+
(define all-flags (hash-union default-flags deprecated-flags debug-flags #:combine set-union))
29+
3430
(define (flag-deprecated? category flag)
35-
(match* (category flag)
36-
[('precision 'double) #t]
37-
[('precision 'fallback) #t]
38-
[('setup 'simplify) #t]
39-
[('generate 'better-rr) #t]
40-
[('generate 'simplify) #t]
41-
[('reduce 'simplify) #t]
42-
[('reduce 'avg-error) #t]
43-
[('localize 'costs) #t]
44-
[('localize 'errors) #t]
45-
[('rules 'numerics) #t]
46-
[('rules 'special) #t]
47-
[('rules 'bools) #t]
48-
[('rules 'branches) #t]
49-
[(_ _) #f]))
31+
(set-member? (dict-ref deprecated-flags category '()) flag))
5032

5133
; `hash-copy` returns a mutable hash, which makes `dict-update` invalid
5234
(define *flags* (make-parameter (make-immutable-hash (hash->list default-flags))))

0 commit comments

Comments
 (0)