[self-interest] more syntax madness and Ultimardrev (was: Announcing mySelf)

Jecel Assumpcao Jr jecel at lsi.usp.br
Thu Jan 7 01:42:32 UTC 1999

> Then SELF 1.0 had no '( expr )' at all.  Everything in () was a new object,
> however only objects in slot definitions got a 'self' slot. Right?

Yes, but these inner methods had an invisible "lexical parent" slot
just like block method contexts do. Another strange thing in Self 1.0
was that the first byte in the bytecode vector was used to indicate
what kind of method this object was. I really hated that - it was so

> >[patch in tinySelf0 parser]
> Which is the same heuristic as I used.  However, I dislike this solution
> because I'd prefer one which can be expressed with a context free LL(1)
> grammar.

I wish it were possible, but there are several cases in Self
where grammar alone won't get the job done. There is a great
parser generator for Self called Mango, yet it was never used
to generate a parser for Self itself!!

> >then tinySelf0 will generate an inner method, but Self 4.0 will
> >complain that inner methods are no longer supported.
> But this means, the grammar given in the Self 4.0 programmers reference is
> wrong (or at least ambigious).  If I understand this correctly, objects
> with code (aka methods) are only allowed in constant slot definition and
> never in general expressions. This would lead to...
> object --> '(' [object-slot-list] ')'
> method --> '(' [object-slot-list] code ')'
> block --> '[' [block-slot-list] [code] ']'
> (btw, whats the result of the empty block []?)

It is just a block that when sent the 'value' message will
return the receiver of the method in which it lexically appears.

> receiever --> [primary]
> primary --> 'self' | '(' expression ')' | constant
> constant --> number | string | object | block

Ok, so here you distinguish between "normal" objects and methods
in the grammar. That is probably a good solution for a new parser.
Since both mine and Self 4's evolved from Self 1.0, the hack was
the best choice.

> and there's now only a problem to distinguish a constant data-slot and an
> unary-slot.  (| a = (3 + 4). |) would actually be a method, not a constant.

It should only be interpreted as a constant slot if it can't be
interpreted as a unary method slot. Actually, I see 'a' as a
constant slot where the constant value happens to be a method

Did you find handling the '.' character hard? The way things are
defined, it is impossible to cleanly separate the lexer and the
parser. The problem is that white space is significant:

      x. y: 9.1 + 2     "my y = 11.1"
      x.y: 9.1 + 2      "my x parent's y = 11.1"
      x. y: 9. 1 + 2    "my y = 9"
      x.y: 9. 1 + 2     "my x parent's y = 9"

I also found that the implicit self things really made the parser
a bit messy, but I like that enough that it is worth the hassle.

> I'd be interested in the Ultimardrev-Self thing, and might even try to port
> this to VW3 or Squeak, which might be easier.

I will try to upload a compressed version of it (180KB) so you
can get it as


It will certainly be easier to port to VW3 than to Squeak.

-- Jecel

eGroup home: http://www.eGroups.com/list/self-interest
Free Web-based e-mail groups by eGroups.com

More information about the Self-interest mailing list