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.
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 | ... ;
...
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.
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.