1 //////////////////////////////////////////////////////////////////////////////
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef LALR_k_parser_generator_h
26 #define LALR_k_parser_generator_h
28 #include <AD/automata/lrgen.h> // LR-style parser generator base class
29 #include <AD/automata/operprec.h> // Operator precedence
31 class LALR_k_Gen
: public LRGen
{
33 LALR_k_Gen(const LALR_k_Gen
&); // no copy constructor
34 void operator = (const LALR_k_Gen
&); // no assignment
38 /////////////////////////////////////////////////////////////////////////
39 // Make inherited types visible
40 /////////////////////////////////////////////////////////////////////////
42 typedef Super::Symbol Symbol
;
43 typedef Super::State State
;
44 typedef Super::Rule Rule
;
45 typedef Super::Offset Offset
;
46 typedef Super::ProductionLength ProductionLength
;
50 /////////////////////////////////////////////////////////////////////////
51 // The implementation is hidden within
52 /////////////////////////////////////////////////////////////////////////
53 struct LALR_k_Gen_Impl
* impl
;
57 /////////////////////////////////////////////////////////////////////////
58 // Constructors and destructor
59 /////////////////////////////////////////////////////////////////////////
61 LALR_k_Gen(const Grammar
&, const OpPrecedence
&);
64 /////////////////////////////////////////////////////////////////////////
65 // Table compilation and code generation
66 /////////////////////////////////////////////////////////////////////////
68 virtual void compile (const Grammar
&, const OpPrecedence
&);
69 virtual std::ostream
& print_report (std::ostream
&, int verbosity
= 0);