Ayacc is an Ada parser generator in the style of yacc(1).
The first implementation was written by David Taback and Deepak Tolani at the University of California, Irvine. The last version that was released appeared to be the Ayacc 1.1 released in 1994.
Ayacc was used and improved by P2Ada, the Pascal to Ada translator. This version of Ayacc is derived from the P2Ada ayacc implementation released in August 2010.
This version brings a number of improvements:
- Ayacc now uses more standard options to configure the code generation
- The parser was improved to configure the parser stack size and support Ada child packages.
- The grammar supports the
%unitdirective to control the Ada child packages - It is possible to customize the
YYParseprocedure and pass some context arguments that are available to the grammar rules. - The call to
YYLexcan be customized with the%lexdirective allowing to give some context arguments when calling the lexer. - Ayacc can now generate reentrant parsers.
- Pascal Pignard added output states and input stack printing in debug mode;
these debugging information is only available and printed when the parser
is running in debug mode (option
-dandyy.debugis set toTrue); - If you use
-doption, you may have to fix your grammar and need to add the following with clauses in it:with Ada.Strings; with Ada.Strings.Unbounded; - Legacy
Text_IOis no longer available from the parser: you must fix your grammar and useAda.Text_IOinstead.
- Fix #7: Update ayacc.gpr: create missing dirs
- Fix #8: Update clean target in calc example and rename example package
- Support the Bison
%define variable valueoption to configure the parser generator - Support the Bison
%code name { ... }directive to insert code verbatim into the output parser - Recognize some Bison variables
api.pure,api.private,parse.error,parse.stacksize,parse.name,parse.params,parse.yyclearin,parse.yyerrok,parse.error - New option
-S skeletonto allow using an external skeleton file for the parser generator - Ayacc templates provide more control for tuning the code generation and they are embedded with Advanced Resource Embedder
- New option
-Pto generate a private Ada package for the tokens package - Improvement to allow passing parameters to
YYParsefor the grammar rules - New
%lexdirective to control the call ofYYLexfunction - Fix #6: ayacc gets stuck creating an infinitely large file after encountering a comment in an action
- Reformat code using gnatpp
- New option
-Cto disable the generation ofyyclearinprocedure, - New option
-Eto disable the generation ofyyerrokprocedure, - New option
-Dto write the generated files to the directory specified, - New option
-kto keep the case of grammar symbols, - Fixed various compilation warnings,
- Generate constants for shift reduce and goto arrays,
- Better strong typing in the generated state tables,
- Reduced number of style compilation warnings in generated code
make
make install prefix=/usr
-
Man page: ayacc (1)
-
Aflex 1.5 and Ayacc 1.3.0 explains how to use Aflex and Ayacc together, Aflex 1.5 et Ayacc 1.3.0 is the French translation.
- Pascal to Ada translator
- GWindows: GUI framework for MS Windows
- Ada parser for CSS files with CSS Object Model API
- Memory Analysis Tool
- Porion Build Manager
- Add your own Ayacc project here and submit a pull request...