00001 #ifndef NODE_H_
00002 #define NODE_H_
00003
00004 #include <string>
00005 #include "location.h"
00006
00007 #include <iostream>
00008 #include <assert.h>
00009
00010 enum node_type {
00011 ADDRESSOF_EXP,
00012 ARRAY_REF_EXP,
00013 ASSEMBLY,
00014 BINOP_EXP,
00015 BLOCK,
00016 BLOCK_EXP,
00017 BREAK_STMT,
00018 BUILTIN_EXP,
00019 CASE_LABEL,
00020 CAST_EXP,
00021 COMPLEX_CONST_EXP,
00022 CONDITIONAL_EXP,
00023 CONTINUE_STMT,
00024 DEREF_EXP,
00025 DO_WHILE_LOOP,
00026 EXPR_LIST_EXP,
00027 EXPR_INSTRUCTION,
00028 FIELD_REF_EXP,
00029 FILE_NODE,
00030 FIXED_CONST_EXP,
00031 FOR_LOOP,
00032 FUNCTION_ADDRESS_EXP,
00033 FUNCTION_CALL_EXP,
00034 FUNCTION_DECL,
00035 FUNCTION_PTR_CALL_EXP,
00036 GOTO_STMT,
00037 IF_STMT,
00038 INITIALIZER_LIST_EXP,
00039 INTEGER_CONST_EXP,
00040 LABEL,
00041 MODIFY_EXP,
00042 NOOP_INSTRUCTION,
00043 REAL_CONST_EXP,
00044 RETURN_STMT,
00045 SET_INSTRUCTION,
00046 STRING_CONST_EXP,
00047 SWITCH_STMT,
00048 UNOP_EXP,
00049 VARIABLE_DECL,
00050 VARIABLE_EXP,
00051 VECTOR_CONST_EXP,
00052 WHILE_LOOP,
00053 TRY_CATCH_STMT,
00054 TRY_FINALLY_STMT,
00055 THROW_EXP
00056 };
00057
00058
00059
00060
00061
00062 #include "type.h"
00063 namespace il
00064 {
00065 class type;
00066
00070 class node
00071 {
00072 friend class boost::serialization::access;
00073
00074 template<class Archive>
00075 void serialize(Archive & ar, const unsigned int version)
00076 {
00077 ar & loc;
00078 ar & node_type_id;
00079 }
00080 protected:
00081
00082 location loc;
00083 public:
00084 short int node_type_id;
00085 node();
00086 virtual ~node();
00087 virtual string to_string() const {return "";};
00088 virtual location get_location();
00089 bool is_expression();
00090 void assert_expression();
00091 virtual void print(){};
00092
00093 node* substitute(node* (*sub_func)(node*));
00094
00095 };
00096
00097 }
00098
00099 #endif