00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef INCL_UCSTMT
00026 #define INCL_UCSTMT
00027
00028 #include <vector>
00029 #include "ucloc.h"
00030 #include "uclabel.h"
00031
00032 class Uc_expression;
00033 class Uc_call_expression;
00034 class Uc_array_expression;
00035 class Uc_function;
00036 class Uc_var_symbol;
00037
00038 #ifndef ALPHA_LINUX_CXX
00039 # include <iosfwd>
00040 #endif
00041
00042
00043
00044
00045 class Uc_statement : public Uc_location
00046 {
00047 public:
00048 Uc_statement() : Uc_location()
00049 { }
00050 virtual ~Uc_statement() { }
00051
00052 virtual void gen(std::vector<char>& out, Uc_function *fun) = 0;
00053 };
00054
00055
00056
00057
00058 class Uc_block_statement : public Uc_statement
00059 {
00060 std::vector<Uc_statement *> statements;
00061 public:
00062 Uc_block_statement()
00063 { }
00064 ~Uc_block_statement();
00065 void add(Uc_statement *stmt)
00066 { statements.push_back(stmt); }
00067
00068 virtual void gen(std::vector<char>& out, Uc_function *fun);
00069 };
00070
00071
00072
00073
00074 class Uc_assignment_statement : public Uc_statement
00075 {
00076 Uc_expression *target, *value;
00077 public:
00078 Uc_assignment_statement(Uc_expression *t, Uc_expression *v)
00079 : target(t), value(v)
00080 { }
00081 ~Uc_assignment_statement();
00082
00083 virtual void gen(std::vector<char>& out, Uc_function *fun);
00084 };
00085
00086
00087
00088
00089 class Uc_if_statement : public Uc_statement
00090 {
00091 Uc_expression *expr;
00092
00093 Uc_statement *if_stmt, *else_stmt;
00094 public:
00095 Uc_if_statement(Uc_expression *e, Uc_statement *t, Uc_statement *f)
00096 : expr(e), if_stmt(t), else_stmt(f)
00097 { }
00098 ~Uc_if_statement();
00099
00100 virtual void gen(std::vector<char>& out, Uc_function *fun);
00101 };
00102
00103
00104
00105
00106 class Uc_while_statement : public Uc_statement
00107 {
00108 Uc_expression *expr;
00109 Uc_statement *stmt;
00110 public:
00111 Uc_while_statement(Uc_expression *e, Uc_statement *s)
00112 : expr(e), stmt(s)
00113 { }
00114 ~Uc_while_statement();
00115
00116 virtual void gen(std::vector<char>& out, Uc_function *fun);
00117 };
00118
00119
00120
00121
00122 class Uc_arrayloop_statement : public Uc_statement
00123 {
00124 Uc_var_symbol *var;
00125 Uc_var_symbol *array;
00126 Uc_var_symbol *index;
00127 Uc_var_symbol *array_size;
00128 Uc_statement *stmt;
00129 public:
00130 Uc_arrayloop_statement(Uc_var_symbol *v, Uc_var_symbol *a)
00131 : var(v), array(a), index(0), array_size(0), stmt(0)
00132 { }
00133 ~Uc_arrayloop_statement();
00134 void set_statement(Uc_statement *s)
00135 { stmt = s; }
00136 void set_index(Uc_var_symbol *i)
00137 { index = i; }
00138 void set_array_size(Uc_var_symbol *as)
00139 { array_size = as; }
00140 void finish(Uc_function *fun);
00141
00142 virtual void gen(std::vector<char>& out, Uc_function *fun);
00143 };
00144
00145
00146
00147
00148 class Uc_return_statement : public Uc_statement
00149 {
00150 Uc_expression *expr;
00151 public:
00152 Uc_return_statement(Uc_expression *e = 0) : expr(e)
00153 { }
00154 ~Uc_return_statement();
00155
00156 virtual void gen(std::vector<char>& out, Uc_function *fun);
00157 };
00158
00159
00160
00161
00162 class Uc_break_statement : public Uc_statement
00163 {
00164 public:
00165 Uc_break_statement() { }
00166
00167 virtual void gen(std::vector<char>& out, Uc_function *fun);
00168 };
00169
00170
00171
00172
00173 class Uc_label_statement : public Uc_statement
00174 {
00175 Uc_label *label;
00176 public:
00177 Uc_label_statement(Uc_label *l) : label(l)
00178 { }
00179 virtual void gen(std::vector<char>& out, Uc_function *fun);
00180 };
00181
00182
00183
00184
00185 class Uc_goto_statement : public Uc_statement
00186 {
00187 char *label;
00188 public:
00189 Uc_goto_statement(char *l) : label(l)
00190 { }
00191 virtual void gen(std::vector<char>& out, Uc_function *fun);
00192 };
00193
00194
00195
00196
00197
00198
00199
00200 class Uc_converse_statement : public Uc_statement
00201 {
00202 Uc_statement *stmt;
00203 public:
00204 Uc_converse_statement(Uc_statement *s)
00205 : stmt(s)
00206 { }
00207 ~Uc_converse_statement();
00208
00209 virtual void gen(std::vector<char>& out, Uc_function *fun);
00210 };
00211
00212
00213
00214
00215 class Uc_converse_case_statement : public Uc_statement
00216 {
00217 int string_offset;
00218 bool remove;
00219 Uc_statement *statements;
00220 public:
00221 Uc_converse_case_statement(int soff, bool rem, Uc_statement *stmts)
00222 : string_offset(soff), remove(rem), statements(stmts)
00223 { }
00224 ~Uc_converse_case_statement()
00225 { delete statements; }
00226
00227 virtual void gen(std::vector<char>& out, Uc_function *fun);
00228 };
00229
00230
00231
00232
00233
00234
00235 class Uc_converse2_statement : public Uc_statement
00236 {
00237 static int nest;
00238 Uc_expression *answers;
00239 Uc_statement *cases;
00240 public:
00241 Uc_converse2_statement(Uc_expression *a, Uc_statement *cs)
00242 : answers(a), cases(cs)
00243 { }
00244 ~Uc_converse2_statement();
00245
00246 virtual void gen(std::vector<char>& out, Uc_function *fun);
00247 };
00248
00249
00250
00251
00252 class Uc_message_statement : public Uc_statement
00253 {
00254 Uc_array_expression *msgs;
00255 public:
00256 Uc_message_statement(Uc_array_expression *m) : msgs(m) { }
00257
00258 virtual void gen(std::vector<char>& out, Uc_function *fun);
00259 };
00260
00261
00262
00263
00264 class Uc_say_statement : public Uc_message_statement
00265 {
00266 public:
00267 Uc_say_statement(Uc_array_expression *m) : Uc_message_statement(m)
00268 { }
00269
00270 virtual void gen(std::vector<char>& out, Uc_function *fun);
00271 };
00272
00273
00274
00275
00276 class Uc_call_statement : public Uc_statement
00277 {
00278 Uc_call_expression *function_call;
00279 public:
00280 Uc_call_statement(Uc_call_expression *f);
00281 ~Uc_call_statement();
00282
00283 virtual void gen(std::vector<char>& out, Uc_function *fun);
00284 };
00285
00286 #endif