home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / archives / 3312 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  10.7 KB

  1. Path: sparky!uunet!usc!sdd.hp.com!spool.mu.edu!agate!agate!usenet
  2. From: oz@ursa.sis.yorku.ca (Ozan Yigit)
  3. Newsgroups: comp.archives
  4. Subject: [comp.lang.scheme] announcement: vscm - another scheme implementation
  5. Followup-To: comp.lang.scheme
  6. Date: 9 Sep 1992 08:11:23 GMT
  7. Organization: York U. Student Information Systems Project
  8. Lines: 212
  9. Approved: adam@soda.berkeley.edu
  10. Distribution: world
  11. Message-ID: <18kbjbINNovc@agate.berkeley.edu>
  12. References: <OZ.92Sep8125043@ursa.sis.yorku.ca>
  13. NNTP-Posting-Host: soda.berkeley.edu
  14. X-Original-Newsgroups: comp.lang.scheme
  15. X-Original-Date: Tue, 8 Sep 1992 17:50:43 GMT
  16.  
  17. Archive-name: auto/comp.lang.scheme/announcement-vscm-another-scheme-implementation
  18.  
  19. Matthias Blume's VSCM [vscm92Sep7.tar.Z] is now available from the
  20. implementations section  [pub/scheme/imp] of the Scheme Repository,
  21. currently hosted at nexus.yorku.ca [130.63.9.66] for anonymous ftp.
  22.  
  23. Matthias Blume may be reached as blume@cs.princeton.edu.
  24.  
  25. I include VSCM README below.
  26.  
  27. enjoy.    oz
  28. ---
  29. ps: as an internetworking courtesy, please try to avoid having ftp
  30.     sessions during the peak working hours, i.e. 9.00am-5:00pm EST.
  31. ---
  32.  
  33. VSCM - A Scheme Implementation
  34.  
  35. Abstract:
  36.     Vscm is a fairly complete implementation of the Scheme language,
  37.     as described in the ``Revised^4 Report of the Algorithmic Language
  38.     Scheme'' (R4RS).
  39.  
  40. Primary goals:
  41.     The primary goal for developing this Scheme implementation was
  42.     to get a reliable and small, portable Scheme system, which
  43.     may run on a variety of different hardware platforms and
  44.     under control of most common operating systems.
  45.     It should be well understood (at least by myself :-), so I can
  46.     do any kind of improvement, if there is the need to do so.
  47.     Therefore, in the beginning this implementation was intended
  48.     for use by myself and in my research projects only.  But now I feel,
  49.     that I should give a working release of this program to the
  50.     Scheme community in order to receive feedback from other people.
  51.     Do anything you like with this system, I'm happy to receive
  52.     your comments!
  53.  
  54. Design decisions:
  55.     The system is divided into two main parts: a virtual machine (VM),
  56.     running some kind of byte code, and a compiler (written in scheme
  57.     itself) running on the virtual machine and producing code for
  58.     this virtual machine.  The compiler can compile its own source,
  59.     so there is the opportunity of bootstrapping.
  60.     To keep the compiler small and simple, there is heavy support
  61.     from the underlying VM for most sophisticated features of Scheme:
  62.     for instance, there is no need to do CPS-conversion, because the
  63.     structure of the VM provides the concept of the continuation for free.
  64.  
  65.     To obtain a highly portable system, of course, there is the need
  66.     to have a highly portable VM.  Scheme programs should always
  67.     be portable, at least, if they obey the rules oulined in R4RS.
  68.     In order to achieve this level of portability for the VM as well,
  69.     I decided to use ANSI-C.  I tried very hard to ban all
  70.     non-ANSI idioms from my program.  The program has proven to work
  71.     on several platforms using several different compilers.
  72.     (One known violation of my rules is: I use the fileno-feature
  73.     from stdio.h, which is not ANSI.  It can easily be eliminated,
  74.     because its use is not necessary for the systems operation.)
  75.  
  76.     The system is designed to produce ``memory dumps'' on demand.
  77.     These dumps represent a description of the layout of the heap
  78.     at the time of the dump.  Because no binary data is ever written
  79.     into such memory dumps, they may be used across
  80.     a machine architectures boundaries without change.
  81.     In fact, the VM is not really a Scheme system.  ``Booting''
  82.     from the right memory dump can turn it into one!
  83.  
  84. How unspecified details from R4RS are implemented:
  85.     -- #f and () differ.  () is truish, only #f counts as FALSE.
  86.     -- if you escape from calls to procedures by means of
  87.        escape procedures (continuations) and you
  88.        continue later using a continuation that has been captured
  89.        before the escape, then the current input and output files,
  90.        the current error handler, the current gc-strategy and the
  91.        current interrupt-handler are the same, as at the moment at which
  92.        the continuation has been captured.  In effect, these
  93.        properties are inherent properties of the continuation
  94.        an not any kind of ``global system state''.
  95.  
  96. Current restrictions:
  97.     -- all numbers are integers (of virtually unlimited range).
  98.     -- string->number, number->string are not implemented.
  99.     -- no macro facility.
  100.     -- char-ready? writes a warning and returns #f, without
  101.        really checking anything.  Unfortunately, testing for the
  102.        presence of input is inherently non-portable, so I was not
  103.        able to include working code for char-ready?.
  104.  
  105. Extensions:
  106.     -- (quit [status]) kills Scheme, returns status to the operating
  107.        system environment (default: 0).
  108.     -- (dump "filename")    writes a memory dump (see above) into the
  109.        named file "filename" and returns #t.
  110.        If you use this file later in a shell command line like in
  111.         scheme -b filename
  112.        then you are ``booting'' scheme using the saved state, including
  113.        information about the current continuation.  The system
  114.        behaves, as if it would return from the call to
  115.        dump, now returning #f instead of #t.
  116.        This is reminicent of the behaviour of fork(2) in the UNIX
  117.        operating system.  When booting, scheme reconnects
  118.        stdin, stdout and stderr to the corresponding port objects.
  119.        Other port objects remain closed, even if they had been open
  120.        at the time of the dump-call.
  121.        Note, that you can use files, which have been produced by dump,
  122.        across different architectures.
  123.     -- (system "shellcommand") as in C.
  124.        If system(2) returns 0, system returns #t, otherwise the value is
  125.        #f.
  126.     -- (with-error-handler proc thunk)
  127.        This call invokes thunk, which must be a procedure without
  128.        arguments.  If it returns a value, then the entire call returns
  129.        that value.  If, however, an error condition is raised during
  130.        the execution thunk's body (and it does not get caught by
  131.        a nested error handler), then this results in a call to proc,
  132.        which is called the ``error handler''.
  133.        proc takes two arguments: the error message (a string),
  134.        and the continuation of the execution at the time when the error
  135.        occured.  The continuation is intended for error tracing purposes
  136.        only (-> inspect).
  137.        If proc is ever called, then this call is NOT PART of any other
  138.        continuation.  This means, that returning from proc is useless
  139.        and causes a system reset.
  140.        Equally, you must not call the continuation object passed to proc,
  141.        though this might be useful.  It does not contain all the
  142.        information which is necessary to recover from the error, and
  143.        causes a system reset as well.
  144.        Of course, you can escape from an error handler by calling
  145.        a previously captured continuation.
  146.     -- (with-interrupt-handler proc thunk)
  147.        Both, proc and thunk, are procedures without arguments.
  148.        The procedure calls thunk and yields the value obtained from
  149.        the call to thunk.  If an interrupt (SIGINT) occurs during the
  150.        execution of thunk, then the execution will be suspended and
  151.        proc will be called. If proc returns, then the execution of
  152.        thunk resumes as if nothing happened.  One exception: if the
  153.        interrupt occurs during a call to read, then read will not
  154.        resume, but instead return the END-OF-FILE-object.
  155.     -- (with-gc-strategy proc thunk)
  156.        The thunk (a procedure without arguments) will be called and its
  157.        value is the result of the entire expression.  If, however,
  158.        the system has to perform garbage collection during the execution
  159.        of thunk, then (as with interrupts) the execution of thunk
  160.        will be suspended, and proc will be called with seven (!) arguments.
  161.        These arguments (integers) contain useful information about the
  162.        latest run of the garbage collector.
  163.         (proc gbc nobj min pmin tot used time)
  164.        gbc: total count of calls to the internal routine getbytes.
  165.        nobj: total count of living objects in the heap
  166.        min: minimum size of the heap (heap overflows with heap sizes
  167.             less than min don't trigger garbage collection).
  168.        pmin: min during the gc-run before the last.
  169.              If this is greater than min, it shows, that there is not
  170.          enough space to fulfill the demand expressed by min.
  171.        tot: total heap size.
  172.        used: used space of the heap.
  173.        time: time in millisoconds spent on this gc-run.
  174.          Note: the garbage collector uses stop© GC. Therefore
  175.            it switches between two separate heaps.
  176.        The return value of proc will be interpreted as follows:
  177.         #f - give up -- this triggers a system reset.
  178.         an integer -- becomes the new min
  179.         anything else -- ignored
  180.     -- (standard-port number) must be called with either 0, 1 or 2.
  181.        It returns the port objects for stdin, stdout or stderr,
  182.        respectively.
  183.     -- (cons-quotient-remainder x y) yields the same
  184.        as (cons (quotient x y) (remainder x y)), but divides only
  185.        once.
  186.     -- (error "message") raises an error condition with the message
  187.        "message".
  188.     -- (clock) returns the current cpu time of the running scheme.
  189.        The unit is milliseconds.  The value may be incorrect due to
  190.        limitations of the ANSI-C library.
  191.     -- (gc-clock) returns the time, that the current scheme process spent
  192.        on garbage collection. The unit is milliseconds.  The same
  193.        limitations as for (clock) apply.
  194.     -- (inspect cont n) fetches information about the n-th activation
  195.        record from the continuation object cont.  This is very
  196.        dangerous, because the result contains actual control
  197.        information of the VM, which may easily be destroyed.  The code
  198.        of the compiler shows possible uses of inspect, but it is
  199.        subject to change without any notice.
  200.     -- (define-asm ...)
  201.        (execute-asm ...)
  202.        These procedures are low-level primitives used by the compiler
  203.        to create and execute compiled code.
  204.  
  205. To build the system:
  206.     -- Edit Makefile (look at the comments there).
  207.        You will need ANSI-C and ANSI-C libraries.
  208.     -- make
  209.        - Usually, this should build the system without errors or
  210.          warnings (at least using gcc).  Warnings may occur due to
  211.          inconsistent libraries or conversions between char * and
  212.          unsigned char *.
  213.     -- scheme
  214.  
  215.     Note: If there appears a question during ``make'' about
  216.           scmcomp/boot.asm, which looks like ``DO YOU WANT TO CONTINUE'',
  217.           then answer ``y''!  But beware of changes to scmcomp/boot-c.scm!
  218.  
  219. Notes:
  220.     Vscm is able to read assembly code (for its bytecode-machine).
  221.     If you boot scheme using the command line
  222.         scheme -b scmcomp/cfilt.boot
  223.     you obtain a Scheme->Assemblycode filter.  Its use is restricted
  224.     to function definitions.  This may be used to compile the compiler.
  225.     If you don't use the -b command line switch, scheme will boot from
  226.     a file, the name of which is given by the environment variable
  227.     VSCMBOOT and which defaults to ``.scheme-boot''.
  228.  
  229.