initial
[prop.git] / include / AD / automata / ll1.h
blob707713d1b07f7c933adc2c06eabf0db6dd6fcb5c
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
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
9 // your programs.
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
16 // code.
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
21 // Allen Leung
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef LL1_parser_h
26 #define LL1_parser_h
29 // Class |LL1| represents a parser generated by a LL(1) grammar.
30 // The algorithm used is the one described in \cite{FL-1988}.
33 #include <AD/automata/grammar.h> // Canonical parser grammar
34 #include <AD/automata/compdfa.h> // Compressed sparse dfa
36 class LL1 {
38 LL1(const LL1&); // no copy constructor
39 void operator = (const LL1&); // no assignment
41 protected:
43 typedef Grammar::NonTerminal NonTerminal;
44 typedef Grammar::Terminal Terminal;
45 typedef Grammar::Action Action;
46 typedef Grammar::Production Production;
47 typedef CompressedDFA::State State;
48 typedef CompressedDFA::Offset Offset;
50 const Offset * base;
51 const State * next;
52 const Grammar grammar;
54 public:
56 LL1() {}
58 LL1( const Offset base_table [],
59 const State next_table [],
60 const Grammar& G
61 ) : base(base_table), next(next_table), grammar(G) {}
63 ~LL1() {}
66 #endif