birth,rebirth: Add cond-expand, string->es
`cond-expand' allows moving forward with implementing features based on the current bootstrapped state of the system---rebirth will be able to recursively compile itself and introduce new features along the way. `string->es' allows outputting raw ECMAScript, which gives us more control over the code that is generated without having to hard-code it in the compiler itself. * build-aux/bootstrap/birth.scm (fnmap)[cond-expand]: Always yield the empty string (do nothing). * build-aux/bootstrap/rebirth.scm (fnmap)[cond-expand]: Expand `string->es' only. (fnmap)[string->es]: Add macro.master
parent
4702184c33
commit
639948da02
|
@ -377,6 +377,10 @@
|
|||
(("js:console")
|
||||
(string-append "console.log(" (map sexp->es args) ")"))
|
||||
|
||||
;; always expands into nothing; this is just to facilitate its use
|
||||
;; moving forward
|
||||
(("cond-expand") "")
|
||||
|
||||
;; yes, there are more important things to do until we get to the
|
||||
;; point where it's worth implementing proper tail calls
|
||||
(("js:while")
|
||||
|
|
|
@ -398,6 +398,19 @@
|
|||
(("js:console")
|
||||
(string-append "console.log(" (map sexp->es args) ")"))
|
||||
|
||||
;; very primitive cond-expand
|
||||
(("cond-expand")
|
||||
(let* ((clause (car args))
|
||||
(feature (token-value (car clause)))
|
||||
(body (cdr clause)))
|
||||
(case feature
|
||||
(("string->es") (body->es body #f))
|
||||
(else ""))))
|
||||
|
||||
;; output raw code into the compiled ECMAScript (what could go wrong?)
|
||||
(("string->es")
|
||||
(token-value (car args)))
|
||||
|
||||
;; yes, there are more important things to do until we get to the
|
||||
;; point where it's worth implementing proper tail calls
|
||||
(("js:while")
|
||||
|
|
Loading…
Reference in New Issue