The Smalltalk-in-Smalltalk library is a set of classes for looking at Smalltalk code, constructing models of Smalltalk classes that can later be created for real, analyzing and performing changes to the image, finding smelly code and automatically doing repetitive changes. This package incredibly enhances the reflective capabilities of Smalltalk.
A fundamental part of the system is the recursive-descent parser which
creates parse nodes in the form of instances of subclasses of
The parser’s extreme flexibility can be exploited in three ways, all of which are demonstrated by source code available in the distribution:
RBParserthat can be overridden in different
RBParsersubclasses. This is done by the compiler itself, in which a subclass of
STFileInParser) hands the parse trees to the
RBFormatter, by the syntax highlighting engine included with the browser, and by the compiler.
In addition, two applications were created on top of this library which are specific to GNU Smalltalk. The first is a compiler for Smalltalk methods written in Smalltalk itself, whose source code provides good insights into the GNU Smalltalk virtual machine.
The second is the automatic documentation extractor.
gst-doc is able
to create documentation even if the library cannot be loaded (for example,
if loading it requires a running X server). To do so it uses
STClassLoader from the Parser package to load and interpret
Smalltalk source code, creating objects for the classes and methods being
read in; then, polymorphism allows one to treat these exactly like usual