Stages in Using Geyacc PreviousNext

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

  1. Formally specify the grammar in a form recognized by geyacc. For each grammatical rule in the language, describe the action that is to be taken when an instance of that rule is recognized. The action is described by a sequence of Eiffel instructions.
  2. Write a lexical analyzer to process input and pass tokens to the parser. The lexical analyzer may be written by hand in Eiffel. It could also be produced using gelex.
  3. Redefine features such as report_error or clear_all if necessary.

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

  1. Run geyacc on the grammar to produce the parser class.
  2. Add the following libraries to your ECF file:
        $GOBO/library/parse/library_skl.ecf
        $GOBO/library/kernel/library.ecf
  3. Compile the Eiffel class(es) generated by geyacc, as well as any other classes in your system.
  4. In order to debug your grammar, the parser skeleton class is equipped with Eiffel debug instructions with the key "GEYACC". For example if you use ECF files, you just have to specify the following line in the option section:
        <debug name="GEYACC" enabled="true"/>

    Along with the verbose file generated with the -v option, this will help you to find out what is going on in the parser when it reads some 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 geyacc. During the design of the parser 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 two libraries listed above are required: the parser skeleton library and kernel adaptation library allowing portability across various Eiffel compilers.


Copyright 2000-2019, Eric Bezault
mailto:
ericb@gobosoft.com
http:
//www.gobosoft.com
Last Updated: 20 September 2019

HomeTocPreviousNext