pika-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pika-dev] status draft


From: Tom Lord
Subject: [Pika-dev] status draft
Date: Tue, 2 Mar 2004 14:20:02 -0800 (PST)



So, let's take stock (of the code, ignoring the various design notes).

Contents:

  * What We Have...
  ** solid C calling conventions for leaf primitives
  ** a good abstraction barrier between representations and "logic"
  ** a cool numeric tower
  ** Unicode characters and strings are progressing
  ** None of the required syntax is present
  ** a substantial portion of the needed R5RS primitives are done
  *** somehow we wound up missing LIST-TAIL
  *** we need string <-> number procedures
  *** the STRING? type isn't present at all yet
  *** the PROCEDURE? type isn't present at all yet
  *** we don't have any "control feature" procedures yet
  *** the PORT? type is present at all yet
  *** character I/O isn't present
  *** the "System interface" (laod, transcripts) isn't present
  *** Complete table of procedures


* What We Have...

** solid C calling conventions for leaf primitives

   A "leaf primitive" is a procedure that doesn't need to call EVAL or
   APPLY and that doesn't need to tail-call a non-leaf-primitive
   procedure.  Nearly all of the required procedures of R5RS are in
   this category.  Exceptions include things such as MAP.

   This class of procedures presents the fewest challenges for
   reconciling the subtleties of Scheme flow of control with C.

   This class is also a substantial part of the kinds of procedures
   people will want to add when writing extentions in C.  Thus, we
   have a good deal of our FFI.


** a good abstraction barrier between representations and "logic"

  The design-space of Scheme implementations involves choices between
  various kinds of object representation, GC strategy, and so forth.

  The implementation of some primitives, such as CONS, depend deeply
  on how those choices are made.

  The implementations of other primitives, such as LIST-LENGTH, are
  less dependent.

  No distinction between representation-dependent and -independent
  primitives can be _perfect_.   For example, in an implementation
  using CDR-coding (a special way to represent lists which doesn't
  allocate a new CONS pair for every list element), LIST-LENGTH would
  indeed be representation-dependent.

  Nevertheless, a major goal of Pika is to draw a line between
  representation-dependent and -independent primitives that does a
  good job of (a) allowing a wide range of possible representations
  while (b) allowing -independent code to be portable across all of
  those representation choices.

  We've settled on a four part arrangement of abstractions, layered
  as follows:


        -independent    (A) |   -independent routines  (C)
        number routines     |   for other types
                            |
        --------------------|
                        (B) |
        -dependent number   |
        implementations     |
                            |
        -------------------------------------------------
                                                        (D)
                -dependent primitive types


  Horizontal and vertical lines in this diagram show where
  module boundaries are drawn, with abstract APIs controlling
  communication between modules.

  At the root (A), "-dependent primitive types", is the implementation
  of GC and primitive operations such as CONS/CAR/CDR.  This layer
  defines a type ("vtable objects") which are not directly a Scheme
  type, but which other modules can use to define new Scheme types.
  This core also contains the numeric representation for fixnums
  (range-limited exact integers) and doubles (double precision
  floating point values).

  Many primitives (such as our canonical example LIST-LENGTH) are
  defined outside of that core in (C), "-independent routines for
  other types".

  The "-dependent number implementations" module(s), (B), round out
  the representation of number types.  What the root primitive types
  don't provide, this layer adds using "vtable objects".

  Finally, most of the math primitives are implemented in a
  representation-independent way in (A), "-independent number
  routines".

  The idea here is that a change in tagging scheme or GC strategy --
  anything like that -- can be accomplished in (D) alone, with no
  other code changing.

  Similarly, a change in numeric representation strategies (e.g.,
  using GMP for bignums vs. using lisp lists of fixnums) can be done
  in (B) alone.

  We have an interesting early validation of this design.  On the one
  hand, we have a (D) (the root primitives) made entirely of new code.
  It has a simple tagging scheme and uses a precise, copying collector
  provided by Matthew Dempsky.  Recently, Andreas Rottman has written
  a new implementation of (D), mapping it's API on to the run-time
  system for GNU Guile, with its mark/sweep collector and SCM-like
  tagging system.  So, already we have a choice of two different
  object representations and two different garbage collectors -- the
  bulk of the code in Guile works without modification with both.


** a cool numeric tower

  Matthew Dempsky has implemented all of the standard number types
  and math operations.


** Unicode characters and strings are progressing

  I wrote the basic Unicode character type.   The string type 
  is completely unimplemented at the moment however, Jose A Ortega
  Ruiz has been working on the needed support in libhackerlab.


** None of the required syntax is present

  We don't yet have the VM, hence, no EVAL, LAMBDA, LET, DEFINE,
  LEt-SYNTAX etc.


** a substantial portion of the needed R5RS primitives are done

  Below is a long table of the current state of what primitive
  procedures R5RS specifies, which are required, which we have
  (more or less), and which we're missing.

  The table can be summed up this way:

*** somehow we wound up missing LIST-TAIL
*** we need string <-> number procedures
*** the STRING? type isn't present at all yet
*** the PROCEDURE? type isn't present at all yet
*** we don't have any "control feature" procedures yet
*** the PORT? type is present at all yet
*** character I/O isn't present
*** the "System interface" (laod, transcripts) isn't present


*** Complete table of procedures


        procedure               required? missing?

    6.1 Equivalence predicates

        eqv?                    y
        eq?                     y
        equal?                  y

    6.2 Numbers

        number?                 y
        complex?                y
        real?                   y
        rational?               y
        integer?                y

        exact?                  y
        inexact?                y

        =                       y
        <                       y
        >                       y
        <=                      y
        >=                      y

        zero?                   y
        positive?               y
        negative?               y
        odd?                    y
        even?                   y

        max                     y
        min                     y

        +                       y
        *                       y

        -                       y
        /                       y

        abs                     y
        
        quotient                y
        remainder               y
        modulo                  y

        gcd                     y
        lcm                     y

        numerator               y
        denominator             y

        floor                   y
        ceiling                 y
        truncate                y
        round                   y

        rationalize             y

        exp                     y
        log                     y
        sin                     y
        cos                     y
        tan                     y
        asin                    y
        acos                    y
        atan                    y

        sqrt

        expt

        make-rectanglular       y
        make-polar              y
        real-part               y
        imag-part               y
        magnitude               y
        angle                   y

        exact->inexact          y
        inexact->exact          y

z
    6.2.6  Numerical input and output

        number->string          y       MISSING
        string->number          y       MISSING


    6.3.1 Booleans

        not                     y
        boolean?                y


    6.3.2 Pairs and lists

        pair?                   y
        cons                    y
        car                     y
        cdr                     y
        set-car!                y
        set-cdr!                y

        caar..cdddr             y       MISSING

        null?                   y

        list?                   y
        list                    y
        length                  y
        append                  y
        reverse                 y
        list-tail               y       MISSING
        list-ref                y

        memq                    y
        memv                    y
        member                  y

        assq                    y
        assv                    y
        assoc                   y


    6.3.3 Symbols

        symbol?                 y

        symbol->string          y       MISSING
        string->symbol          y       MISSING


    6.3.4 Characters

        char?                   y

        char=?                  y
        char<?                  y
        char>?                  y
        char<=?                 y
        char>=?                 y

        char-ci=?               y
        char-ci<?               y
        char-ci>?               y
        char-ci<=?              y
        char-ci>=?              y

        char-alphabetic?        y
        char-numeric?           y
        char-whitespace?        y
        char-upper-case?        y
        char-lower-case?        y

        char->integer           y
        integer->char           y

        char-upcase             y
        char-downcase           y

  
    6.3.5 Strings

        string?                 y       MISSING

        make-string             y       MISSING
        string                  y       MISSING
        string-length           y       MISSING
        string-ref              y       MISSING
        string-set!             y       MISSING

        string=?                y       MISSING
        string-ci=?             y       MISSING
        string-<?               y       MISSING
        string->?               y       MISSING
        string-<=?              y       MISSING
        string->=?              y       MISSING
        string-ci<?             y       MISSING
        string-ci>?             y       MISSING
        string-ci<=?            y       MISSING
        string-ci>=?            y       MISSING

        substring               y       MISSING
        string-append           y       MISSING
        string->list            y       MISSING
        list->string            y       MISSING
        string-copy             y       MISSING
        string-fill!            y       MISSING


    6.3.6 Vectors

        vector?                 y
        make-vector             y
        vector                  y       MISSING
        vector-length           y
        vector-ref              y
        vector-set!             y
        vector->list            y       MISSING
        list->vector            y       MISSING
        vector-fill!            y       MISSING


    6.4 Control features

        procedure?              y       MISSING
        apply                   y       MISSING
        map                     y       MISSING
        for-each                y       MISSING
        force                   y       MISSING
        call/cc                 y       MISSING
        values                  y       MISSING
        call-with-values        y       MISSING
        dynamic-wind            y       MISSING
        scheme/environment      y       MISSING
        null-environment        y       MISSING


    6.6.1 Ports

        call/input-file         y       MISSING
        call/output-file        y       MISSING

        input-port?             y       MISSING
        output-port?            y       MISSING

        current-input-port      y       MISSING
        current-output-port     y       MISSING

        with-input-from-file    n       MISSING
        with-output-to-file     n       MISSING

        open-input-file         y       MISSING
        open-output-file        y       MISSING

        cloes-input-port        y       MISSING
        close-output-port       y       MISSING


    6.6.2 Input

        read                    y
        read-char               y       MISSING
        peek-char               y       MISSING
        eof-object?             y
        char-ready?             y       MISSING

  
    6.6.3 Output

        write                   y
        display                 y
        newline                 y       MISSING
        write-char              y       MISSING


    6.6.4 System interface

        load                    n       MISSING
  
        transcript-on           n       MISSING
        transcript-off          n       MISSING



;;; arch-tag: Tom Lord Tue Mar  2 14:11:40 2004 (scm/=status)
;;;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]