Sorry. A typo: I also noticed there was a class named RBProgramNodeVisitor, Is there a way I can get the RBProgramNode from a given source file?
On Sun, Apr 12, 2015 at 10:56 AM, Junsong Li <[email protected]> wrote: > 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 <[email protected]> > 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 > > > _______________________________________________ help-smalltalk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-smalltalk
