File tree Expand file tree Collapse file tree 3 files changed +8
-48
lines changed Expand file tree Collapse file tree 3 files changed +8
-48
lines changed Original file line number Diff line number Diff line change 14
14
(eq (symbol-package s) builtin-package)))
15
15
16
16
; ; Getting them via do-external-symbols doesn't preserve the order, so here we are...
17
- (defparameter *builtin-list*
17
+ (deflexical +builtins+
18
18
(list ' lurk.builtin:atom
19
19
' lurk.builtin:apply
20
20
' lurk.builtin:begin
57
57
' lurk.builtin:breakpoint
58
58
' lurk.builtin:fail))
59
59
60
+ (loop for sym in +builtins+ for i from 0
61
+ do (setf (get sym ' idx) i))
62
+
60
63
; ; Forgive the heresy.
61
- (defun builtin-idx (b)
62
- (case b
63
- (lurk.builtin :atom 0 )
64
- (lurk.builtin :apply 1 )
65
- (lurk.builtin :begin 2 )
66
- (lurk.builtin :car 3 )
67
- (lurk.builtin :cdr 4 )
68
- (lurk.builtin :char 5 )
69
- (lurk.builtin :commit 6 )
70
- (lurk.builtin :comm 7 )
71
- (lurk.builtin :bignum 8 )
72
- (lurk.builtin :cons 9 )
73
- (lurk.builtin :current-env 10 )
74
- (lurk.builtin :emit 11 )
75
- (lurk.builtin :empty-env 12 )
76
- (lurk.builtin :eval 13 )
77
- (lurk.builtin :eq 14 )
78
- (lurk.builtin :eqq 15 )
79
- (lurk.builtin :type-eq 16 )
80
- (lurk.builtin :type-eqq 17 )
81
- (lurk.builtin :hide 18 )
82
- (lurk.builtin :if 19 )
83
- (lurk.builtin :lambda 20 )
84
- (lurk.builtin :let 21 )
85
- (lurk.builtin :letrec 22 )
86
- (lurk.builtin :u64 23 )
87
- (lurk.builtin :open 24 )
88
- (lurk.builtin :quote 25 )
89
- (lurk.builtin :secret 26 )
90
- (lurk.builtin :strcons 27 )
91
- (lurk.builtin :list 28 )
92
- (lurk.builtin :+ 29 )
93
- (lurk.builtin :- 30 )
94
- (lurk.builtin :* 31 )
95
- (lurk.builtin :/ 32 )
96
- (lurk.builtin :% 33 )
97
- (lurk.builtin := 34 )
98
- (lurk.builtin :< 35 )
99
- (lurk.builtin :> 36 )
100
- (lurk.builtin :<= 37 )
101
- (lurk.builtin :>= 38 )
102
- (lurk.builtin :breakpoint 39 )
103
- (lurk.builtin :fail 40 )
104
- ))
64
+ (defun builtin-idx (b) (get b ' idx))
105
65
106
66
; ; bignum is reserved.
107
67
(deftype wide-num () ' (unsigned-byte 256 ))
Original file line number Diff line number Diff line change 606
606
collect (list sym-value (dual i))))
607
607
608
608
(defun initial-builtin-digest-mem ()
609
- (loop for b in *builtin-list*
609
+ (loop for b in +builtins+
610
610
for i from 0
611
611
for builtin-value = (wide-ptr-value (intern-wide-ptr b))
612
612
collect (list builtin-value (dual i))))
Original file line number Diff line number Diff line change 61
61
(:import-from # :allocation # :*program* # :lurk-allocation # :allocation-tag-names # :element # :wide # :wide-elements # :wide-nth
62
62
# :make-wide # :widen # :wide-ptr # :make-wide-ptr # :wide-ptr-tag # :wide-ptr-value # :tag-name # :tag-value
63
63
# :tag # :== # :hash-cache # :hash # :unhash # :+element-bits+ # :nth-tag)
64
- (:export # :builtin-idx # :*builtin-list* # :intern-wide-ptr # :num # :env # :thunk # :fun))
64
+ (:export # :builtin-idx # :+builtins+ # :intern-wide-ptr # :num # :env # :thunk # :fun))
65
65
66
66
(defpackage evaluation
67
67
(:use # :common-lisp)
77
77
(:import-from # :allocation # :*program* # :element # :dual-element # :ptr # :make-ptr # :ptr-tag # :ptr-value # :wide-ptr # :make-wide-ptr # :wide-ptr-tag # :wide-ptr-value # :make-wide
78
78
# :widen # :wide # :wide-elements # :wide-nth # :element # :tag # :tag-name # :tag-value # :tag-address # :nth-tag # :lurk-allocation
79
79
# :allocation-tag-names # :alloc # :hash-cache # :hash # :unhash # :+element-bits+ # :is-tag-p # :has-tag-p)
80
- (:import-from # :data # :builtin-idx # :*builtin-list* # :intern-wide-ptr # :num # :env # :thunk # :fun))
80
+ (:import-from # :data # :builtin-idx # :+builtins+ # :intern-wide-ptr # :num # :env # :thunk # :fun))
81
81
82
82
(defpackage loam
83
83
(:use # :common-lisp)
You can’t perform that action at this time.
0 commit comments