mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +02:00
Handle input in AST form
This commit is contained in:
parent
fcf2a4b4e0
commit
16a217abf0
1 changed files with 9 additions and 9 deletions
|
@ -49,22 +49,22 @@
|
||||||
(cond
|
(cond
|
||||||
((and-let* (
|
((and-let* (
|
||||||
;; Find lambda with initial #f assignment
|
;; Find lambda with initial #f assignment
|
||||||
((lambda? (car exp)))
|
((ast:lambda? (car exp)))
|
||||||
((pair? (cdr exp)))
|
((pair? (cdr exp)))
|
||||||
((not (cadr exp)))
|
((not (cadr exp)))
|
||||||
(= 1 (length (lambda->formals (car exp))))
|
(= 1 (length (ast:lambda-args (car exp))))
|
||||||
;; Get information for continuation
|
;; Get information for continuation
|
||||||
(loop-sym (car (lambda->formals (car exp))))
|
(loop-sym (car (ast:lambda-args (car exp))))
|
||||||
(inner-exp (car (lambda->exp (car exp))))
|
(inner-exp (car (ast:lambda-body (car exp))))
|
||||||
((app? inner-exp))
|
((app? inner-exp))
|
||||||
((lambda? (car inner-exp)))
|
((ast:lambda? (car inner-exp)))
|
||||||
;; Find the set (assumes CPS conversion)
|
;; Find the set (assumes CPS conversion)
|
||||||
((pair? (cdr inner-exp)))
|
((pair? (cdr inner-exp)))
|
||||||
((set!? (cadr inner-exp)))
|
((set!? (cadr inner-exp)))
|
||||||
((equal? (set!->var (cadr inner-exp)) loop-sym))
|
((equal? (set!->var (cadr inner-exp)) loop-sym))
|
||||||
;; Check the set's continuation
|
;; Check the set's continuation
|
||||||
((app? (car (lambda->exp (car inner-exp)))))
|
((app? (car (ast:lambda-body (car inner-exp)))))
|
||||||
((equal? (caar (lambda->exp (car inner-exp))) loop-sym))
|
((equal? (caar (ast:lambda-body (car inner-exp))) loop-sym))
|
||||||
)
|
)
|
||||||
(write `(found named lambda loop ,loop-sym))
|
(write `(found named lambda loop ,loop-sym))
|
||||||
;; Continue scanning
|
;; Continue scanning
|
||||||
|
@ -135,6 +135,6 @@
|
||||||
#f))))
|
#f))))
|
||||||
|
|
||||||
(scan
|
(scan
|
||||||
;(ast:sexp->ast
|
(ast:sexp->ast
|
||||||
sexp);)
|
sexp))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue