HelenOS sources
#ifndef STREE_T_H_
#define STREE_T_H_
#include "bigint_t.h"
#include "list_t.h"
#include "builtin_t.h"
struct stree_expr;
typedef struct {
int sid;
struct cspan *cspan;
} stree_ident_t;
typedef struct {
struct stree_expr *expr;
stree_ident_t *name;
} stree_nameref_t;
typedef struct {
bool_t value;
} stree_lit_bool_t;
typedef struct {
bigint_t value;
} stree_lit_char_t;
typedef struct {
bigint_t value;
} stree_lit_int_t;
typedef struct {
} stree_lit_ref_t;
typedef struct {
char *value;
} stree_lit_string_t;
typedef enum {
ltc_bool,
ltc_char,
ltc_int,
ltc_ref,
ltc_string
} literal_class_t;
typedef struct {
struct stree_expr *expr;
literal_class_t ltc;
union {
stree_lit_bool_t lit_bool;
stree_lit_char_t lit_char;
stree_lit_int_t lit_int;
stree_lit_ref_t lit_ref;
stree_lit_string_t lit_string;
} u;
} stree_literal_t;
typedef struct {
struct stree_expr *expr;
} stree_self_ref_t;
typedef enum {
bo_equal,
bo_notequal,
bo_lt,
bo_gt,
bo_lt_equal,
bo_gt_equal,
bo_plus,
bo_minus,
bo_mult,
bo_and,
bo_or
} binop_class_t;
typedef enum {
uo_plus,
uo_minus,
uo_not
} unop_class_t;
typedef struct {
struct stree_expr *expr;
binop_class_t bc;
struct stree_expr *arg1, *arg2;
} stree_binop_t;
typedef struct {
struct stree_expr *expr;
unop_class_t uc;
struct stree_expr *arg;
} stree_unop_t;
typedef struct {
struct stree_expr *expr;
struct stree_texpr *texpr;
list_t ctor_args;
} stree_new_t;
typedef struct {
struct stree_expr *expr;
struct stree_expr *arg;
stree_ident_t *member_name;
} stree_access_t;
typedef struct {
struct stree_expr *expr;
struct stree_expr *fun;
list_t args;
} stree_call_t;
typedef enum {
ac_set,
ac_increase
} assign_class_t;
typedef struct {
struct stree_expr *expr;
assign_class_t ac;
struct stree_expr *dest, *src;
} stree_assign_t;
typedef struct {
struct stree_expr *expr;
struct stree_expr *base;
list_t args;
} stree_index_t;
typedef struct {
struct stree_expr *expr;
struct stree_expr *arg;
struct stree_texpr *dtype;
} stree_as_t;
typedef struct {
struct stree_expr *expr;
struct stree_expr *arg;
} stree_box_t;
typedef enum {
ec_nameref,
ec_literal,
ec_self_ref,
ec_binop,
ec_unop,
ec_new,
ec_access,
ec_call,
ec_assign,
ec_index,
ec_as,
ec_box
} expr_class_t;
typedef struct stree_expr {
expr_class_t ec;
struct tdata_item *titem;
struct cspan *cspan;
union {
stree_nameref_t *nameref;
stree_literal_t *literal;
stree_self_ref_t *self_ref;
stree_binop_t *binop;
stree_unop_t *unop;
stree_new_t *new_op;
stree_access_t *access;
stree_call_t *call;
stree_index_t *index;
stree_assign_t *assign;
stree_as_t *as_op;
stree_box_t *box;
} u;
} stree_expr_t;
struct stree_texpr;
typedef enum {
tlc_bool,
tlc_char,
tlc_int,
tlc_resource,
tlc_string
} tliteral_class_t;
typedef struct {
struct stree_texpr *texpr;
tliteral_class_t tlc;
} stree_tliteral_t;
typedef struct {
struct stree_texpr *texpr;
stree_ident_t *name;
} stree_tnameref_t;
typedef struct {
struct stree_texpr *texpr;
struct stree_texpr *arg;
stree_ident_t *member_name;
} stree_taccess_t;
typedef struct {
struct stree_texpr *texpr;
struct stree_texpr *gtype;
list_t targs;
} stree_tapply_t;
typedef struct {
struct stree_texpr *texpr;
struct stree_texpr *base_type;
int n_args;
list_t args;
} stree_tindex_t;
typedef enum {
tc_tliteral,
tc_tnameref,
tc_taccess,
tc_tapply,
tc_tindex
} texpr_class_t;
typedef struct stree_texpr {
texpr_class_t tc;
struct cspan *cspan;
union {
stree_tliteral_t *tliteral;
stree_tnameref_t *tnameref;
stree_taccess_t *taccess;
stree_tapply_t *tapply;
stree_tindex_t *tindex;
} u;
} stree_texpr_t;
typedef struct stree_block {
list_t stats;
} stree_block_t;
typedef struct {
stree_ident_t *name;
stree_texpr_t *type;
struct tdata_item *titem;
} stree_vdecl_t;
typedef struct {
stree_ident_t *evar;
stree_texpr_t *etype;
stree_block_t *block;
struct tdata_item *titem;
} stree_except_t;
typedef struct {
stree_expr_t *cond;
stree_block_t *block;
} stree_if_clause_t;
typedef struct {
list_t if_clauses;
stree_block_t *else_block;
} stree_if_t;
typedef struct {
list_t exprs;
stree_block_t *block;
} stree_when_t;
typedef struct {
stree_expr_t *expr;
list_t when_clauses;
stree_block_t *else_block;
} stree_switch_t;
typedef struct {
stree_expr_t *cond;
stree_block_t *body;
} stree_while_t;
typedef struct {
stree_block_t *body;
} stree_for_t;
typedef struct {
stree_expr_t *expr;
} stree_raise_t;
typedef struct {
} stree_break_t;
typedef struct {
stree_expr_t *expr;
} stree_return_t;
typedef struct {
stree_expr_t *expr;
} stree_exps_t;
typedef struct {
stree_block_t *with_block;
list_t except_clauses;
stree_block_t *finally_block;
} stree_wef_t;
typedef enum {
st_vdecl,
st_if,
st_switch,
st_while,
st_for,
st_raise,
st_break,
st_return,
st_exps,
st_wef
} stat_class_t;
typedef struct {
stat_class_t sc;
union {
stree_vdecl_t *vdecl_s;
stree_if_t *if_s;
stree_switch_t *switch_s;
stree_while_t *while_s;
stree_for_t *for_s;
stree_raise_t *raise_s;
stree_break_t *break_s;
stree_return_t *return_s;
stree_exps_t *exp_s;
stree_wef_t *wef_s;
} u;
} stree_stat_t;
typedef enum {
aac_packed
} arg_attr_class_t;
typedef struct {
arg_attr_class_t aac;
} stree_arg_attr_t;
typedef struct {
stree_ident_t *name;
stree_texpr_t *type;
list_t attr;
} stree_proc_arg_t;
typedef struct {
list_t args;
stree_proc_arg_t *varg;
stree_texpr_t *rtype;
} stree_fun_sig_t;
typedef struct stree_proc {
struct stree_symbol *outer_symbol;
stree_block_t *body;
builtin_proc_t bi_handler;
} stree_proc_t;
typedef struct stree_ctor {
stree_ident_t *name;
struct stree_symbol *symbol;
stree_fun_sig_t *sig;
stree_proc_t *proc;
struct tdata_item *titem;
} stree_ctor_t;
typedef struct stree_deleg {
stree_ident_t *name;
struct stree_symbol *symbol;
stree_fun_sig_t *sig;
struct tdata_item *titem;
} stree_deleg_t;
typedef struct stree_embr {
struct stree_enum *outer_enum;
stree_ident_t *name;
} stree_embr_t;
typedef struct stree_enum {
stree_ident_t *name;
struct stree_symbol *symbol;
list_t members;
struct tdata_item *titem;
} stree_enum_t;
typedef struct stree_fun {
stree_ident_t *name;
struct stree_symbol *symbol;
stree_fun_sig_t *sig;
stree_proc_t *proc;
struct tdata_item *titem;
} stree_fun_t;
typedef struct stree_var {
stree_ident_t *name;
struct stree_symbol *symbol;
stree_texpr_t *type;
} stree_var_t;
typedef struct stree_prop {
stree_ident_t *name;
struct stree_symbol *symbol;
stree_texpr_t *type;
stree_proc_t *getter;
stree_proc_t *setter;
stree_proc_arg_t *setter_arg;
list_t args;
stree_proc_arg_t *varg;
struct tdata_item *titem;
} stree_prop_t;
#define CTOR_IDENT "$ctor"
#define INDEXER_IDENT "$indexer"
typedef enum {
csimbr_csi,
csimbr_ctor,
csimbr_deleg,
csimbr_enum,
csimbr_fun,
csimbr_var,
csimbr_prop
} csimbr_class_t;
typedef struct {
csimbr_class_t cc;
union {
struct stree_csi *csi;
stree_ctor_t *ctor;
stree_deleg_t *deleg;
stree_enum_t *enum_d;
stree_fun_t *fun;
stree_var_t *var;
stree_prop_t *prop;
} u;
} stree_csimbr_t;
typedef enum {
csi_class,
csi_struct,
csi_interface
} csi_class_t;
typedef struct stree_targ {
stree_ident_t *name;
struct stree_symbol *symbol;
} stree_targ_t;
typedef struct stree_csi {
csi_class_t cc;
stree_ident_t *name;
list_t targ;
struct stree_symbol *symbol;
list_t inherit;
struct stree_csi *base_csi;
list_t impl_if_ti;
walk_state_t ancr_state;
list_t members;
} stree_csi_t;
typedef enum {
mc_csi,
mc_enum
} modm_class_t;
typedef struct {
modm_class_t mc;
union {
stree_csi_t *csi;
stree_enum_t *enum_d;
} u;
} stree_modm_t;
typedef struct stree_module {
list_t members;
} stree_module_t;
typedef enum {
sac_builtin,
sac_static
} symbol_attr_class_t;
typedef struct {
symbol_attr_class_t sac;
} stree_symbol_attr_t;
typedef enum {
sc_csi,
sc_ctor,
sc_deleg,
sc_enum,
sc_fun,
sc_var,
sc_prop
} symbol_class_t;
typedef struct stree_symbol {
symbol_class_t sc;
union {
struct stree_csi *csi;
stree_ctor_t *ctor;
stree_deleg_t *deleg;
stree_enum_t *enum_d;
stree_fun_t *fun;
stree_var_t *var;
stree_prop_t *prop;
} u;
stree_csi_t *outer_csi;
list_t attr;
} stree_symbol_t;
typedef struct stree_program {
stree_module_t *module;
struct builtin *builtin;
} stree_program_t;
#endif
HelenOS homepage, sources at GitHub