diff options
| author | Graydon Hoare <[email protected]> | 2010-09-23 15:46:31 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-09-23 15:46:31 -0700 |
| commit | 46e46d0b49de8e245d091f7062dfc28ab71e869e (patch) | |
| tree | 5ca0d7ab10eb2a89b9c2a299ff3490eac912bf5d /src/comp/front/ast.rs | |
| parent | More fleshing-out on rustc.me.trans. Emitting modules and fns corresponding t... (diff) | |
| download | rust-46e46d0b49de8e245d091f7062dfc28ab71e869e.tar.xz rust-46e46d0b49de8e245d091f7062dfc28ab71e869e.zip | |
Translate a bunch of the material (lltrans, llasm, abi) from rustboot to rustc, and move files around.
Diffstat (limited to 'src/comp/front/ast.rs')
| -rw-r--r-- | src/comp/front/ast.rs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs new file mode 100644 index 00000000..327570d6 --- /dev/null +++ b/src/comp/front/ast.rs @@ -0,0 +1,83 @@ + +import std.util.option; +import std.map.hashmap; +import util.common.span; + +type ident = str; + +type crate = rec(_mod module); + +type block = vec[@stmt]; + +tag stmt { + stmt_block(block); + stmt_decl(@decl); + stmt_ret(option[@lval]); + stmt_log(@atom); +} + + +tag decl { + decl_local(ident, option[ty]); + decl_item(ident, @item); +} + +tag lval { + lval_ident(ident); + lval_ext(@lval, ident); + lval_idx(@lval, @atom); +} + +tag atom { + atom_lit(@lit); + atom_lval(@lval); +} + +tag lit { + lit_char(char); + lit_int(int); + lit_uint(uint); + lit_nil; + lit_bool(bool); +} + +tag ty { + ty_nil; + ty_bool; + ty_int; + ty_uint; + ty_machine(util.common.ty_mach); + ty_char; + ty_str; + ty_box(@ty); +} + +tag mode { + val; + 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]; + +tag item { + 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: +// |