Paul Koning wrote:
You may be missing the different product names.
"BASIC-PLUS" and "BASIC-PLUS-2" are very different beasts. (I
haven't
seen BASIC-PLUS-1 before, that wasn't a normal designation but the
meaning is obvious.)
BP was a P-code ("push-pop code") incremental compiler. It runs only
on RSTS.
Right. It compiled into a "reverse polish" format.
It runs a lot like "java" does now.
Unlike Mirosoft basic, it does not have to be re-interpreted
every time the line is executed. The execution just executes
the p-code step by step.
BP2 was a regular compiler; it would produce object
files which you'd
feed to TKB to get your RSX-format executables. It ran on RSTS, RSX,
and VMS.
And I have never seen a decompiler for BP2.
It may be possible, but I've never seen one.
From the point
of view of language, BP2 was pretty much a superset of
BP though not exactly. You
could certainly write the intersection of
the two very easily. At DEC, that was the practice for RSTS tools
because, at least for a while, they needed to be useable for customers
who didn't have the BP2 optional (extra cost) product installed.
Later that was dropped due to the introduction of "CSPCOM", a limited
BP2 variant.
As I understand it, CSPCOM was an earlier version
of BP2, without much of the supporting software.
The decompilers you're describing are for BP, not
BP2. PPcode was
just "high level" enough that you could get reasonably intellegible
decompile output. I don't think the decompile would actually produce
BASIC source; instead it was more like an annotated disassembly that
you could read with some effort. At least that's what I recall from
the one or two occasions where I tried one of those decompilers.
The two that I have generate runnable code.
Sometimes it generates a wrong instruction in weird
cases, iirc, rarely used code like "x = y until z" would
sometimes decompile wrongly, but it normally worked.
The decompilers I have take the "reverse polish", and
transform it back to the original form. The code you get
back nay not look exactly like the original (the original
parentheses are long gone), but it was equivalent code.
BP p-code was not optimized in any way. 1+2+3 was
compiled as "1 2 + 3 +", and not as "6", for example.
This is what made decompiling possible, and actually
fairly easy. The biggest problem was the limited memory
space for the decompiler.
By contrast, BP did support "LIST" but it
would do that by saving the
source text (in a temporary file) as well as the P-code
representation; LIST would give you the saved source text.
Basic Plus kept both the original source and the p-code.
"Save" would save the source, "compile" would save the
p-code. Unlike Microsoft basic, BP did nothing to the
original source, like extracting spaces. Microsoft basic
would convert the source to tokens (in place) whenever
possible, and typing the code in lower case would cause
this tokenization to fail, resulting in larger and slower code.