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
RBProgramNode
.
The parser's extreme flexibility can be exploited in three ways, all of which are demonstrated by source code available in the distribution:
RBParser
that
can be overridden in different RBParser
subclasses. This is done
by the compiler itself, in which a subclass of RBParser
(class
STFileInParser
) hands the parse trees to the STCompiler
class.
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, contained in two
files, packages/stinst/compiler/STLoader.st and
packages/stinst/compiler/STLoaderObjs.st. To be able to create
Texinfo files even if the library cannot be loaded (for example,
BLOX
requires a running X server) Smalltalk source code is
interpreted and objects for the classes and methods being read in are
created; then, polymorphism allows one to treat these exactly like usual
classes which can be fed to gnu Smalltalk's ClassPublisher
(found in
packages/stinst/doc/Publish.st.