Skip to content

Commit a042b68

Browse files
committed
Rename top-level lisp expand functions to lower
This seems to be more accurate.
1 parent 8183112 commit a042b68

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/jlfrontend.scm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
;; return a lambda expression representing a thunk for a top-level expression
110110
;; note: expansion of stuff inside module is delayed, so the contents obey
111111
;; toplevel expansion order (don't expand until stuff before is evaluated).
112-
(define (expand-toplevel-expr-- e file line)
112+
(define (lower-toplevel-expr-- e file line)
113113
(let ((lno (first-lineno e))
114114
(ex0 (julia-expand-macroscope e)))
115115
(if (and lno (or (not (length= lno 3)) (not (atom? (caddr lno))))) (set! lno #f))
@@ -118,8 +118,8 @@
118118
ex0
119119
(if lno `(toplevel ,lno ,ex0) ex0))
120120
(let* ((linenode (if (and lno (or (= line 0) (eq? file 'none))) lno `(line ,line ,file)))
121-
(ex (julia-expand0 ex0 linenode))
122-
(th (julia-expand1
121+
(ex (julia-lower0 ex0 linenode))
122+
(th (julia-lower1
123123
`(lambda () ()
124124
(scope-block
125125
,(blockify ex lno)))
@@ -142,33 +142,33 @@
142142
error incomplete))
143143
(and (memq (car e) '(global const)) (every symbol? (cdr e))))))
144144

145-
(define *in-expand* #f)
145+
(define *in-lowering* #f)
146146

147-
(define (expand-toplevel-expr e file line)
147+
(define (lower-toplevel-expr e file line)
148148
(cond ((or (atom? e) (toplevel-only-expr? e))
149149
(if (underscore-symbol? e)
150150
(error "all-underscore identifiers are write-only and their values cannot be used in expressions"))
151151
e)
152152
(else
153-
(let ((last *in-expand*))
153+
(let ((last *in-lowering*))
154154
(if (not last)
155155
(begin (reset-gensyms)
156-
(set! *in-expand* #t)))
157-
(begin0 (expand-toplevel-expr-- e file line)
158-
(set! *in-expand* last))))))
156+
(set! *in-lowering* #t)))
157+
(begin0 (lower-toplevel-expr-- e file line)
158+
(set! *in-lowering* last))))))
159159

160160
;; used to collect warnings during lowering, which are usually discarded
161161
;; unless logging is requested
162162
(define lowering-warning (lambda lst (void)))
163163

164164
;; expand a piece of raw surface syntax to an executable thunk
165165

166-
(define (expand-to-thunk- expr file line)
166+
(define (lower-to-thunk- expr file line)
167167
(error-wrap (lambda ()
168-
(expand-toplevel-expr expr file line))))
168+
(lower-toplevel-expr expr file line))))
169169

170-
(define (expand-to-thunk-stmt- expr file line)
171-
(expand-to-thunk- (if (toplevel-only-expr? expr)
170+
(define (lower-to-thunk-stmt- expr file line)
171+
(lower-to-thunk- (if (toplevel-only-expr? expr)
172172
expr
173173
`(block ,expr (null)))
174174
file line))
@@ -188,23 +188,23 @@
188188
(file (if (eq? warn_file 'none) file warn_file)))
189189
(set! warnings (cons (list* 'warn level group (symbol (string file line)) file line lst) warnings))))))
190190
(let ((thunk (if stmt
191-
(expand-to-thunk-stmt- expr file line)
192-
(expand-to-thunk- expr file line))))
191+
(lower-to-thunk-stmt- expr file line)
192+
(lower-to-thunk- expr file line))))
193193
`(,thunk ,(reverse warnings))))))
194194

195195
(define (jl-expand-macroscope expr)
196196
(error-wrap (lambda ()
197197
(julia-expand-macroscope expr))))
198198

199199
(define (jl-default-inner-ctor-body field-kinds file line)
200-
(expand-to-thunk- (default-inner-ctor-body (cdr field-kinds) file line) file line))
200+
(lower-to-thunk- (default-inner-ctor-body (cdr field-kinds) file line) file line))
201201

202202
(define (jl-default-outer-ctor-body args file line)
203-
(expand-to-thunk- (default-outer-ctor-body (cadr args) (caddr args) (cadddr args) file line) file line))
203+
(lower-to-thunk- (default-outer-ctor-body (cadr args) (caddr args) (cadddr args) file line) file line))
204204

205205
; run whole frontend on a string. useful for testing.
206206
(define (fe str)
207-
(expand-toplevel-expr (julia-parse str) 'none 0))
207+
(lower-toplevel-expr (julia-parse str) 'none 0))
208208

209209
(define (profile-e s)
210210
(with-exception-catcher

src/julia-syntax.scm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,7 +5331,7 @@ f(x) = yt(x)
53315331

53325332
;; expander entry point
53335333

5334-
(define (julia-expand1 ex file line)
5334+
(define (julia-lower1 ex file line)
53355335
(compact-and-renumber
53365336
(linearize
53375337
(closure-convert
@@ -5340,7 +5340,7 @@ f(x) = yt(x)
53405340

53415341
(define *current-desugar-loc* #f)
53425342

5343-
(define (julia-expand0 ex lno)
5343+
(define (julia-lower0 ex lno)
53445344
(with-bindings ((*current-desugar-loc* lno))
53455345
(trycatch (expand-forms ex)
53465346
(lambda (e)
@@ -5353,7 +5353,7 @@ f(x) = yt(x)
53535353
(error (string (cadr e) (format-loc *current-desugar-loc*))))
53545354
(raise e)))))
53555355

5356-
(define (julia-expand ex (file 'none) (line 0))
5357-
(julia-expand1
5358-
(julia-expand0
5356+
(define (julia-lower ex (file 'none) (line 0))
5357+
(julia-lower1
5358+
(julia-lower0
53595359
(julia-expand-macroscope ex) `(line ,line ,file)) file line))

0 commit comments

Comments
 (0)