Prism Metaprogramming Tool released

Laurent Martelli
24 Oct 1999 05:55:04 +0200

>>>>> "Jim" == James Little <> writes:

  >> >>>>> "Jim" == Jim Little <> writes:

  Jim> Prism development will proceed in four phases: * The
  >> "assembly Jim> language" phase.  * The "modern language" phase.
  >> * The Jim> "domain-specific language" phase.  * The "TUNES"
  >> phase.
  >> Is it real necessary to have these 4 phases ? Why should we
  >> define integer arithmetics before object orientation ?

  Jim> Hmm, good question.  The short answer is that new Prism
  Jim> languages are written with existing Prism languages.  It's
  Jim> easier to start by creating small building blocks, then using
  Jim> those to create larger structures.

Yes, of course. But I'm not sure that integers are required to do
interesting things, other than arithmetics. I think that sets and
operations on them are more powerful and more needed. But it's a
matter of what you want to do.

  Jim> Here's the detailed plan for the first phase and the
  >> beginning Jim> of the second: * Create a parser for integers *
  >> Create programs Jim> to do integer arithmetic
  >> To be honest, integer arithmetic is alsmost the first thing I've
  >> done with OIL :-). But I didn't have to create a parser. I'll
  >> probably do one in the future, but it is not required.

  Jim> Integer arithmetic is the first thing we'll do with Prism, too.
  Jim> :) Once we have integer arithmetic, we can write meaningful
  Jim> program.  Our first meaningful program will be an assembler
  Jim> metaprogram for the Prism virtual machine.  To create the
  Jim> assembler, we need the ability to parse integers.

  Jim> (Right now, there's an assembler, but it's written in Perl.  We
  Jim> need to bootstrap Prism by porting the assembler to the Prism
  Jim> Control metamodel.  Prism Control is the Prism VM's "machine
  Jim> code".)

  >> To avoid the parser, I just defined two functions bin2int and
  >> int2bin, to convert from list of `0' and `1' to integers, and
  >> vice-versa. Therefore, the user can type :
  >> add [bin2int (1 1)] [bin2int (1 0 1)] => 10094 bin2int 10094 =>
  >> 10096 = (1 0 0 0)
  >> (Yes I kow, the syntax is very unsual).

  Jim> It would be possible to do something similar in Prism -- you
  Jim> could specify the integer models directly -- but that gets
  Jim> pretty tedious after a while.  :)

Certainly. :-)

  >> So we can do an addition without having to parse integers.

  Jim> Definitely true.  I didn't mean to imply that we had to write
  Jim> the integer parser before we could implement integer
  Jim> arithmetic.  Rather, both are necessary before we can create
  Jim> the Prism/Control assembler.

Sure. I'm just trying to really separate UI from semantics so that in
the end, semantics do not depend on UI and UI can be changed easily. 

  Jim> By the way, where can I learn more about OIL?

Laurent Martelli