Hello, I tried to to use the transpiler: gsc -target js hello.scm with hello.scm containing : (display "hello word") And i have the error message : *** ERROR IN "hello.js"@74.39 -- Datum expected
The version i use was install by chocolatey : gambit v4.6.6.20121126
what's wrong?
Afficher les réponses par date
Your version of Gambit is way too old. You need the latest version (v4.9.4). The documentation (https://gambitscheme.org/latest/manual/) gives the details on how to use the compiler. For a simple use-case of the JavaScript backend you can do this (which executes the JavaScript code with nodejs):
$ cat hello.scm (define msg "hello world!\n") (display msg) $ gsc -target js -exe -o hello.js hello.scm $ node hello.js hello world!
Here is an example which executes the JavaScript code in the browser:
$ cat hello-web.scm (define msg "hello world!\n") (display msg) (define (alert str) (##inline-host-statement "alert(@scm2host@(@1@));" str)) (alert msg) $ gsc -target js -exe -o hello-web.html hello-web.scm $ open hello-web.html
Note that by default `display` will send its output to the browser’s JavaScript console, i.e. the same place as the JavaScript console.log(…). The last 2 lines of the program call the JavaScript `alert` function to also show the message in a dialog box.
Finally, `display` can be called with the port corresponding to the web REPL (which is implemented by the Gambit runtime library through a browser dialog box):
$ cat hello-web-repl.scm (define msg "hello world!\n") (display msg (repl-output-port)) (##repl-debug) ;; start a REPL in a dialog box $ gsc -target js -exe -o hello-web-repl.html hello-web-repl.scm $ open hello-web-repl.html
The web REPL is a good way to do “live debugging” of the Scheme program. It also allows tinkering with JavaScript. For example, you could get the current date at the web REPL by entering:
(host-eval "new Date().toString()")
There’s also a JavaScript FFI based on infix syntax for an even more user-friendly way to interface to JavaScript. Please visit try.gambitscheme.org for a demo (wait a few seconds for it to start automatically). The demo shows off several features, such as the FFI, single-stepping, importing R7RS modules from the web, and the thread system.
Marc
On Feb 11, 2022, at 5:37 AM, Jean-François Trevien jef.trevien@gmail.com wrote:
Hello, I tried to to use the transpiler: gsc -target js hello.scm with hello.scm containing : (display "hello word") And i have the error message : *** ERROR IN "hello.js"@74.39 -- Datum expected
The version i use was install by chocolatey : gambit v4.6.6.20121126
what's wrong? _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list
Thanks a lot, by building gambit from source on ubuntu i make it work. Do you have some pointer to make or load a windows version?
Le ven. 11 févr. 2022 à 15:00, Marc Feeley feeley@iro.umontreal.ca a écrit :
Your version of Gambit is way too old. You need the latest version (v4.9.4). The documentation (https://gambitscheme.org/latest/manual/) gives the details on how to use the compiler. For a simple use-case of the JavaScript backend you can do this (which executes the JavaScript code with nodejs):
$ cat hello.scm (define msg "hello world!\n") (display msg) $ gsc -target js -exe -o hello.js hello.scm $ node hello.js hello world!
Here is an example which executes the JavaScript code in the browser:
$ cat hello-web.scm (define msg "hello world!\n") (display msg) (define (alert str) (##inline-host-statement "alert(@scm2host@(@1@));" str)) (alert msg) $ gsc -target js -exe -o hello-web.html hello-web.scm $ open hello-web.html
Note that by default `display` will send its output to the browser’s JavaScript console, i.e. the same place as the JavaScript console.log(…). The last 2 lines of the program call the JavaScript `alert` function to also show the message in a dialog box.
Finally, `display` can be called with the port corresponding to the web REPL (which is implemented by the Gambit runtime library through a browser dialog box):
$ cat hello-web-repl.scm (define msg "hello world!\n") (display msg (repl-output-port)) (##repl-debug) ;; start a REPL in a dialog box $ gsc -target js -exe -o hello-web-repl.html hello-web-repl.scm $ open hello-web-repl.html
The web REPL is a good way to do “live debugging” of the Scheme program. It also allows tinkering with JavaScript. For example, you could get the current date at the web REPL by entering:
(host-eval "new Date().toString()")
There’s also a JavaScript FFI based on infix syntax for an even more user-friendly way to interface to JavaScript. Please visit try.gambitscheme.org for a demo (wait a few seconds for it to start automatically). The demo shows off several features, such as the FFI, single-stepping, importing R7RS modules from the web, and the thread system.
Marc
On Feb 11, 2022, at 5:37 AM, Jean-François Trevien <
jef.trevien@gmail.com> wrote:
Hello, I tried to to use the transpiler: gsc -target js hello.scm with hello.scm containing : (display "hello word") And i have the error message : *** ERROR IN "hello.js"@74.39 -- Datum expected
The version i use was install by chocolatey : gambit v4.6.6.20121126
what's wrong? _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list
As a byproduct of github's continuous integration actions, some artifacts are generated including .zip files of Gambit for the major operating systems. For example, for the latest commit see https://github.com/gambit/gambit/actions/runs/1821202393 .
At the bottom of that page you can see the artifacts (see attached screenshot). The last 3 are various configurations for Windows. If you use the Microsoft Visual-C compiler in your normal workflow then click the last link to download it, otherwise use one of the MinGW versions.
Marc
On Feb 13, 2022, at 3:50 PM, Jean-François Trevien jef.trevien@gmail.com wrote:
Thanks a lot, by building gambit from source on ubuntu i make it work. Do you have some pointer to make or load a windows version?
Le ven. 11 févr. 2022 à 15:00, Marc Feeley feeley@iro.umontreal.ca a écrit : Your version of Gambit is way too old. You need the latest version (v4.9.4). The documentation (https://gambitscheme.org/latest/manual/) gives the details on how to use the compiler. For a simple use-case of the JavaScript backend you can do this (which executes the JavaScript code with nodejs):
$ cat hello.scm (define msg "hello world!\n") (display msg) $ gsc -target js -exe -o hello.js hello.scm $ node hello.js hello world!
Here is an example which executes the JavaScript code in the browser:
$ cat hello-web.scm (define msg "hello world!\n") (display msg) (define (alert str) (##inline-host-statement "alert(@scm2host@(@1@));" str)) (alert msg) $ gsc -target js -exe -o hello-web.html hello-web.scm $ open hello-web.html
Note that by default `display` will send its output to the browser’s JavaScript console, i.e. the same place as the JavaScript console.log(…). The last 2 lines of the program call the JavaScript `alert` function to also show the message in a dialog box.
Finally, `display` can be called with the port corresponding to the web REPL (which is implemented by the Gambit runtime library through a browser dialog box):
$ cat hello-web-repl.scm (define msg "hello world!\n") (display msg (repl-output-port)) (##repl-debug) ;; start a REPL in a dialog box $ gsc -target js -exe -o hello-web-repl.html hello-web-repl.scm $ open hello-web-repl.html
The web REPL is a good way to do “live debugging” of the Scheme program. It also allows tinkering with JavaScript. For example, you could get the current date at the web REPL by entering:
(host-eval "new Date().toString()")
There’s also a JavaScript FFI based on infix syntax for an even more user-friendly way to interface to JavaScript. Please visit try.gambitscheme.org for a demo (wait a few seconds for it to start automatically). The demo shows off several features, such as the FFI, single-stepping, importing R7RS modules from the web, and the thread system.
Marc
On Feb 11, 2022, at 5:37 AM, Jean-François Trevien jef.trevien@gmail.com wrote:
Hello, I tried to to use the transpiler: gsc -target js hello.scm with hello.scm containing : (display "hello word") And i have the error message : *** ERROR IN "hello.js"@74.39 -- Datum expected
The version i use was install by chocolatey : gambit v4.6.6.20121126
what's wrong? _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list