[gambit-list] Gambit JS backend
Alexander Shendi
Alexander.Shendi at web.de
Tue Sep 24 10:03:36 EDT 2013
Dear List,
I am trying to use the Gambit-Scheme JS-backend. I am using the 4.7.0 release. I compiled the following
program (obtained from this list) with:
gsc -c -target js fib.scm
;; ===================== fib.scm ===============================
(declare (standard-bindings)
(extended-bindings)
(not safe)
(fixnum)
(block))
(define (fib n)
(define (fib n)
(if (< n 2)
n
(+ (fib (- n 1))
(fib (- n 2)))))
(fib n))
(println (fib 30))
;; EOF
I tried to run it:
node fib.js
/home/alexshendi/sources/gambit/fib.js:42
print(obj);
^
ReferenceError: print is not defined
at Gambit_println (/home/alexshendi/sources/gambit/fib.js:42:3)
at Object.Gambit_bb1_println [as println] (/home/alexshendi/sources/gambit/fib.js:66:3)
at Gambit_bb4__20_fib (/home/alexshendi/sources/gambit/fib.js:119:31)
at Gambit_bb3__20_fib (/home/alexshendi/sources/gambit/fib.js:104:12)
at Gambit_trampoline (/home/alexshendi/sources/gambit/fib.js:21:10)
at Object.<anonymous> (/home/alexshendi/sources/gambit/fib.js:252:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Now I have the following questions:
* Apparently the generated code is for another JS implementation (Spidermonkey?)?
* How do I access e.g. console.log() from scheme?
* I tried to use the standard Scheme functions "display" and "newline"
from fib.scm, but that didn't work. How do I use them?
* Where do I find more info on the JS backend?
Many thanks in advance for your help.
Best Regrads,
Alexander
More information about the Gambit-list
mailing list