home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / scheme / 2166 < prev    next >
Encoding:
Text File  |  1992-09-08  |  10.4 KB  |  220 lines

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