Improved the VM's efficiency. The VM is as fast as the interpreter. :-(
[bpt/guile.git] / README
1 This is an attempt to revive the Guile-VM project by Keisuke Nishida
2 written back in the years 2000 and 2001. Below are a few pointers to
3 relevant threads on Guile's development mailing list.
4
5 Enjoy!
6
7 Ludovic Courtès <ludovic.courtes@laas.fr>, Apr. 2005.
8
9
10 Pointers
11 --------
12
13 Status of the last release, 0.5
14 http://lists.gnu.org/archive/html/guile-devel/2001-04/msg00266.html
15
16 The very first release, 0.0
17 http://sources.redhat.com/ml/guile/2000-07/msg00418.html
18
19 Performance, portability, GNU Lightning
20 http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00132.html
21
22 Playing with GNU Lightning
23 http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00185.html
24
25 On things left to be done
26 http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00146.html
27
28
29 ---8<--- Original README below. -----------------------------------------
30
31 Installation
32 ------------
33
34 1. Install the latest Guile from CVS.
35
36 2. Install Guile VM:
37
38 % configure
39 % make install
40 % ln -s module/{guile,system,language} /usr/local/share/guile/
41
42 3. Add the following lines to your ~/.guile:
43
44 (use-modules (system vm core)
45
46 (cond ((string=? (car (command-line)) "guile-vm")
47 (use-modules (system repl repl))
48 (start-repl 'scheme)
49 (quit)))
50
51 Example Session
52 ---------------
53
54 % guile-vm
55 Guile Scheme interpreter 0.5 on Guile 1.4.1
56 Copyright (C) 2001 Free Software Foundation, Inc.
57
58 Enter `,help' for help.
59 scheme@guile-user> (+ 1 2)
60 3
61 scheme@guile-user> ,c -c (+ 1 2) ;; Compile into GLIL
62 (@asm (0 1 0 0)
63 (module-ref #f +)
64 (const 1)
65 (const 2)
66 (tail-call 2))
67 scheme@guile-user> ,c (+ 1 2) ;; Compile into object code
68 Disassembly of #<objcode 403c5fb0>:
69
70 nlocs = 0 nexts = 0
71
72 0 link "+" ;; (+ . ???)
73 3 variable-ref
74 4 make-int8:1 ;; 1
75 5 make-int8 2 ;; 2
76 7 tail-call 2
77
78 scheme@guile-user> (define (add x y) (+ x y))
79 scheme@guile-user> (add 1 2)
80 3
81 scheme@guile-user> ,x add ;; Disassemble
82 Disassembly of #<program add>:
83
84 nargs = 2 nrest = 0 nlocs = 0 nexts = 0
85
86 Bytecode:
87
88 0 object-ref 0 ;; (+ . #<primitive-procedure +>)
89 2 variable-ref
90 3 local-ref 0
91 5 local-ref 1
92 7 tail-call 2
93
94 Objects:
95
96 0 (+ . #<primitive-procedure +>)
97
98 scheme@guile-user>
99
100 Compile Modules
101 ---------------
102
103 Use `guilec' to compile your modules:
104
105 % cat fib.scm
106 (define-module (fib) :export (fib))
107 (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
108
109 % guilec fib.scm
110 Wrote fib.go
111 % guile
112 guile> (use-modules (fib))
113 guile> (fib 8)
114 34