help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Which parser to use to parse the gnu-smalltalk code


From: Junsong Li
Subject: Re: [Help-smalltalk] Which parser to use to parse the gnu-smalltalk code
Date: Sun, 12 Apr 2015 10:56:36 -0400

Thanks. Basically what I want is just a method that compile the .st file,
give me the root node of the AST, then I can traverse the AST and print out
each kind of expression. I have tried _various_ classes in STInST, none of
them works. Here is what I got. There are basically Drivers and Parsers for
parsing:

1. STParsingDriver <- STEvaluationDriver
2. RBParser <- STFileParser <- STFileInParser <- GSTFileInParser

A simple executable expression to get a GSTFileInParser is

(STInST.STParsingDriver new parseSmalltalkStream: 'Object subclass: Test [
method [ ^1 ] ]' readStream
  with: STInST.GSTFileInParser) parser

Then I am stuck on getting AST out. It appears to having no methods to
return the AST node.  Anything wrong with it?

I also noticed there were a class named RBProgramNodeVisitor, Is there a
way I can get the RBProgramNodeVisitor from a given source file?

To answer your second question, yes, that's the error. Thanks for pointing
out.


On Sun, Apr 12, 2015 at 4:03 AM, Holger Freyther <address@hidden> wrote:

>
> Hi,
>
> > Can anyone point to me some resources about how to parse/traverse the
> > gnu-smalltalk code? There are many Parsers in the STInST package.
>
> I assume you mean programatically? The Parser package of STInST is
> the way to go. And the content in packages/sttools has an example on how
> to use it.
>
>
>
> > I see two syntax forms in the the source directory. Code in the kernel/
> can
> > be used in gst, but some in tests/, like Compiler.st, have parsing
> errors.
> > What's going wrong here? Shouldn't gst support both syntax?
>
>
> There is the standard “fileout” syntax of Smalltalk and the new GST
> format to make it more pleasant to edit with standard unix tools. What
> parse error do you get?
>
> There is a known issue in STInST that it fails to parse compile time
> constants ##(2/3) (which will be evaluated at compile time).
>
> holger


reply via email to

[Prev in Thread] Current Thread [Next in Thread]