Am 02.02.2018 um 14:28 schrieb Martin Ward:
On 02/02/18 09:24, Bernd Oppolzer wrote:
My string implementation uses two length fields in front of every
string, the first being the maxlength field, which tells the maximum
length that the string can hold, and the second one is the actual
length, which obviously should be less or equal to the maxlength.
Both length fields are two bytes, like in PL/1 varchars, so a string
can by up to 32767 bytes in length. A string variable defined as
STRING (20) occupies 24 bytes.
The original Pascal string used a single byte for the length
at a time when a $70K machine had a mere 4K words of memory.
Your string implementation increases the maximum string length
by a factor of 256 at a time when memory size has increased by
a factor of approximately one million.
Incidentally, perl strings can be over 4GB in length: in fact,
any size which will will fit in memory (including swap space).
Due to the heritage of the compiler and some design decisions,
the usable memory of New Stanford Pascal at the moment is limited
to about 16 MB (AMODE 24 on the mainframe, but this applies to
the other platforms, too, at the moment).
There are other limitations, for example the procedure size on the
mainframe is limited significantly by the base register problem ...
after some 400 lines of code in one procedure you will get a
"procedure too long" error ... while probably not a problem for
hand-written code, some code generators will have problems.
For example: I have a scanner generator which generates Pascal
code, and it is used in the compiler since 2017, so I had to do
some tricks to circumvent this limitation.
This is a compiler of the 1980s, but anyway: I made large progresses
in the last two years, the biggest probably to port the compiler to
Windows etc., which made compiler development much easier, faster
and more fun. The compiler grew from about 6.000 lines of code (in 2011)
to (now) 18.000, and the source program scanner is no more part of it :-)
so it is now quite different from the original compiler. My goal is to make
this extended Pascal a (sort of) competitor to PL/1, but available on all
platforms without differences.