I will try that, but the commands I did removed ALL built files. I can't imagine what make from-scratch could do extra. I will try it. Thanks.
On Tue, Feb 3, 2015 at 9:48 AM, Francois Magnan < magnan@categoricaldesign.com> wrote:
Yes, you need more…
Replace “make” in your workflow by “make from-scratch”
Francois
On Feb 3, 2015, at 10:33 AM, Blake McBride blake@mcbride.name wrote:
Actually, I did:
git pull rm -rf * git checkout --force ./configure --enable-single-host make sudo rm -rf /usr/local/Gambit-C sudo make install
Do I need more?
On Tue, Feb 3, 2015 at 9:26 AM, Francois Magnan < magnan@categoricaldesign.com> wrote:
Hi.
Gambit build is a complex thing but it is managed wisely by the makefile if you use the right target. You cannot do just a “git pull; make”… After you pull the latest version do a :
make from-scratch
Then u will have a gambit built with the new feature Marc has just added for you.
Hope this helps. Francois
On Feb 3, 2015, at 10:13 AM, Blake McBride blake@mcbride.name wrote:
I did a git pull and rebuilt everything. Same error. Note that node doesn't have a "print" function.
Thanks.
Blake
On Mon, Feb 2, 2015 at 8:26 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
You have to pull the latest version from the github repo.
Marc
On Feb 1, 2015, at 11:35 PM, Blake McBride blake@mcbride.name wrote:
Here is the result of your example:
$ gsc -c -target js f1.scm $ node f1.js
/home/blake/gambit/f1.js:448 print(obj); ^ ReferenceError: print is not defined at gambit_println (/home/blake/gambit/f1.js:448:3) at gambit_bb1_println (/home/blake/gambit/f1.js:323:3) at gambit_trampoline (/home/blake/gambit/f1.js:348:10) at Object.<anonymous> (/home/blake/gambit/f1.js:688: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) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) $
In any case, here is a simple example and instructions on how to run
the code in a JS shell and in the browser. If you want to use non-primitive predefined Scheme library functions (such as equal?, append, map, write, etc) you will need to look into univ-lib . The goal is to have all of this neatly packaged in gsc so that one invocation of gsc will do all that is necessary. One issue is linking… should the .js file contain all of the application code including Scheme libraries, or should it contain just the code for the compiled file (so that it can be dynamically loaded by the web page)? Both should be supported with an appropriate compile flag.
Marc
;; File: fib.scm ;; ;; compile with: gsc -c -target js fib.scm ;; ;; execute with: d8 fib.js ;; ;; or use it in an HTML page like this: ;; ;; <!DOCTYPE html> ;; <html> ;; <head> ;; <title>fib</title> ;; <script type="text/javascript"> ;; function print(x) { console.log(x); } ;; </script> ;; <script type="text/javascript" src="fib.js"></script> ;; </head> ;; <body></body> ;; </html>
(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))
(define start (real-time-milliseconds))
(println (fib 30))
(define end (real-time-milliseconds))
(println (- end start))
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Afficher les réponses par date
Son-of-a-gun, that did fix it. Apparently, my imagination is a little short.
Thanks!
Blake
On Tue, Feb 3, 2015 at 9:58 AM, Blake McBride blake@mcbride.name wrote:
I will try that, but the commands I did removed ALL built files. I can't imagine what make from-scratch could do extra. I will try it. Thanks.
On Tue, Feb 3, 2015 at 9:48 AM, Francois Magnan < magnan@categoricaldesign.com> wrote:
Yes, you need more…
Replace “make” in your workflow by “make from-scratch”
Francois
On Feb 3, 2015, at 10:33 AM, Blake McBride blake@mcbride.name wrote:
Actually, I did:
git pull rm -rf * git checkout --force ./configure --enable-single-host make sudo rm -rf /usr/local/Gambit-C sudo make install
Do I need more?
On Tue, Feb 3, 2015 at 9:26 AM, Francois Magnan < magnan@categoricaldesign.com> wrote:
Hi.
Gambit build is a complex thing but it is managed wisely by the makefile if you use the right target. You cannot do just a “git pull; make”… After you pull the latest version do a :
make from-scratch
Then u will have a gambit built with the new feature Marc has just added for you.
Hope this helps. Francois
On Feb 3, 2015, at 10:13 AM, Blake McBride blake@mcbride.name wrote:
I did a git pull and rebuilt everything. Same error. Note that node doesn't have a "print" function.
Thanks.
Blake
On Mon, Feb 2, 2015 at 8:26 AM, Marc Feeley feeley@iro.umontreal.ca wrote:
You have to pull the latest version from the github repo.
Marc
On Feb 1, 2015, at 11:35 PM, Blake McBride blake@mcbride.name
wrote:
Here is the result of your example:
$ gsc -c -target js f1.scm $ node f1.js
/home/blake/gambit/f1.js:448 print(obj); ^ ReferenceError: print is not defined at gambit_println (/home/blake/gambit/f1.js:448:3) at gambit_bb1_println (/home/blake/gambit/f1.js:323:3) at gambit_trampoline (/home/blake/gambit/f1.js:348:10) at Object.<anonymous> (/home/blake/gambit/f1.js:688: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) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) $
In any case, here is a simple example and instructions on how to run
the code in a JS shell and in the browser. If you want to use non-primitive predefined Scheme library functions (such as equal?, append, map, write, etc) you will need to look into univ-lib . The goal is to have all of this neatly packaged in gsc so that one invocation of gsc will do all that is necessary. One issue is linking… should the .js file contain all of the application code including Scheme libraries, or should it contain just the code for the compiled file (so that it can be dynamically loaded by the web page)? Both should be supported with an appropriate compile flag.
Marc
;; File: fib.scm ;; ;; compile with: gsc -c -target js fib.scm ;; ;; execute with: d8 fib.js ;; ;; or use it in an HTML page like this: ;; ;; <!DOCTYPE html> ;; <html> ;; <head> ;; <title>fib</title> ;; <script type="text/javascript"> ;; function print(x) { console.log(x); } ;; </script> ;; <script type="text/javascript" src="fib.js"></script> ;; </head> ;; <body></body> ;; </html>
(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))
(define start (real-time-milliseconds))
(println (fib 30))
(define end (real-time-milliseconds))
(println (- end start))
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
To understand why “make from-scratch” is necessary, you have to know that Gambit is self-hosted. The Gambit system is mostly written in Scheme, and those Scheme files are compiled by the Scheme compiler into .c files.
So for example gsc/_t-univ.scm (the file implementing the universal backend that I changed a few days ago) is compiled to gsc/_t-univ.c . However, the github repository does not contain the most up to date gsc/_t-univ.c file whereas gsc/_t-univ.scm is up to date. Keeping these files in sync in the repo would cause the git repo to take a lot of space. That’s because the smallest change to a Scheme file will result in most of the corresponding .c file to change (different label names, temporary variable names, register allocation, etc), and the .c files are huge (gsc/_t-univ.c is currently 130 KLOC).
Instead of keeping the .scm and .c files in sync in the repo, the .c files of the most recent release of Gambit are kept in the repo. That way, when you do a “make” after cloning the github repo you get the version of the Gambit compiler that existed at the most recent release. Then that compiler can be used on the .scm files to produce up to date .c files. That is what “make from-scratch” does (it builds the .c files “from scratch” from the current .scm files). The makefile rule is:
from-scratch: fake_target $(MAKE) bootstrap # make gsc compiler of latest *release* $(MAKE) bootclean $(MAKE) bootstrap # make gsc compiler corresponding to repo HEAD $(MAKE) bootclean $(MAKE) all # make everything with repo HEAD gsc compiler
Marc
On Feb 3, 2015, at 11:25 AM, Blake McBride blake@mcbride.name wrote:
Son-of-a-gun, that did fix it. Apparently, my imagination is a little short.
Thanks!
Blake
Told U! ;-)
Francois
On Feb 3, 2015, at 11:25 AM, Blake McBride blake@mcbride.name wrote:
Son-of-a-gun, that did fix it. Apparently, my imagination is a little short.
Thanks!
Blake
On Tue, Feb 3, 2015 at 9:58 AM, Blake McBride <blake@mcbride.name mailto:blake@mcbride.name> wrote: I will try that, but the commands I did removed ALL built files. I can't imagine what make from-scratch could do extra. I will try it. Thanks.
On Tue, Feb 3, 2015 at 9:48 AM, Francois Magnan <magnan@categoricaldesign.com mailto:magnan@categoricaldesign.com> wrote: Yes, you need more…
Replace “make” in your workflow by “make from-scratch”
Francois
On Feb 3, 2015, at 10:33 AM, Blake McBride <blake@mcbride.name mailto:blake@mcbride.name> wrote:
Actually, I did:
git pull rm -rf * git checkout --force ./configure --enable-single-host make sudo rm -rf /usr/local/Gambit-C sudo make install
Do I need more?
On Tue, Feb 3, 2015 at 9:26 AM, Francois Magnan <magnan@categoricaldesign.com mailto:magnan@categoricaldesign.com> wrote: Hi.
Gambit build is a complex thing but it is managed wisely by the makefile if you use the right target. You cannot do just a “git pull; make”… After you pull the latest version do a :
make from-scratch
Then u will have a gambit built with the new feature Marc has just added for you.
Hope this helps. Francois
On Feb 3, 2015, at 10:13 AM, Blake McBride <blake@mcbride.name mailto:blake@mcbride.name> wrote:
I did a git pull and rebuilt everything. Same error. Note that node doesn't have a "print" function.
Thanks.
Blake
On Mon, Feb 2, 2015 at 8:26 AM, Marc Feeley <feeley@iro.umontreal.ca mailto:feeley@iro.umontreal.ca> wrote: You have to pull the latest version from the github repo.
Marc
On Feb 1, 2015, at 11:35 PM, Blake McBride <blake@mcbride.name mailto:blake@mcbride.name> wrote:
Here is the result of your example:
$ gsc -c -target js f1.scm $ node f1.js
/home/blake/gambit/f1.js:448 print(obj); ^ ReferenceError: print is not defined at gambit_println (/home/blake/gambit/f1.js:448:3) at gambit_bb1_println (/home/blake/gambit/f1.js:323:3) at gambit_trampoline (/home/blake/gambit/f1.js:348:10) at Object.<anonymous> (/home/blake/gambit/f1.js:688: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) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) $
In any case, here is a simple example and instructions on how to run the code in a JS shell and in the browser. If you want to use non-primitive predefined Scheme library functions (such as equal?, append, map, write, etc) you will need to look into univ-lib . The goal is to have all of this neatly packaged in gsc so that one invocation of gsc will do all that is necessary. One issue is linking… should the .js file contain all of the application code including Scheme libraries, or should it contain just the code for the compiled file (so that it can be dynamically loaded by the web page)? Both should be supported with an appropriate compile flag.
Marc
;; File: fib.scm ;; ;; compile with: gsc -c -target js fib.scm ;; ;; execute with: d8 fib.js ;; ;; or use it in an HTML page like this: ;; ;; <!DOCTYPE html> ;; <html> ;; <head> ;; <title>fib</title> ;; <script type="text/javascript"> ;; function print(x) { console.log(x); } ;; </script> ;; <script type="text/javascript" src="fib.js"></script> ;; </head> ;; <body></body> ;; </html>
(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))
(define start (real-time-milliseconds))
(println (fib 30))
(define end (real-time-milliseconds))
(println (- end start))
Gambit-list mailing list Gambit-list@iro.umontreal.ca mailto:Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca mailto:Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list