move CPP_OPTS to config
[prop.git] / prop-src / metasyntax.ph
blobefa5d74d863c136aef151161012a765bc410a73a
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describes the interface to the meta-syntax compiler. 
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef meta_syntax_h
7 #define meta_syntax_h
9 #include <new>
10 #include "parsegen.ph"
11 ///////////////////////////////////////////////////////////////////////////////
13 //  Forward declarations
15 ///////////////////////////////////////////////////////////////////////////////
16 class MetaSyntaxCompilerImpl;
18 ///////////////////////////////////////////////////////////////////////////////
20 //  The meta-syntax compiler is responsible for translating patterns and
21 //  expressions written in meta-syntaxes into the equivalent in concrete
22 //  syntax.
24 ///////////////////////////////////////////////////////////////////////////////
25 class MetaSyntaxCompiler : public virtual ParserCompiler {
26    MetaSyntaxCompiler (const MetaSyntaxCompiler&);
27    void operator = (const MetaSyntaxCompiler&);
28 public:
29    ////////////////////////////////////////////////////////////////////////////
30    //
31    //  Constructor and destructor
32    //
33    ////////////////////////////////////////////////////////////////////////////
34             MetaSyntaxCompiler ();
35    virtual ~MetaSyntaxCompiler ();
37    ////////////////////////////////////////////////////////////////////////////
38    //
39    //  Methods to install a new grammar, parse expressions and patterns, 
40    //  and generate a new report.
41    //
42    ////////////////////////////////////////////////////////////////////////////
43    void     install_grammar (Id grammar_name, GramExp grammar);
44    Exp      parse_exp       (Id grammar_name, const char *);
45    Pat      parse_pat       (Id grammar_name, const char *);
46    std::ostream& print_report    (std::ostream&);
48 private:
49    ////////////////////////////////////////////////////////////////////////////
50    //
51    //  Private implementation stuff.
52    //
53    ////////////////////////////////////////////////////////////////////////////
54    MetaSyntaxCompilerImpl * impl; 
55    void compile_new_grammar (Id grammar_name, GramExp grammar);
56    void flush_grammar       (size_t memory_needed);
59 #endif