1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00
Mirror of the upstream GNU Guile repository on Savannah. https://www.gnu.org/software/guile/
Find a file
Ludovic Court`es d8eeb67c89 Translation from Scheme to GHIL, and compilation to GLIL work.
* src/*.c:  Removed calls to `scm_must_malloc', `SCM_MUST_MALLOC' and
  `scm_must_free'.  Same for `SCM_INUMP', `SCM_INUM', `SCM_STRING_CHARS',
  and the likes.
* module/system/base/syntax.scm:  Do not import `(ice-9 match)' and do
  not re-export `match', do not export `syntax-error' which was not
  defined here.
* module/system/base/compile.scm (call-with-compile-error-catch):  Use
  the `catch' form instead of `try'.
* src/instructions.c:  Use `scm_from_char ()' instead of the deprecated
  macro `SCM_MAKINUM ()'.
* src/instructions.h (scm_instruction):  Made `npop' a signed char.

git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-2
2008-04-25 19:09:29 +02:00
doc ChangeLog 2000-09-22 17:38:49 +00:00
module Translation from Scheme to GHIL, and compilation to GLIL work. 2008-04-25 19:09:29 +02:00
src Translation from Scheme to GHIL, and compilation to GLIL work. 2008-04-25 19:09:29 +02:00
.cvsignore *** empty log message *** 2001-04-22 02:13:48 +00:00
acconfig.h Initial revision 2000-08-22 15:54:19 +00:00
acinclude.m4 Initial revision 2000-08-22 15:54:19 +00:00
AUTHORS Initial revision 2000-08-22 15:54:19 +00:00
autogen.sh * autogen.sh: Run aclocal with check where guile.m4 is installed. 2000-09-11 09:18:49 +00:00
ChangeLog *** empty log message *** 2001-04-07 12:29:06 +00:00
configure.in *** empty log message *** 2001-04-22 02:13:48 +00:00
Makefile.am New VM. 2001-04-01 05:03:41 +00:00
NEWS Initial revision 2000-08-22 15:54:19 +00:00
README *** empty log message *** 2001-04-16 03:43:48 +00:00
THANKS *** empty log message *** 2001-04-07 12:29:06 +00:00

Installation
------------

1. Install the latest Guile from CVS.

2. Install Guile VM:

  % configure
  % make install
  % ln -s module/{guile,system,language} /usr/local/share/guile/

3. Add the following lines to your ~/.guile:

  (use-modules (system vm core)

  (cond ((string=? (car (command-line)) "guile-vm")
	 (use-modules (system repl repl))
	 (start-repl 'scheme)
	 (quit)))

Example Session
---------------

  % guile-vm
  Guile Scheme interpreter 0.5 on Guile 1.4.1
  Copyright (C) 2001 Free Software Foundation, Inc.

  Enter `,help' for help.
  scheme@guile-user> (+ 1 2)
  3
  scheme@guile-user> ,c -c (+ 1 2)	;; Compile into GLIL
  (@asm (0 1 0 0)
    (module-ref #f +)
    (const 1)
    (const 2)
    (tail-call 2))
  scheme@guile-user> ,c (+ 1 2)		;; Compile into object code
  Disassembly of #<objcode 403c5fb0>:

  nlocs = 0  nexts = 0

     0    link "+"                        ;; (+ . ???)
     3    variable-ref
     4    make-int8:1                     ;; 1
     5    make-int8 2                     ;; 2
     7    tail-call 2

  scheme@guile-user> (define (add x y) (+ x y))
  scheme@guile-user> (add 1 2)
  3
  scheme@guile-user> ,x add		;; Disassemble
  Disassembly of #<program add>:

  nargs = 2  nrest = 0  nlocs = 0  nexts = 0

  Bytecode:

     0    object-ref 0                    ;; (+ . #<primitive-procedure +>)
     2    variable-ref
     3    local-ref 0
     5    local-ref 1
     7    tail-call 2

  Objects:

     0    (+ . #<primitive-procedure +>)

  scheme@guile-user> 

Compile Modules
---------------

Use `guilec' to compile your modules:

  % cat fib.scm
  (define-module (fib) :export (fib))
  (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))

  % guilec fib.scm
  Wrote fib.go
  % guile
  guile> (use-modules (fib))
  guile> (fib 8)
  34