About Smacc
stéphane ducasse
ducasse at iam.unibe.ch
Fri May 26 20:26:37 UTC 2006
Marcus
is the parseMethod: or equivalent now in the Smacc package?
Because it seems useful.
Stef
> the SmaCCParser superclass provides the method
> #parseStream:startingAt:
>
> First parameter is the stream to parse, second the starting state
> of the parser. SmaCC
> generates accessors for the possible starting states automatically
> (see method category
> 'generate starting states')
>
> For the SqueakParser (part of NewCompiler), this method was
> implemented to make it
> easy to use from other code:
>
> parseMethod: stringOrStream
>
> ^ (self
> parseStream: stringOrStream readStream
> startingAt: self startingStateForMethod)
> source: stringOrStream contents
>
> Thus,
>
> SqueakParser parseMethod: 'hello ^1'
>
> will give you an RB AST.
>
> For experiments, do not use the STParser. It's kind of broken *and*
> it just
> generates a parse tree, which is not what's needed in most cases. The
> SqueakParser (part of NewCompiler) can actually parse the whole image
> *and* it directly generates an RB AST.
>
> Marcus
>
>
>
More information about the Squeak-dev
mailing list
|