T-gen 2.1 Port to Smalltalk MT
Documentation
Release 1.2
Rolf K. Wilms, Febuary 2000
This is the documentation for a
port of T-gen 2.1, a parser generator for Smalltalk, to the
Smalltalk MT VC 2.6 development environment. It only covers the
differences to the original version, for complete documentation
refer to the files in the original T-Gen distribution which can
be found at ftp://st.cs.uiuc.edu/pub/Smalltalk/st80_r41/T-gen2.1 .
The latest version of the port to
Smalltalk MT can be found at http://www.ruhr.de/home/kottan.
Smalltalk MT is © by Object
Connect Sarl, http://www.objectconnect.com.
Contents
Legal
Information
Read the text in
Object>>tgenCopyright. This port may be used and
distributed under the same conditions. Summarized, this means
that you can use, extend and distribute T-gen for free even for
commercial purposes, provided that you respect and protect the
reputation of all different authors and that there is NO
WARRANTY.
Installation
- Create a dicrectory for the
T-gen files
- Extract the files of the
distributrion archive to that directory
- Make sure that at least
Smalltalk MT VC 2.6 Release is installed, this port of
T-gen will not work with earlier versions
- Make sure that stack-based
printing in 'Image
Properties->Settings->Preferences' is turned off.
This should be the default after smalltalk.sp has been
loaded. Don't turn it on while using T-gen, because
stack-based printing is incompatible with T-gen.
- Load tgen21.sp with the
project browser. (The dependency project asked for is in
vc26_install_dir\sources\dependency)
- After loading, you'll have to
save and compress the image before T-gen will work
- After the compressed image
has been restarted, execute TranslatorGenerator
class>>runAllTests (this is the test suite) to make
sure that everything works fine. The results are printed
on the Transcript.
Uninstallation
- Close the T-gen user
interface windows
- Execute
TGenFrameWindow>>removing
- Unload tgen21.sp from the
ProjectBrowser
- Remove the directory
youve created for T-gen
Getting
started
- Print out the T-gen
documentation usersguide.pdf using Acrobat Reader and
read it
- Open T-gen from the
Transcript/Tools menu
- Load one of the examples from
the examples directory using File/Open All
- Accept the token spec, then
the grammar spec, then the test input. The Transcript
will show the results.
- When memory is exhausted, the
system will not show an error message but slow down to a
halt. In this case, increase the Smalltalk Heap Reserve
on the Image Properties Process page, i.e. from 50 to 100
megs.
- Under Win98 (Win95 not
tested) text panes become empty or not properly updated
when the text is too long. This can happen easiely with
T-gen, for example when inspecting a parse result or
trace parse to the T-gen transcript.
User
interface hints
- Once you arranged the child
windows, click File/Save Preferences, then the next time
the user interface is opened the arrangement will be
restored.
- Be sure to click accept after
changing text in the child windows
- File/New will overwrite
changes without asking
- Loading and saving will
allways use three files (*.grm, *.tok, *.eg), these
cannot be loaded/saved individually
Changes to T-Gen for porting to
Smalltalk MT
- All changes and additions to
the original T-gen 2.1 source code done during the port
can be found by searching the String '$rwi' which is
included in class and method comments.
- The class
TranslatorGeneratorView has been removed, use
TGenFrameWindow instead.
- The user interface
implementation has been completely rewritten using the
Smalltalk MT windowing framework.
- The Smalltalk language parser
example of the original T-gen 2.1 distribution has not
been ported and is omitted in this release.
- All initialization code has
been moved to TranslatorGenerator
class>>initializeProject
- For compatibility with MT,
all backslashes in literal strings have been replaced
with double backslashes without further notice in the
changed methods.
- The linefeed (\n) character
has been added to GrammarSpecScanner and
TokenSpecScanner's <space> and <comment>
token classes. This has been done by manually modifying
the tables in the initialization methods. The comments
including the specifications have been modified too (look
for \n).
- All token specs defining \r
in token class <space> or token class
<comment> have been extended to also accept \n.
- The class instance variables
tokenSpecParser and grammarSpecParser of
TranslatorGenerator have been made instance variables and
their initialization is an instance initialization now.
This consumes more memory when multiple instances of
TranslatorGenerator are created but removes the problem
of unwanted references through the AbstractParser
instance variables <requestor> (which is a window)
and <failBlock>.
- The T-Gen manual has been
converted from Postscript to Adobe Acrobat format without
further changes. Please note that the <space> token
class specifications in the examples need an additional
\n to work with the MT port of T-Gen. I'd rather have the
manual converted to HTML instead of *.pdf, but couldn't
find a converter. The Acrobat Reader shows the manual
almost unreadable on the screen, just print it out and
it'll be fine.
- The Signal and
HandlerCollection classes have been implemented to use
the Smalltalk MT exception handling mechanism. The
protocol implemented covers only that required by T-gen,
it is no full port of the respective classes.
- The original version of T-gen
uses different changes files to seperate the runtime,
development, user interface and test suite parts of
T-gen. This port only uses one project file for all of
these parts because I decided to use the time which a
clean seperation of the parts would have taken on making
sure that a runtime can be packaged without problems, but
I havent done that either.
- A few changes have been
supplied by Persist AG, i.e. a new translation symbol
named #tag (look for senders of #tagSymbol).
Possible
enhancements
- make SetDictionary subclass
of MappingTable?
- maybe change reconstructOn:
of UndefinedObject to ##(nil), then the
copyReplacingPoundNilWithNil can be ommitted
- dont't know, if cr is special
(is it really) then why not lf? - prove that 'Character
lf' added to the special characters really works and
makes sense.
Files included in this release
| tgen21.sp
|
T-gen
project file for Smalltalk MT |
| tgen21forMT.htm |
this
file |
| usersguide.pdf |
original
T-gen documentation converted to PDF format |
| Examples |
directory
containing example grammars |
| readme.txt |
A
very short readme |
Release 1.2
- Reloading the project no longer creates
multiple entries in the Transcript->Tools menu.
- Added some changes to T-gen by Persist AG.
- Removed change to
Object>>printString in tgen_mtfix_do_not_unload.sp.
Since stack-based printing now is turned off when the
smalltalk.sp project is loaded and smalltalk.sp is a
prerequisite of the T-gen project, this is no longer
needed.
- Removed the methods which now are included in the
standard Smalltalk MT distribution version 2.6.
Release 1.1
- Changed Object>>printString using
tgen_mtfix_do_not_unload.sp so that a regular buffer is
used instead of one on the stack. This is required
because T-gen uses context blocks in redefinitions of
#printOn:, which isn't allowed with the original
Object>>printString. ObjectConnect will probably
change Object>>printString in a future version of
Smalltalk MT, so that this is only a temporary fix.
Thanks to ObjectConnect for pointing out this problem in
the T-gen port.
- Added the Smalltalk grammar example (but not the
additional parser code) from the original T-gen
distribution.
- Added a 'Known problems' section.
Feedback
Please send comments and
suggestions regarding the port of T-gen 2.1 to Smalltalk MT to
Rolf K. Wilms, rwilms@kottan.ruhr.de