Re: The "spinoza" programming language




<thomas.mertes@xxxxxx> wrote in message
news:55d27824-6a73-4152-badb-4a3405fe5206@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 11 Mrz., 19:46, "Bartc" <b...@xxxxxxxxxx> wrote:
<thomas.mer...@xxxxxx> wrote in message

...Your example could
have been laid out a bit better though:

procedure WhileStatement;
var laddr, lcix: integer;
begin
genlabel(laddr);
putlabel(laddr);
expression(fsys + [dosy]);
genlabel(lcix);
genfjp(lcix);
if sy = dosy then
insymbol
else
error(54);
statement(fsys);
genujpxjp(57(*ujp*),laddr);
putlabel(lcix)
end (*WhileStatement*) ;

Looking at this, I was puzzled at first why some lines end with ; and
some
don't. Easy fix, get rid of them:

procedure WhileStatement
var laddr, lcix: integer
begin
genlabel(laddr)
putlabel(laddr)
expression(fsys + [dosy])
genlabel(lcix)
genfjp(lcix)
if sy = dosy then
insymbol
else
error(54)
statement(fsys)
genujpxjp(57(*ujp*),laddr)
putlabel(lcix)
end (*WhileStatement*)

Now the eye-stopping ; at the end of the first line is gone ...

... and your modified P4 compiler is not able to compile
itself. If you think that such a change is so simple I suggest
you change the P4 compiler (exactly 4000 lines of code) to
compile your improved Pascal (The proof is: The new compiler
should be able to compile itself).

A change to use ! instead of ; can easily be done at one
place in the INSYMBOL function.

I wasn't suggesting an actual change to this compiler or even to Pascal.

I was demonstrating that in this example code, semicolons convey no
additional information, linebreaks are sufficient for the human reader.

But superfluous semicolons can be tolerated and can still be used as
separators or terminators if the programmer wishes.

allow ...multiline statements

Since most simple statements complete on one line, it makes more sense to
have special arrangements for multi-line statements rather than the other
way around (compare 'break' in C's switch statement: having 'break' as
default action and 'continue' for other cases would have been a much better
idea).

--
Bart


.