aboutsummaryrefslogtreecommitdiff
path: root/src/comp/fe/ast.rs
blob: 3a329dede1c235cbba58979db653d0bdae21524a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import std.util.option;
import std.map.hashmap;

type ident = str;

type crate = rec( str filename,
                  _mod module);

type block = vec[stmt];

type stmt = tag( stmt_block(block),
                 stmt_decl(@decl),
                 stmt_ret(option[@lval]) );

type decl = tag( decl_local(ident, option[ty]),
                 decl_item(ident, @item) );

type lval = tag( lval_ident(ident),
                 lval_ext(@lval, ident),
                 lval_idx(@lval, @atom) );

type atom = tag( atom_lit(lit));

type lit = tag( lit_char(char),
                lit_int(int),
                lit_nil(),
                lit_bool(bool) );

type ty = tag( ty_nil(),
               ty_bool(),
               ty_int(),
               ty_char() );

type mode = tag( local(), alias() );

type slot = rec(ty ty, mode mode);

type _fn = rec(vec[rec(slot slot, ident ident)] inputs,
               slot output,
               block body);

type _mod = hashmap[ident,item];

type item = tag( item_fn(@_fn),
                 item_mod(@_mod) );


//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//