AdaGOOP Home Page


The content of this page in no way reflects the opinions, standards, or policy of the United States Air Force Academy or the United States government.
The appearance of external hyperlinks does not constitute endorsement by the U.S. Air Force of these Web sites or the information, products, or services contained therein. The U.S. Air Force does not exercise any editorial control over the information you may find at these locations. These links are consistent with the stated purpose of this DoD Web site.

Introduction

Welcome to the AdaGOOP home page.  AdaGOOP is the Ada Generator of Object-Oriented Parsers.  Using AdaGOOP, you can easily generate a parser which builds an object-oriented parse tree. Read here the Ada Letters paper (June 2000) describing AdaGOOP.

Getting Started

To use AdaGOOP, you will need the following tools:
  • AdaGOOP sources

    Using AdaGOOP

    AdaGOOP takes as input a set of regular expressions and a grammar, and generates inputs to scaflex and scayacc, along with a package specification for the parse tree.

    AdaGOOP should be executed as follows:
        adagoop input_file output_prefix

    The following files are generated as output of AdaGOOP:
    output_prefix.l (scaflex input), output_prefix.y (scayacc input), output_prefix_model.ads (parse tree package spec).  For example, in the Ada 95 sample folder, running "adagoop ada95.g ada95" generates ada95.l, ada95.y and ada95_model.ads.

    Your input file must have the following form (bold face indicates reserved words):
    Comments begin with "--" and must appear on a line by themselves.  Comment and blank lines may appear anywhere in the input file.

    token_macros
    -- the token_macros section allows you to associate names with regular expressions
    -- so they can be used more than once in the token descriptions.
    name    regular_expression
    name    regular_expression
    ...

    tokens
    -- the tokens section allows you to associate names with tokens
    -- the token_macros may be used as part of the regular expressions
    -- if the name is "ignore" (not in quotes), then this token will be skipped and not returned
    -- ignore may not be used in the grammar
    name    regular_expression
    name    regular_expression
    ...

    global_methods
    -- specify the name of methods that will be generated in the spec for every tagged type.
    name
    name
    ...

    grammar
    -- Use yacc format to specify the grammar
    -- ignore may not be used in the grammar
    -- sequence may be empty.  Only one sequence per name is required
    -- no actions may be provided (these are generated automatically)
    -- begin with %start to specify the goal symbol
    %start goal_symbol
    name  :  sequence of non-terminals or tokens | second sequence | ... ;
    name  :  sequence of non-terminals or tokens | second sequence | ... ;
    ...

    Resulting Object Hierarchy

    Each non-terminal generates an abstract tagged type (named with the name of the nonterminal appended with "_nonterminal") derived from the root class Parseable.  Each possible derivation is a concrete child of that abstract class containing pointers to each of the items in the sequence (including tokens, which are of type Parseable_Token).  Parseable_Token contains line and column information, along with an enumeration type of all tokens (appended with "_token"), and a token string of the exact text seen.

    See the samples directory for some examples, including a complete grammar for Ada 95.

    Feedback

    Complete sources are available.  If you have suggestions for improvement, or (better yet), contributions, please send them to Martin Carlisle.

    Copying

    AdaGOOP is distributed freely by the Department of Computer Science, United States Air Force Academy.  There are no restrictions on its use, although we do request that you keep the author information intact, and clearly indicate if you have modified the sources.

    AdaGOOP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.