Skip to content

Commit f94194b

Browse files
committed
New symbol->label strategy.
Avoids the hash-eq-code approach; resulting labels are computed strictly as a function of input symbol, not dependent on memory location. So Outlaw compiler and compiled compiler emit same labels.
1 parent 56f196d commit f94194b

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

langs/outlaw/utils.rkt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
(string->symbol
1515
(string-append
1616
prefix
17-
(list->string
18-
(map (λ (c)
19-
(if (or (char<=? #\a c #\z)
20-
(char<=? #\A c #\Z)
21-
(char<=? #\0 c #\9)
22-
(memq c '(#\_ #\$ #\# #\@ #\~ #\. #\?)))
23-
c
24-
#\_))
25-
(string->list (symbol->string s))))
26-
"_"
27-
(number->string (eq-hash-code s) 16))))
17+
(apply string-append
18+
(map (λ (c)
19+
(if (or (char<=? #\a c #\z)
20+
(char<=? #\A c #\Z)
21+
(char<=? #\0 c #\9)
22+
(memq c '(#\_ #;#\$ #\# #\@ #\~ #\. #\?)))
23+
(make-string 1 c)
24+
(string-append "$" (number->string (char->integer c) 16))))
25+
(string->list (symbol->string s)))))))
2826

2927
;; Id CEnv -> [Maybe Integer]
3028
(define (lookup x cenv)

0 commit comments

Comments
 (0)