README.guile-vm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. Enjoy!
  5. Ludovic Courtès <ludovic.courtes@laas.fr>, Apr. 2005.
  6. Pointers
  7. --------
  8. Status of the last release, 0.5
  9. http://lists.gnu.org/archive/html/guile-devel/2001-04/msg00266.html
  10. The very first release, 0.0
  11. http://sources.redhat.com/ml/guile/2000-07/msg00418.html
  12. Simple benchmark
  13. http://sources.redhat.com/ml/guile/2000-07/msg00425.html
  14. Performance, portability, GNU Lightning
  15. http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00132.html
  16. Playing with GNU Lightning
  17. http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00185.html
  18. On things left to be done
  19. http://lists.gnu.org/archive/html/guile-devel/2001-03/msg00146.html
  20. ---8<--- Original README below. -----------------------------------------
  21. Installation
  22. ------------
  23. 1. Install the latest Guile from CVS.
  24. 2. Install Guile VM:
  25. % configure
  26. % make install
  27. % ln -s module/{guile,system,language} /usr/local/share/guile/
  28. 3. Add the following lines to your ~/.guile:
  29. (use-modules (system vm core)
  30. (cond ((string=? (car (command-line)) "guile-vm")
  31. (use-modules (system repl repl))
  32. (start-repl 'scheme)
  33. (quit)))
  34. Example Session
  35. ---------------
  36. % guile-vm
  37. Guile Scheme interpreter 0.5 on Guile 1.4.1
  38. Copyright (C) 2001 Free Software Foundation, Inc.
  39. Enter `,help' for help.
  40. scheme@guile-user> (+ 1 2)
  41. 3
  42. scheme@guile-user> ,c -c (+ 1 2) ;; Compile into GLIL
  43. (@asm (0 1 0 0)
  44. (module-ref #f +)
  45. (const 1)
  46. (const 2)
  47. (tail-call 2))
  48. scheme@guile-user> ,c (+ 1 2) ;; Compile into object code
  49. Disassembly of #<objcode 403c5fb0>:
  50. nlocs = 0 nexts = 0
  51. 0 link "+" ;; (+ . ???)
  52. 3 variable-ref
  53. 4 make-int8:1 ;; 1
  54. 5 make-int8 2 ;; 2
  55. 7 tail-call 2
  56. scheme@guile-user> (define (add x y) (+ x y))
  57. scheme@guile-user> (add 1 2)
  58. 3
  59. scheme@guile-user> ,x add ;; Disassemble
  60. Disassembly of #<program add>:
  61. nargs = 2 nrest = 0 nlocs = 0 nexts = 0
  62. Bytecode:
  63. 0 object-ref 0 ;; (+ . #<primitive-procedure +>)
  64. 2 variable-ref
  65. 3 local-ref 0
  66. 5 local-ref 1
  67. 7 tail-call 2
  68. Objects:
  69. 0 (+ . #<primitive-procedure +>)
  70. scheme@guile-user>
  71. Compile Modules
  72. ---------------
  73. Use `guilec' to compile your modules:
  74. % cat fib.scm
  75. (define-module (fib) :export (fib))
  76. (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
  77. % guilec fib.scm
  78. Wrote fib.go
  79. % guile
  80. guile> (use-modules (fib))
  81. guile> (fib 8)
  82. 34