Parsing slate files

Brian Rice water at tunes.org
Sun Jun 6 13:20:51 PDT 2004


Cool, I'm glad that helped.

On Jun 6, 2004, at 5:38 AM, John Leuner wrote:

> Yes, atEnd works perfectly.
>
> s@(String traits) fileIn
> [ | input aparser interp p|
> " Console ; 'Filing in $'' ; s ; '$'.$\n'."
>  input: (File open: s).
>  aparser: ((Syntax Parser clone) newOn: (input reader)).
>  [ aparser atEnd ] whileFalse: [ p: aparser next. (lobby interpretHook:
> [ p evaluateIn: lobby ])].
>  input close.
> ].
>
>
> I've been trying to implement the basic classes of SRP in slate. I'm at
> the point where I need to get a collection containing all the 
> subclasses
> (prototypes derived from) of a prototype.
>
> How can I do this in the bootstrapped VM?

Okay, this is basically a feature request which was already planned a 
bit. If you look in the GC sources (simple.slate, mark-compact.slate, 
or even gc.slate which is Squeak's but not fully tested - being the 
most complicated), you'll see some image-iteration methods (which 
become C functions). objectAfter: is the basic one, and then there's a 
whole protocol based on this in memory.slate, namely:

accessibleObjectAfter: (avoids freed/to-be-freed areas)
initialInstanceOfMap:, nextInstanceOfMap:after: (iterate through all 
objects with map X)
initialDelegateTo:, nextDelegateTo:after: (iterate through all objects 
delegating to X, but doesn't care which slot delegates)

So, the plumbing is there, and the remaining issue is what primitive to 
make for it. My suggestion is that we could include a new object in the 
special objects array to represent the image, and attach it off the 
lobby as a global, then have a primitive protocol for it of objectsDo:, 
progenyOf:Do:(??), cloneFamilyDo:(??), etc. The issues here are more 
tricky than for the simpler model of "subclass-of & instance-of", so a 
good protocol is probably going to take a bit of work to name 
correctly.

These are simple enough to do yourself, and you may find better names, 
anyway.

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list