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

Stefan Matthias Aust sma at kiel.netsurf.de
Thu Jan 7 19:43:06 UTC 1999


>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
>un-object-oriented.

Well, for the evaluation function, you need to at least detect methods and
blocks as one need to clone them and create an activation object.  How are
these objects detected?  Currently, I'm checking whether a "self*" or a
"(parent)*" slot exists, but that's also a hack.  I think, I'll introduce a
flag in the map.

>> (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.

Okay, so [] is really an abbreviation for [self].

>> 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.

I wrote my parser from scratch, only using the grammar which was available.
I've no fear of actually changing the grammar to improve it, if the
language is still Selfish enough :-)

For example, I right now thinking about restricting the use of "*" to
constant slots. Perhaps an unneeded restriction, but I think, it's easier
to create Self system which is not only simulated in Smalltalk but which
actually runs using the normal Smalltalk (Squeak) VM.

>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:

Yes, actually I've three kinds of periods which are handled in the scanner.
 When reading a number, the scanner will check whether there's a digit
following the period.  If not, it's a normal period, otherwise it's part of
the number. If the scanner finds a period, it also checks the next
character. For small letters, a "resendDot" flag is set. It's a bit tricky
and perhaps not the best language design, to make the meaning of the period
so dependent on the occurence of white spaces.

>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.

This actually is quite simple in my parser. When looking for a receiver, I
expect either an identifier (which might be the special string "self" or
not), a number, a string, a block or something with parenthesis. Everything
else isn't accepted but nil is returned.

When finally creating a message send, a nil for the receiver expression is
accepted as valid result. When looking for arguments, the nil is rejected
and an error is issued.

My problem was to detect resends.  When reading an identifier, the parser
must scan the next token and if that's a period, the resendDot flag must be
set. Otherwise, I'd to rewind and check for a normal message send.

>> [Ultimardrev-Self]

Thanks.


bye
--
Stefan Matthias Aust  //  Are you ready to discover the twilight zone?

------------------------------------------------------------------------
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