Stages in Using Gelex |

This section lists the steps to follow to produce a working scanner using gelex. First, you have to write a description of the scanner you want to generate:

1. Formally specify the scanner in a form recognized by gelex. For each pattern, describe the action that is to be taken when an instance of that pattern is recognized. The action is described by a sequence of Eiffel instructions.
2. If the scanner is to be used as lexical analyzer associated with a parser generated by geyacc, you may want to inherit from the class containing the token type codes. This class is automatically generated by geyacc using the `-t` option.
3. Redefine features such as `reset``` or`` `wrap``` if necessary.

To turn the above scanner specification into a runnable program, proceed as follows:

1. Run gelex on the grammar to produce the scanner class.
2. Add the following clusters to your Ace file (ISE Eiffel, SmartEiffel) or your ESD/Xace file (Visual Eiffel) depending on the Eiffel compiler you are using:

           $GOBO/library/lexical/skeleton
           $GOBO/library/kernel
           $GOBO/library/kernel/spec/<compiler>

   where `<compiler>` is either `ise`, `s` `e` or `ve`.
3. Compile the Eiffel class generated by gelex, as well as any other classes in your system.
4. In order to debug your scanner, the scanner skeleton class is equipped with Eiffel debug instructions with the key `"GELEX"`. For example with ISE Eiffel you just have to specify the following line in the default clause of the Ace file:

           debug ("GELEX");

   This will help you to find out what kind of tokens are recognized from input.

Note that contrary to false assumptions, there is no need to include in your system all libraries that come with Gobo Eiffel in order to take advantage of the facilities provided by gelex. During the design of the scanner skeleton, care has been taken to only use Kernel classes such as `ARRAY` or `STRING`, and therefore avoiding the unnecessary overhead of other library classes. As a consequence, only the three clusters listed above are required: the scanner skeleton cluster and Kernel adaptation clusters allowing portability across various Eiffel compilers.