Changeset 640ffe6 in mainline for uspace/app/sbi/src/stree_t.h


Ignore:
Timestamp:
2010-05-08T08:15:57Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4039c77
Parents:
1317380 (diff), 051bc69a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jsvoboda/helenos/sysel. New: cspan printing, boolean ops, enums, constructors etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/stree_t.h

    r1317380 r640ffe6  
    4343typedef struct {
    4444        int sid;
     45        struct cspan *cspan;
    4546} stree_ident_t;
    4647
    4748/** Name reference */
    4849typedef struct {
     50        /** Expression backlink */
     51        struct stree_expr *expr;
     52
    4953        stree_ident_t *name;
    5054} stree_nameref_t;
    51 
    52 /** Reference to currently active object. */
    53 typedef struct {
    54 } stree_self_ref_t;
    5555
    5656/** Boolean literal */
     
    8888/** Literal */
    8989typedef struct {
     90        /** Expression backlink */
     91        struct stree_expr *expr;
     92
    9093        literal_class_t ltc;
    9194        union {
     
    98101} stree_literal_t;
    99102
     103/** Reference to currently active object. */
     104typedef struct {
     105        /** Expression backlink */
     106        struct stree_expr *expr;
     107} stree_self_ref_t;
     108
    100109/** Binary operation class */
    101110typedef enum {
     
    108117        bo_plus,
    109118        bo_minus,
    110         bo_mult
     119        bo_mult,
     120        bo_and,
     121        bo_or
    111122} binop_class_t;
    112123
     
    115126        uo_plus,
    116127        uo_minus,
     128        uo_not
    117129} unop_class_t;
    118130
    119131/** Binary operation */
    120132typedef struct {
     133        /** Expression backlink */
     134        struct stree_expr *expr;
     135
    121136        /** Binary operation class */
    122137        binop_class_t bc;
     
    128143/** Unary operation */
    129144typedef struct {
     145        /** Expression backlink */
     146        struct stree_expr *expr;
     147
    130148        /** Operation class */
    131149        unop_class_t uc;
     
    137155/** New operation */
    138156typedef struct {
     157        /** Expression backlink */
     158        struct stree_expr *expr;
     159
    139160        /** Type of object to construct. */
    140161        struct stree_texpr *texpr;
     162
     163        /** Constructor arguments */
     164        list_t ctor_args; /* of stree_expr_t */
    141165} stree_new_t;
    142166
    143167/** Member access operation */
    144168typedef struct {
     169        /** Expression backlink */
     170        struct stree_expr *expr;
     171
    145172        /** Argument */
    146173        struct stree_expr *arg;
     
    151178/** Function call operation */
    152179typedef struct {
     180        /** Expression backlink */
     181        struct stree_expr *expr;
     182
    153183        /** Function */
    154184        struct stree_expr *fun;
     
    165195/** Assignment */
    166196typedef struct {
     197        /** Expression backlink */
     198        struct stree_expr *expr;
     199
    167200        assign_class_t ac;
    168201        struct stree_expr *dest, *src;
     
    171204/** Indexing operation */
    172205typedef struct {
     206        /** Expression backlink */
     207        struct stree_expr *expr;
     208
    173209        /** Base */
    174210        struct stree_expr *base;
     
    180216/** @c as conversion operation */
    181217typedef struct {
     218        /** Expression backlink */
     219        struct stree_expr *expr;
     220
    182221        /** Expression to convert */
    183222        struct stree_expr *arg;
     223
    184224        /** Destination type of conversion. */
    185225        struct stree_texpr *dtype;
     
    193233 */
    194234typedef struct {
     235        /** Expression backlink */
     236        struct stree_expr *expr;
     237
    195238        /* Primitive type expression */
    196239        struct stree_expr *arg;
     
    217260        expr_class_t ec;
    218261
     262        /** Type of this expression or @c NULL if not typed yet */
    219263        struct tdata_item *titem;
     264
     265        /** Coordinate span */
     266        struct cspan *cspan;
    220267
    221268        union {
     
    252299/** Type literal */
    253300typedef struct {
     301        /** Type expression backlink */
     302        struct stree_texpr *texpr;
     303
    254304        tliteral_class_t tlc;
    255305} stree_tliteral_t;
     
    257307/** Type name reference */
    258308typedef struct {
     309        /** Type expression backlink */
     310        struct stree_texpr *texpr;
     311
    259312        stree_ident_t *name;
    260313} stree_tnameref_t;
     
    262315/** Type member access operation */
    263316typedef struct {
     317        /** Type expression backlink */
     318        struct stree_texpr *texpr;
     319
    264320        /** Argument */
    265321        struct stree_texpr *arg;
     322
    266323        /** Name of member being accessed. */
    267324        stree_ident_t *member_name;
     
    270327/** Type application operation */
    271328typedef struct {
     329        /** Type expression backlink */
     330        struct stree_texpr *texpr;
     331
    272332        /* Base type */
    273333        struct stree_texpr *gtype;
     
    279339/** Type index operation */
    280340typedef struct {
     341        /** Type expression backlink */
     342        struct stree_texpr *texpr;
     343
    281344        /** Base type */
    282345        struct stree_texpr *base_type;
     
    304367typedef struct stree_texpr {
    305368        texpr_class_t tc;
     369
     370        /** Coordinate span */
     371        struct cspan *cspan;
    306372
    307373        union {
     
    337403} stree_except_t;
    338404
     405/** @c if or @c elif clause */
     406typedef struct {
     407        stree_expr_t *cond;
     408        stree_block_t *block;
     409} stree_if_clause_t;
     410
    339411/** If statement */
    340412typedef struct {
    341         stree_expr_t *cond;
    342         stree_block_t *if_block;
     413        /** If and elif clauses */
     414        list_t if_clauses; /* of stree_if_clause_t */
     415
     416        /** Else block */
    343417        stree_block_t *else_block;
    344418} stree_if_t;
     
    359433        stree_expr_t *expr;
    360434} stree_raise_t;
     435
     436/** Break statement */
     437typedef struct {
     438} stree_break_t;
    361439
    362440/** Return statement */
     
    384462        st_for,
    385463        st_raise,
     464        st_break,
    386465        st_return,
    387466        st_exps,
     
    399478                stree_for_t *for_s;
    400479                stree_raise_t *raise_s;
     480                stree_break_t *break_s;
    401481                stree_return_t *return_s;
    402482                stree_exps_t *exp_s;
     
    461541} stree_proc_t;
    462542
     543/** Constructor declaration */
     544typedef struct stree_ctor {
     545        /** Constructor 'name'. Points to the @c new keyword. */
     546        stree_ident_t *name;
     547
     548        /** Symbol */
     549        struct stree_symbol *symbol;
     550
     551        /** Signature (arguments, return type is always none) */
     552        stree_fun_sig_t *sig;
     553
     554        /** Constructor implementation */
     555        stree_proc_t *proc;
     556
     557        /** Type item describing the constructor */
     558        struct tdata_item *titem;
     559} stree_ctor_t;
     560
    463561/** Delegate declaration */
    464562typedef struct stree_deleg {
     
    476574} stree_deleg_t;
    477575
     576/** Enum member */
     577typedef struct stree_embr {
     578        /** Enum containing this declaration */
     579        struct stree_enum *outer_enum;
     580
     581        /** Enum member name */
     582        stree_ident_t *name;
     583} stree_embr_t;
     584
     585/** Enum declaration */
     586typedef struct stree_enum {
     587        /** Enum name */
     588        stree_ident_t *name;
     589
     590        /** Symbol */
     591        struct stree_symbol *symbol;
     592
     593        /** List of enum members */
     594        list_t members; /* of stree_embr_t */
     595
     596        /** Type item describing the enum */
     597        struct tdata_item *titem;
     598} stree_enum_t;
     599
    478600/** Member function declaration */
    479601typedef struct stree_fun {
     
    521643/**
    522644 * Fake identifiers used with symbols that do not really have one.
    523  * (Mostly for error messages.)
    524645 */
     646#define CTOR_IDENT "$ctor"
    525647#define INDEXER_IDENT "$indexer"
    526648
    527649typedef enum {
    528650        csimbr_csi,
     651        csimbr_ctor,
    529652        csimbr_deleg,
     653        csimbr_enum,
    530654        csimbr_fun,
    531655        csimbr_var,
     
    539663        union {
    540664                struct stree_csi *csi;
     665                stree_ctor_t *ctor;
    541666                stree_deleg_t *deleg;
     667                stree_enum_t *enum_d;
    542668                stree_fun_t *fun;
    543669                stree_var_t *var;
     
    587713typedef enum {
    588714        /* Class, struct or interface declaration */
    589         mc_csi
     715        mc_csi,
     716        /* Enum declaration */
     717        mc_enum
    590718} modm_class_t;
    591719
     
    595723        union {
    596724                stree_csi_t *csi;
     725                stree_enum_t *enum_d;
    597726        } u;
    598727} stree_modm_t;
     
    618747        /** CSI (class, struct or interface) */
    619748        sc_csi,
     749        /** Constructor */
     750        sc_ctor,
    620751        /** Member delegate */
    621752        sc_deleg,
     753        /** Enum */
     754        sc_enum,
    622755        /** Member function */
    623756        sc_fun,
     
    638771        union {
    639772                struct stree_csi *csi;
     773                stree_ctor_t *ctor;
    640774                stree_deleg_t *deleg;
     775                stree_enum_t *enum_d;
    641776                stree_fun_t *fun;
    642777                stree_var_t *var;
Note: See TracChangeset for help on using the changeset viewer.