Issue #552 - Add 'else' clause for cond-expands

This commit is contained in:
Justin Ethier 2025-01-18 10:38:35 -08:00
parent 2d833cd6c1
commit c325a8a8e5
4 changed files with 21 additions and 11 deletions

View file

@ -20,7 +20,8 @@
(srfi 2) (srfi 2)
(srfi 69) (srfi 69)
) )
)) )
(else #f))
;; symbol -> hash-table -> boolean ;; symbol -> hash-table -> boolean
;; Is it OK to inline code replacing ref, based on call graph data from lookup table? ;; Is it OK to inline code replacing ref, based on call graph data from lookup table?
@ -261,4 +262,5 @@
; (ast:ast->pp-sexp ; (ast:ast->pp-sexp
; (opt:local-var-reduction (ast:sexp->ast sexp))) ; (opt:local-var-reduction (ast:sexp->ast sexp)))
;) ;)
)) )
(else #f))

View file

@ -14,7 +14,9 @@
(scheme cyclone ast) (scheme cyclone ast)
(scheme cyclone primitives) (scheme cyclone primitives)
(scheme cyclone util) (scheme cyclone util)
(scheme cyclone pretty-print)))) (scheme cyclone pretty-print)))
(else
#f))
;; Local variable reduction: ;; Local variable reduction:
;; Reduce given sexp by replacing certain lambda calls with a let containing ;; Reduce given sexp by replacing certain lambda calls with a let containing
@ -434,4 +436,5 @@
(ast:ast->pp-sexp (ast:ast->pp-sexp
(opt:local-var-reduction (ast:sexp->ast sexp))) (opt:local-var-reduction (ast:sexp->ast sexp)))
) )
)) )
(else #f))

View file

@ -18,9 +18,9 @@
(scheme cyclone util) (scheme cyclone util)
(scheme cyclone pretty-print) (scheme cyclone pretty-print)
(srfi 2) (srfi 2)
(srfi 69) (srfi 69)))
) (else
)) #f))
;; Predicate to determine if a function can be memoized ;; Predicate to determine if a function can be memoized
;; var - symbol - global name of the function ;; var - symbol - global name of the function
@ -371,4 +371,5 @@
;; ; (ast:ast->pp-sexp ;; ; (ast:ast->pp-sexp
;; ; (opt:local-var-reduction (ast:sexp->ast sexp))) ;; ; (opt:local-var-reduction (ast:sexp->ast sexp)))
;; ;) ;; ;)
)) )
(else #f))

View file

@ -14,7 +14,8 @@
(scheme base) (scheme base)
(scheme read) (scheme read)
(scheme cyclone pretty-print) (scheme cyclone pretty-print)
(scheme cyclone util)))) (scheme cyclone util)))
(else #f))
;; ;;
;; TODO: call this from cyclone.scm after it works, probably after "resolve macros" ;; TODO: call this from cyclone.scm after it works, probably after "resolve macros"
@ -59,7 +60,9 @@
(define (search exp vars) (define (search exp vars)
(cond-expand (cond-expand
(program (program
(pretty-print `(search ,exp ,vars))(newline))) ;; Debugging (pretty-print `(search ,exp ,vars))(newline)) ;; Debugging
(else
#f))
(cond (cond
;((ast:lambda? exp) 'TODO) ;((ast:lambda? exp) 'TODO)
((const? exp) #f) ((const? exp) #f)
@ -111,4 +114,5 @@
;(if 1 2 3 4) ;(if 1 2 3 4)
(let ((sexp (read-all (open-input-file "validation.scm")))) (let ((sexp (read-all (open-input-file "validation.scm"))))
(validate-keyword-syntax sexp)))) (validate-keyword-syntax sexp)))
(else #f))