DEADSOFTWARE

Добавлены выражения
[dsw-obn.git] / oberon.h
index ec742c6bd7af90c18b3850a37fe2163b12407de4..7ed16291b9b4da45a0c1b9bb7db798b1e427f067 100644 (file)
--- a/oberon.h
+++ b/oberon.h
@@ -51,6 +51,9 @@ struct oberon_context_s
        oberon_module_t * mod;
        oberon_type_t * types;
 
+       oberon_type_t * int_type;
+       oberon_type_t * bool_type;
+
        void * gen_context;
 };
 
@@ -60,13 +63,59 @@ enum {
        MODE_BOOLEAN
 };
 
-typedef struct
+enum {
+       OP_LOGIC_NOT,
+       OP_UNARY_MINUS,
+       OP_ADD,
+       OP_SUB,
+       OP_MUL,
+       OP_DIV,
+       OP_MOD,
+       OP_LOGIC_AND,
+       OP_LOGIC_OR,
+       OP_EQ,
+       OP_NEQ,
+       OP_LSS,
+       OP_LEQ,
+       OP_GRT,
+       OP_GEQ
+};
+
+typedef struct oberon_item_s oberon_item_t;
+typedef struct oberon_oper_s oberon_oper_t;
+typedef union oberon_expr_u oberon_expr_t;
+
+struct oberon_item_s
 {
+       int is_item;
+       oberon_type_t * result;
+
        int mode;
        int integer;
        int boolean;
        oberon_var_t * var;
-} oberon_item_t;
+};
+
+struct oberon_oper_s
+{
+       int is_item;
+       oberon_type_t * result;
+
+       int op;
+       oberon_expr_t * left;
+       oberon_expr_t * right;
+};
+
+union oberon_expr_u
+{
+       struct {
+               int is_item;
+               oberon_type_t * result;
+       };
+
+       oberon_item_t item;
+       oberon_oper_t oper;
+};
 
 oberon_context_t * oberon_create_context();
 void oberon_destroy_context(oberon_context_t * ctx);