ignore .lib and .exe
[prop.git] / prop-src / setlgen.ph
blobfbecb1dd18b786bfacda77324a288b3b04995032
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describes the interface of the SETL-like sublanguage compiler.
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef SETL_data_mapping_compiler_h
7 #define SETL_data_mapping_compiler_h
9 #include "matchcom.h"
10 #include "setl-ast.h"
11 #include "env.h"
13 ///////////////////////////////////////////////////////////////////////////////
15 //  Forward declarations
17 ///////////////////////////////////////////////////////////////////////////////
18 datatype Time and Space;
20 ///////////////////////////////////////////////////////////////////////////////
21 // 
22 //  Type checking methods
24 ///////////////////////////////////////////////////////////////////////////////
25 extern Ty         type_of (Exp,  const Env&);  // type checking an expression
26 extern Tys        type_of (Exps, const Env&);  // type checking an expression list
27 extern .[Id,Ty]   type_of (LabExp,  const Env&);  // type checking an labeled expression
28 extern .[Ids,Tys] type_of (LabExps, const Env&);  // type checking an labeled expression list
29 extern Env  type_of (Def,   const Env&);  // type checking a definition
30 extern Env  type_of (Defs,  const Env&);  // type checking a definition list
31 extern void type_of (Stmt,  const Env&);  // type checking a statement 
32 extern void type_of (Stmts, const Env&);  // type checking a statement list
34 ///////////////////////////////////////////////////////////////////////////////
36 //  We inherit from the code generator and the match compiler.
38 ///////////////////////////////////////////////////////////////////////////////
39 class SETLCompiler : virtual public CodeGen,
40                      virtual public MatchCompiler 
41 {   
42    SETLCompiler(const SETLCompiler&);       // no copy constructor
43    void operator = (const SETLCompiler&);   // no assignment
44 public:
45    ////////////////////////////////////////////////////////////////////////////
46    // 
47    //  Constructor and destructor
48    //
49    ////////////////////////////////////////////////////////////////////////////
50             SETLCompiler();
51    virtual ~SETLCompiler();
53    ////////////////////////////////////////////////////////////////////////////
54    //
55    //  Generate SETL-like statements and definitions
56    //
57    ////////////////////////////////////////////////////////////////////////////
58    void gen_setl (Stmt);
59    void gen_setl (Def);
61 private:
63    ////////////////////////////////////////////////////////////////////////////
64    // 
65    //  Domain inference methods
66    //
67    ////////////////////////////////////////////////////////////////////////////
69    ////////////////////////////////////////////////////////////////////////////
70    // 
71    //  Time and space complexity inference methods
72    //
73    ////////////////////////////////////////////////////////////////////////////
74    .[Time,Space] complexity_of (Exp, const Env&);
75    .[Time,Space] complexity_of (Stmt, const Env&);
77    ////////////////////////////////////////////////////////////////////////////
78    // 
79    //  Code generation methods
80    //
81    ////////////////////////////////////////////////////////////////////////////
82    void gen_def   (Def);      // code generation for definitions
83    void gen_defs  (Defs);     // code generation for definition lists
84    void gen_stmt  (Stmt);     // code generation for statements
85    void gen_stmts (Stmts);    // code generation for statement lists
86    void gen_exp   (Exp);      // code generation for expressions
87    void gen_exps  (Exps);     // code generation for expression lists
90 #endif