[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters ]
Written by Jon Avotins and Glenn Maughan.
trooper.tar.gz (232,158 bytes)
TROOPER encapsulates the complexities of lexical analysis and parsing of Eiffel texts utilising an extended parse library which evolved from the ISE EiffelParse library. It provides a complete working parser written entirely in Eiffel. Semantic actions can be added to the parsing constructs to develop different tools such as pretty-printers, compilers, etc. and others as mentioned in the paper listed in the "Use" section of this file.
Copyright (C) 1995 Monash University, Department of Software Development, Australia
TROOPER GENERAL PUBLIC LICENSE
It is permitted to copy and distribute verbatim copies of this license, but altering it is not allowed.
The following terms describe the limitations on copying, distributing, using, or altering TROOPER software and those classes and files which are protected by this license.
1. You may copy and distribute verbatim copies of TROOPER source classes and files and the executable TROOPER as received and generated from the distribution, in any medium, provided that you conspicuously and appropriately publish on each copy a valid copyright notice of the form "Copyright (C) Monash University 1995" with the appropriate year; keep intact the notices on all files that refer to this License Agreement and the absence of any warranty and the list of original authors of each class; and give any other recipients of any protected TROOPER source classes, files and executable a copy of this License Agreement along with the program.
2. You may modify your copy or copies of TROOPER library source classes or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also cause the modified files to carry prominent notices stating that you changed the files and the date of any change. If program binaries are distributed or sold which are based in part on modified classes, then such modified classes must be made freely available in source code form. No restriction is placed on any new classes which may be written and used in conjunction with TROOPER library classes, though authors are encouraged to make them also available under the terms of this license.
3. You may use the TROOPER source classes, files and executable in any program for any purposes provided that you:
a) Include in any documentation describing the program the notice: "This program is based in part on TROOPER (Truly Reusable OO Compiler Compiler) written by Jon Avotins and Glenn Maughan and associated source classes and files, which is distributed free of charge by Monash University, Software Development Department, 900 Dandenong Road, Caulfield East, Victoria 3145 Australia, which may be obtained by anonymous ftp from the WWW site http://insect.sd.monash.edu.au/~trooper/"
b) Include in any documentation describing TROOPER a list of names acknowledging the original authors of TROOPER.
c) Acknowledge the use of TROOPER and TROOPER library classes in any description of the program including commercial advertising or articles in scientific journals, or any other publications.
4. You may not copy, sublicense, distribute or transfer protected TROOPER library classes except as expressly provided under this License Agreement. Any attempt otherwise to copy, sublicense, distribute or transfer TROOPER classes and executable, is void and your rights to them under this License agreement shall be automatically terminated. However, parties who have received computer software programs from you with this License Agreement will not have their licenses terminated so long as such parties remain in full compliance.
BECAUSE THE TROOPER LIBRARIES AND EXECUTABLE COVERED BY THIS LICENSE ARE LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, MONASH UNIVERSITY AND/OR OTHER PARTIES PROVIDE TROOPER, AND THE TROOPER LIBRARIES "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE LIBRARY CLASSES PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL MONASH UNIVERSITY AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE TROOPER AND THE TROOPER CLASSES AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE LIBRARIES TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY MONASH UNIVERSITY) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
YOOCC is distributed in source form.:
The distribution will create a number of directories:
TROOPER the source code for TROOPER TROOPER/extended_parse a version of EiffelParse with a number of extensions TROOPER/patterns containing a pattern for displaying recursively indented information
The "extended_parse" library is essential. TROOPER will not compile and run correctly with the standard ISE Parse library. A number of enhancements have been made to the ISE Parse library and stored in a patch file entitled "extended_parse_patch".
In order to reproduce our extended parse library, the following steps need to be made:
In order to keep the original ISE Parse library intact you should apply the patch to a local copy of the ISE Eiffel Parse library. To do this, execute the following commands:
Apply the patch to the ISE parse library using the following command:
patch < extended_parse_patch
Remove all redundant files with an extension of ".orig".
After application of the patch, if there are any files with a ".rej" extension, then the patch has failed. You may need to apply manual patches using the "extended_parse_patch" file.
To compile the system you need Eiffel installed (of course). The source has been developed with ISE Eiffel version 3.2.8 It should compile without problems on this version and any later versions.
Compilation depends on the setup of your Eiffel installation. Typically you will have the base libraries precompiled. We also precompile the base libraries with the lex libraries. However, this is for convenience only -- it saves on freezing.
Check the Ace file in the directory: Trooper. Make sure it specifies the correct precompilation option according to your setup.
It should read either:
if you have base + lex precompiled in the directory baselex. You may also change this to mvision to use the precompiled base + vision libraries. You get the idea...
The Ace files have been written with the assumption that the environment variable TROOPER is set to the directory you extracted the source into.
Set this with either:
setenv TROOPER ~/Development
for csh/tcsh shells or
for sh/bash shells.
Compile the source as normal using either ebench or es3. The compilation process may need to freeze depending on your precompilation options.
TROOPER has been compiled successfully on Solaris, Ultrix and Linux platforms. It is written entirely in Eiffel therefore is should run on all supported platforms.
The best description of how to use TROOPER can be found in the paper:
Jon Avotins, Glenn Maughan and Christine Mingins.
Department of Software Development.
This section describes the quick way to get started. You should refer to the paper for more detail.
TROOPER Command Parameters
Developing a Parser
The following steps are required to generate a parser with TROOPER:
A debug switch can be turned on to help debugging a parser once it has been compiled. The switch will display the parsing process as it occurs. To turn on this switch add (or uncomment) the following line in trooper's Ace file:
Also you can display the parse tree once parsing has been completed successfully. Add the following code to your parser:
if root_line.parsed then
This will display the parse tree to stdout. If you want to store the parse tree in a file replace io.output with a file object:
!! file.make_open_read ("my_tree")
if root_line.parsed then
TROOPER will perform at its best if you finalise the system. When you finalise make sure you comment out any precompile option's and debug options in the Ace file. Also delete the EIFGEN directory before compiling to make sure finalisation is as optimal as possible.
TROOPER's performance can decrease rapidly depending on the complexity of expressions in the text and how much backtracking needs to be done to successfully parse the class.
TROOPER is comprised of over 400 classes. Therefore it may take quite some time to compile TROOPER from scratch.
This is the first release of TROOPER. As such it provides a very useful framework for developing Eiffel tools that require parsing.
The enhancements that we (currently) envisage include:
Of course we have only limited time on our hands. So we are asking for your help. Any contributions, ideas, bug fixes etc., that you may have are more than welcome. We can work towards developing a well rounded and useful tool. If you extend TROOPER for your own uses please let us know.
[ Home Page ] [ Eiffel Archive ] [ Eiffel Classes and Clusters ]