Syntax/Semmantics for an extensible language

Eric W. Biederman
Tue, 2 Apr 1996 01:01:32 -0600

First Have a default syntax for programs -- with no extension
I propose a simple lisp syntax


symbol -- sequence of characters no spaces
function-name -- symbol you can execute // sematic constraint 

function-call ==> ( function-name arg-list)
arg-list ==> nil | arg | arg arg-list      // nil is no symbol at all
arg ==> symbol | function-call


To allow this grammer to be extensively extensible you need only
support two distint types of function-call exection.

Run-time execuition -- the normal variant

Compile-time execution -- Functions of this type run during
  compilation, and optionally may be allowed to parse the file from
  where they first occur.  Semmantically these functions are just
  arbitray functions that run during compilation time.  
    They may be used for:
  installable parsers, 
  object initialization,
  macro expansion,

This organization is basically stolen from Forth.

How would this organization work for the HLL?
This organization should make syntax completely orthogonal to the
semantics of the language.

My thought example.

(module x 
  // blah blah blah 
  // code in the default syntax
  (require 'c-parser)
    int main(int argc, char *argv)
       /* blah blah some C code */

  (require 'asm-i386-parser)
   # blah blah you get the idea