[gambit-list] Information about the Gambit-C Javascript Backend

Marc Feeley feeley at iro.umontreal.ca
Fri Jul 19 11:37:30 EDT 2019


Like so:

% cd gambit
% cd lib
% make _gambit.js
../gsc/gsc -:~~bin=../bin,~~lib=../lib,~~include=../include -f -target js  -prelude "(define-cond-expand-feature|enable-type-checking|)(define-cond-expand-feature|disable-auto-forcing|)(define-cond-expand-feature|enable-sharp-dot|)(define-cond-expand-feature|enable-bignum|)(define-cond-expand-feature|enable-ratnum|)(define-cond-expand-feature|enable-cpxnum|)(define-cond-expand-feature|disable-smp|)(##include\"../lib/header.scm\")" -o _gambit.js ../lib/_univlib.scm
% cd ..
% gsc/gsc -:=. -target js -exe app.scm
% ./app
1
256
65536
16777216
4294967296
1099511627776
281474976710656
72057594037927936
18446744073709551616
4722366482869645213696
1208925819614629174706176
309485009821345068724781056
79228162514264337593543950336
20282409603651670423947251286016
5192296858534827628530496329220096
1329227995784915872903807060280344576
340282366920938463463374607431768211456
87112285931760246646623899502532662132736
22300745198530623141535718272648361505980416
5708990770823839524233143877797980545530986496
% cat app.scm
(define n 20)
(for-each (lambda (i)
            (println (object->string (expt 2 (* i 8)))))
          (iota n))
(exit)

This should work for the other backends too.  Note that there’s some bit rot of lib/univlib.scm, so there are issues with some parts of the Gambit library (for example write and pretty-print are broken, (exit) is needed to avoid an exception on exit, etc).  You can revert to previous recent releases of Gambit to get these working correctly.

Sorry but lots of things are in flux right now…

Marc



> On Jul 19, 2019, at 11:08 AM, Amirouche Boubekki <amirouche.boubekki at gmail.com> wrote:
> 
> Sorry for the multiple emails!
> 
> Le ven. 19 juil. 2019 à 13:38, Marc Feeley <feeley at iro.umontreal.ca> a écrit :
> You should look at this recent thread: https://mailman.iro.umontreal.ca/pipermail/gambit-list/2019-July/009103.html
> 
> In the above mail thread, it is described how to compile a scheme file into javascript WITHOUT "Gambit runtime".
> 
> Q: How can I bundle the Gambit runtime into the compiled JavaScript file?
> 
> 
> Thanks in advance!





More information about the Gambit-list mailing list