mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added a special (program) feature
This commit is contained in:
parent
74e56aeb2f
commit
8cbcf82121
2 changed files with 53 additions and 41 deletions
|
@ -547,10 +547,13 @@
|
|||
(in-prog-raw (read-file in-file))
|
||||
(program? (not (library? (car in-prog-raw))))
|
||||
(in-prog
|
||||
(if program?
|
||||
in-prog-raw
|
||||
(cond
|
||||
(program?
|
||||
(Cyc-add-feature! 'program) ;; Load special feature
|
||||
in-prog-raw)
|
||||
(else
|
||||
;; Account for any cond-expand declarations in the library
|
||||
(list (lib:cond-expand (car in-prog-raw) expander))))
|
||||
(list (lib:cond-expand (car in-prog-raw) expander)))))
|
||||
;; TODO: expand in-prog, if a library, using lib:cond-expand. (OK, this works now)
|
||||
;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library
|
||||
(program:imports/code (if program? (import-reduction in-prog expander) '()))
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
(import (scheme base) (scheme write) (scheme cyclone ast) (scheme cyclone util) (scheme cyclone pretty-print))
|
||||
(cond-expand
|
||||
(program
|
||||
(import (scheme base)
|
||||
(scheme write)
|
||||
(scheme cyclone ast)
|
||||
(scheme cyclone util)
|
||||
(scheme cyclone pretty-print))))
|
||||
|
||||
;; Local variable reduction:
|
||||
;; Reduce given sexp by replacing certain lambda calls with a let containing
|
||||
|
@ -122,40 +128,43 @@
|
|||
(return
|
||||
(scan sexp)))))
|
||||
|
||||
(define sexp
|
||||
'(lambda
|
||||
(k$1073 i$88$682 first$89$683 row$90$684)
|
||||
(if (Cyc-fast-eq
|
||||
i$88$682
|
||||
number-of-cols$68$671)
|
||||
(k$1073
|
||||
(Cyc-fast-eq
|
||||
i$88$682
|
||||
number-of-cols$68$671))
|
||||
((lambda
|
||||
(k$1080)
|
||||
(if (Cyc-fast-eq
|
||||
(car first$89$683)
|
||||
(car row$90$684))
|
||||
(k$1080 if-equal$76$674)
|
||||
(k$1080 if-different$77$675)))
|
||||
(lambda
|
||||
(r$1079)
|
||||
(Cyc-seq
|
||||
(vector-set!
|
||||
vec$79$677
|
||||
i$88$682
|
||||
r$1079)
|
||||
((cell-get lp$80$87$681)
|
||||
k$1073
|
||||
(Cyc-fast-plus i$88$682 1)
|
||||
(cdr first$89$683)
|
||||
(cdr row$90$684))))))))
|
||||
|
||||
;(pretty-print
|
||||
; (ast:ast->pp-sexp
|
||||
; (ast:sexp->ast sexp)))
|
||||
|
||||
(pretty-print
|
||||
(ast:ast->pp-sexp
|
||||
(opt:local-var-reduction (ast:sexp->ast sexp))))
|
||||
(cond-expand
|
||||
(program
|
||||
(define sexp
|
||||
'(lambda
|
||||
(k$1073 i$88$682 first$89$683 row$90$684)
|
||||
(if (Cyc-fast-eq
|
||||
i$88$682
|
||||
number-of-cols$68$671)
|
||||
(k$1073
|
||||
(Cyc-fast-eq
|
||||
i$88$682
|
||||
number-of-cols$68$671))
|
||||
((lambda
|
||||
(k$1080)
|
||||
(if (Cyc-fast-eq
|
||||
(car first$89$683)
|
||||
(car row$90$684))
|
||||
(k$1080 if-equal$76$674)
|
||||
(k$1080 if-different$77$675)))
|
||||
(lambda
|
||||
(r$1079)
|
||||
(Cyc-seq
|
||||
(vector-set!
|
||||
vec$79$677
|
||||
i$88$682
|
||||
r$1079)
|
||||
((cell-get lp$80$87$681)
|
||||
k$1073
|
||||
(Cyc-fast-plus i$88$682 1)
|
||||
(cdr first$89$683)
|
||||
(cdr row$90$684))))))))
|
||||
|
||||
;(pretty-print
|
||||
; (ast:ast->pp-sexp
|
||||
; (ast:sexp->ast sexp)))
|
||||
|
||||
(pretty-print
|
||||
(ast:ast->pp-sexp
|
||||
(opt:local-var-reduction (ast:sexp->ast sexp))))
|
||||
))
|
||||
|
|
Loading…
Add table
Reference in a new issue