There has been some interest expressed in having an interactive
(compiled) version of BitC. I tend to agree that this would be nice to
have. Here is a proposal on how to do it:

1. We will re-introduce the MODULE keyword for source modules, so that
   source modules now look like:

    (module MODIDENT [docstring]
      (define ...)
      (defstruct ...))

   the main reason for this is to establish a syntactic construct that
   bounds the environment of a source unit, because we need to know
   where the effect of an IMPORT or a PROVIDE ends.

   I have already modified the compiler to accept this syntax as an
   alternative to the current one.

2. There will be a new compiler-like command "bitci". This command
   proceeds exactly like bitcc, in the sense that it processes
   all input units of compilation that are presented on its command line
   just as bitcc does. Once all of these have been processed, the
   global initializers are executed and bitci switches to interactive
   mode.

3. In interactive mode, any normal top-level form can be entered. In
   addition, an expression can be entered at top level. If evaluating
   the expression would (transitively) reference an undefined value,
   the interpreter will report an error and will not evaluate the
   expression.

   For the sake of unambiguous parsing, we will probably introduce
   the constraint that the outermost top-level expression must be
   a parenthesized form. This is necessary because the parser needs
   to know when the expression being keyed is done. I'll look for
   something cleaner; this is certainly good enough to get us started.

4. In interactive mode, interfaces can be loaded by IMPORT and source
   units (or at least, those on the search path) can be loaded by
   REQUIRE (new form -- description coming).

5. There is a new form (REQUIRE module-name). The effect of this form is
   to add <module-name> to the list of input units of compilation that
   are to be compiled. If REQUIRE is encountered before interactive mode
   begins, it is exactly as if the input UoC was named on the command
   line. In interactive mode, the relevant unit of compilation is loaded
   immediately.

   Note this can be used by interfaces to cause auto-import of their
   corresponding implementations.

6. Calls into the runtime or external C libraries will be implemented
   using libffi. LIBFFI isn't available on all platforms, and it is
   erratic on some, so your mileage may vary in attempts to use it.

7. There is no provision for reloading or replacing any interface or
   source module.

8. Occurrences of interactive top-level DEFINE will be interpreted as
   SET! in cases where (a) the identifier is previously bound and
   (b) the types agree.

   Existing types cannot be redefined.


What have I missed?


shpa

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to