[comp.sys.apple] P-Code and //e languages

campbellb@gtephx.UUCP (Brian Campbell) (06/07/89)

There have been recent discussions about P-code like systems
and small high level languages on the
network.  At least one person has expressed a desire for a PRODOS 
based system.  And that it should be small so that it can easily run 
on a //e, //c, etc.  Well, I have developed one.

The language is my own design.  It has elements of C and Pascal, but
it's a no-nonsense language.  It's stripped of the syntactic "sugar" you
see in other languages.  About the only punctuation it has is the
comma.  Part of the motivation for doing this project was to experiment
in language design.

The language compiles into P-code.
The P-code structure is proprietary (that i,s it's my own design).
It has the following properties:

1) It's very compact.  For example, I have developed the language
compiler, an assembler, and an editor, and they generate less than
5K of P-code object.  Imagine the possibilities: putting all of your
favorite user written tools on the /RAM disk for immediate access.

2) It's reasonably fast.  The P-code opcode dispatcher usually executes
about 5 to 6 machine instructions.

3) It's a stack based archictecture.  It has its own software implemented
stack.

4) The object files are entirely relocatable.

5) Its in a SYS file.  That means that it doesn't require the 
RAM portion of the BASIC interpretter.  It occupies the same memory 
region that BASIC.SYSTEM does.

The P-code interpretter also includes a command line interpretter, that
is, a shell like evironment.  Just type in the file name of the compiled
object, and off it runs.  You can give arguments on the command line
and pass them into the program.

In fact, I have developed numerous
utilities such as catalog, delete, etc.  The same BASIC fare.  Also,
copy, copy directory, and some other neat stuff.  The whole system
has a UNIX like feel to it.  And it works fine with a one disk system.
A two disk system is better, but a one disk system with a /RAM disk is
generally best.

Anyway, I written lots of programs with the system, and I like it. 
Yes I have a IIgs, and even though it runs under PRODOS 8, I've
done some toolbox programming with it.  Works great for that too.
                                                                 
I could go on, but I won't unless someone is interested.  Its not ready
for general release yet.  Its needs some work yet to make it a full
product.  Maybe later this year.  If there is interest, I will do it.
Normal distribution? Shareware? I haven't decided yet.

- Brian Campbell