mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
add more ecmascript compilation -- functions work now
* module/language/ecmascript/parse.scm (parse-ecmascript): Lambdas always just have one member in their bodies. * module/language/ecmascript/compile-ghil.scm (comp): Add some more silly compilers.
This commit is contained in:
parent
b912a1cd6b
commit
8fa6886d7a
2 changed files with 19 additions and 6 deletions
|
@ -59,6 +59,19 @@
|
|||
(make-ghil-inline e l 'div (list (comp a e) (comp b e))))
|
||||
((* ,a ,b)
|
||||
(make-ghil-inline e l 'mul (list (comp a e) (comp b e))))
|
||||
((ref ,id)
|
||||
(make-ghil-ref e l (ghil-var-for-ref! e (string->symbol id))))
|
||||
((define ,id ,val)
|
||||
(make-ghil-define e l (ghil-var-define! (ghil-env-parent e) (string->symbol id))
|
||||
(comp val e)))
|
||||
((begin . ,forms)
|
||||
(make-ghil-begin e l (map (lambda (x) (comp x e)) forms)))
|
||||
((lambda ,formals ,body)
|
||||
(call-with-ghil-environment e formals
|
||||
(lambda (env vars)
|
||||
(make-ghil-lambda env l vars #f '() (comp body env)))))
|
||||
((call ,proc ,args)
|
||||
(make-ghil-call e l (comp proc e) (map (lambda (x) (comp x e)) args)))
|
||||
(else
|
||||
(error "compilation not yet implemented:" x)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue