symboldef.h

Go to the documentation of this file.
00001 /*******************************************************************\
00002 
00003                    SESAME project software license
00004 
00005               Copyright (C) 2002 University of Amsterdam
00006 
00007     This program is free software; you can redistribute it and/or
00008      modify it under the terms of the GNU General Public License
00009     as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015              GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018      along with this program; if not, write to the Free Software
00019       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020                            02111-1307, USA.
00021 
00022       For information regarding the SESAME software project see
00023               http://sesamesim.sourceforge.net or email
00024                     jcofflan@users.sourceforge.net
00025 
00026 \*******************************************************************/
00027 
00028 /*
00029  *                        Pearl Compiler (c) 1989 University of Amsterdam
00030  *                                  by
00031  *                      B.J. Overeinder & J.G. Stil
00032  *
00033  * This file contains the structures that are used as items in the various
00034  * symboltables. Further some contstants are defined.
00035  */
00036 #ifndef SYMBOLDEF_H
00037 #define SYMBOLDEF_H
00038 
00039 #include "ptree.h"
00040 #include "symbol.h"
00041 #include "util.h"
00042 
00043 
00044 #define GLOBALSYM       1 //  defines global scope 
00045 #define CLASSSYM        2 //  defines class scope 
00046 #define PARAMETER       3 //  defines parameter scope 
00047 #define LOCALSYM        4 //  defines local scope 
00048 #define INVISIBLESYM    12 //  defines scope in imported specclass 
00049 
00050 
00051 #define TBASIC          5
00052 #define TARRAY          6
00053 #define TPOINTER        7
00054 #define TENUM           8
00055 #define TSTRUCT         9
00056 #define TTYPE           10
00057 #define TCLASS          11
00058 
00059 
00060 // Symboltable entries
00061 
00062 typedef struct specx {
00063   symboltable *use_files;
00064   symboltable *types;
00065   symboltable *variables;
00066   symboltable *functions;
00067   symboltable *classes;
00068 } specx;
00069 
00070 
00071 typedef struct typex {
00072   char *name;
00073   char *basetype;
00074   char *realtype;
00075   int type;
00076   symboltable *fields;
00077   parsex *range;
00078   int scope;
00079   int flags;
00080   char *typesize;
00081   linex *lf;
00082 } typex;
00083 
00084 
00085 
00086 typedef struct varx {
00087   char *name;
00088   char *type;
00089   char *realtype;
00090   parsex *init;
00091   int scope;
00092   int flags;
00093   char *offset; //  Offset in frame, can be constant
00094   linex *lf;
00095 } varx;
00096 
00097 
00098 typedef struct mfpx {
00099   char *name;
00100   char *replytype;
00101   char *realreply;
00102   char *returntype;
00103   char *realreturn;
00104   symboltable *parameters;
00105   symboltable *locals;
00106   parsex *code;
00107   int scope;
00108   int flags;
00109   int is_double;
00110   char *paramsize; //  Size of parameters; variable 
00111   char *localsize; //  Size of locals; variable 
00112   int method_label;
00113   linex *lf;
00114   int istriv;
00115 } mfpx;
00116 
00117 
00118 typedef struct classx {
00119   char *name;
00120   symboltable *types;
00121   symboltable *variables;
00122   int verydirty; // This must be here so classx and typex match
00123   symboltable *func_meths;
00124   symboltable *subtypeof;
00125   int scope;
00126   int state_statistics;
00127   parsex *code;
00128   linex *lf;
00129   symboltable *localvar;
00130   char *varsize;
00131   char *cvarsize;
00132 } classx;
00133 
00134 
00135 typedef struct modulex {
00136   char *name;
00137   specx *specs;
00138   symboltable *types;
00139   symboltable *variables;
00140   symboltable *functions;
00141   symboltable *classes;
00142   bool label_init;
00143 } modulex;
00144 
00145 
00146 typedef struct namex {
00147   char *name;
00148   bool to_compile;
00149 } namex;
00150 
00151 
00152 typedef struct filex {
00153   char *name;
00154   parsex *spec, *impl;
00155 } filex;
00156 
00157 
00158 typedef struct subtype_rel {
00159   char *type;
00160   char *subtype;
00161   bool init;
00162 } subtype_rel;
00163 
00164 void initmodule(void);
00165 void init_moduletable(void);
00166 void addsubtype(symboltable *t, char *name);
00167 void addtype(symboltable *t, char *name, int type, char *basetype,
00168              symboltable *fields, int scope, linex *lf);
00169 void addvariable(symboltable *t, char *name, char *type, int scope,
00170                  parsex *init, linex *lf);
00171 void addfunction(symboltable *t, char *name, char *rettype, char *reptype,
00172                  symboltable *params, symboltable *locals, parsex *code,
00173                  bool ismethod, int scope, linex *lf);
00174 void addclass(symboltable *t, char *name, parsex *code, symboltable *types,
00175               symboltable *variables, symboltable *func_meths,
00176               symboltable *subtypeof, int scope, linex *lf,
00177               symboltable *localvars);
00178 void addmodule(symboltable *t, char *name, specx *specs, symboltable *types,
00179                symboltable *variables, symboltable *functions,
00180                symboltable *classes);
00181 
00182 #endif // SYMBOLDEF_H

Generated on Wed Apr 5 20:57:46 2006 for Sesame by  doxygen 1.4.6