[comp.lang.postscript] Why change the language syntax?

flar@bendenweyr.Eng.Sun.COM (Jim Graham) (01/11/91)

Regarding << and >>, why were these operators named in such a way as
to be illegal syntax?  I like the operators, I just don't like their
names.

In Level 1 syntax, < started a hex string and a following < would
be illegal.  Even in Level 2, section 3.2.2 "ASCII Encoding" still
mentions that < is self-delimiting, which means that << is illegal
syntax (someone at Adobe should update that paragraph) since they
are separate tokens!

So, now we have the parser getting intimate with the names of the
operators.  In order to handle the << operator, the parser has to
special case the < character so that if there is only one, it
goes into hex string construction mode (or into ASCII base-85 mode
if it sees a <~), but if it sees another < immediately following
the first one, it needs to treat it like an operator name.

It would be nicer if the rules were:

	<~ started ascii base-85 mode
	<[0-9A-Fa-f] started hex string mode
	<... was a name and << is just an instance of this rule

but the fact that << is self-delimiting spoils that.

I guess this follows along the lines of [ and ] being both self-
delimiting characters and also operator names, but at least in that
case, there was not syntactic tree that had to be followed to try
to figure out if the token was a parser construction or an operator
name as is the case with <<, <~, and <, it was always just a name.

The interesting thing is that you can send a > to a PSL2 interpreter
and it will have to wait around until you send it another character
before it can determine if you have a syntaxerror or not yet.  In
PSL1 interpreters it is an immediate syntaxerror (closing > with
no opening <).

					...jim