about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-02-29 11:46:23 -0800
committerGraydon Hoare <graydon@mozilla.com>2012-03-02 18:46:13 -0800
commit87c14f1e3d85751bffffda0b1920be5e726172c4 (patch)
tree371d86e9a7c65b06df5c8f5e6d499cf4730324fc /src/comp/syntax
parent9228947fe15af96593abf4745d91802b56c205e8 (diff)
downloadrust-87c14f1e3d85751bffffda0b1920be5e726172c4.tar.gz
rust-87c14f1e3d85751bffffda0b1920be5e726172c4.zip
Move src/comp to src/rustc
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/ast.rs553
-rw-r--r--src/comp/syntax/ast_util.rs443
-rw-r--r--src/comp/syntax/codemap.rs204
-rw-r--r--src/comp/syntax/ext/base.rs157
-rw-r--r--src/comp/syntax/ext/build.rs81
-rw-r--r--src/comp/syntax/ext/concat_idents.rs24
-rw-r--r--src/comp/syntax/ext/env.rs45
-rw-r--r--src/comp/syntax/ext/expand.rs102
-rw-r--r--src/comp/syntax/ext/fmt.rs300
-rw-r--r--src/comp/syntax/ext/ident_to_str.rs22
-rw-r--r--src/comp/syntax/ext/log_syntax.rs13
-rw-r--r--src/comp/syntax/ext/qquote.rs338
-rw-r--r--src/comp/syntax/ext/simplext.rs779
-rw-r--r--src/comp/syntax/fold.rs761
-rw-r--r--src/comp/syntax/parse/eval.rs150
-rw-r--r--src/comp/syntax/parse/lexer.rs748
-rw-r--r--src/comp/syntax/parse/parser.rs2747
-rw-r--r--src/comp/syntax/parse/token.rs199
-rw-r--r--src/comp/syntax/print/pp.rs526
-rw-r--r--src/comp/syntax/print/pprust.rs1793
-rw-r--r--src/comp/syntax/util/interner.rs39
-rw-r--r--src/comp/syntax/visit.rs546
22 files changed, 0 insertions, 10570 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
deleted file mode 100644
index eea47191eef..00000000000
--- a/src/comp/syntax/ast.rs
+++ /dev/null
@@ -1,553 +0,0 @@
-// The Rust abstract syntax tree.
-
-import codemap::{span, filename};
-
-type spanned<T> = {node: T, span: span};
-
-type ident = str;
-
-// Functions may or may not have names.
-type fn_ident = option<ident>;
-
-// FIXME: with typestate constraint, could say
-// idents and types are the same length, and are
-// non-empty
-type path_ = {global: bool, idents: [ident], types: [@ty]};
-
-type path = spanned<path_>;
-
-type crate_num = int;
-type node_id = int;
-type def_id = {crate: crate_num, node: node_id};
-
-const local_crate: crate_num = 0;
-const crate_node_id: node_id = 0;
-
-enum ty_param_bound {
-    bound_copy,
-    bound_send,
-    bound_iface(@ty),
-}
-
-type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]};
-
-enum def {
-    def_fn(def_id, purity),
-    def_self(node_id),
-    def_mod(def_id),
-    def_native_mod(def_id),
-    def_const(def_id),
-    def_arg(node_id, mode),
-    def_local(node_id, bool /* is_mutbl */),
-    def_variant(def_id /* enum */, def_id /* variant */),
-    def_ty(def_id),
-    def_prim_ty(prim_ty),
-    def_ty_param(def_id, uint),
-    def_binding(node_id),
-    def_use(def_id),
-    def_upvar(node_id /* local id of closed over var */,
-              @def    /* closed over def */,
-              node_id /* expr node that creates the closure */),
-    def_class(def_id),
-    // first def_id is for parent class
-    def_class_field(def_id, def_id),
-    // No purity allowed for now, I guess
-    // (simpler this way, b/c presumably methods read mutable state)
-    def_class_method(def_id, def_id)
-}
-
-// The set of meta_items that define the compilation environment of the crate,
-// used to drive conditional compilation
-type crate_cfg = [@meta_item];
-
-type crate = spanned<crate_>;
-
-type crate_ =
-    {directives: [@crate_directive],
-     module: _mod,
-     attrs: [attribute],
-     config: crate_cfg};
-
-enum crate_directive_ {
-    cdir_src_mod(ident, [attribute]),
-    cdir_dir_mod(ident, [@crate_directive], [attribute]),
-
-    // NB: cdir_view_item is *not* processed by the rest of the compiler, the
-    // attached view_items are sunk into the crate's module during parsing,
-    // and processed (resolved, imported, etc.) there. This enum-variant
-    // exists only to preserve the view items in order in case we decide to
-    // pretty-print crates in the future.
-    cdir_view_item(@view_item),
-
-    cdir_syntax(@path),
-}
-
-type crate_directive = spanned<crate_directive_>;
-
-type meta_item = spanned<meta_item_>;
-
-enum meta_item_ {
-    meta_word(ident),
-    meta_list(ident, [@meta_item]),
-    meta_name_value(ident, lit),
-}
-
-type blk = spanned<blk_>;
-
-type blk_ = {view_items: [@view_item], stmts: [@stmt], expr: option<@expr>,
-             id: node_id, rules: blk_check_mode};
-
-type pat = {id: node_id, node: pat_, span: span};
-
-type field_pat = {ident: ident, pat: @pat};
-
-enum pat_ {
-    pat_wild,
-    // A pat_ident may either be a new bound variable,
-    // or a nullary enum (in which case the second field
-    // is none).
-    // In the nullary enum case, the parser can't determine
-    // which it is. The resolver determines this, and
-    // records this pattern's node_id in an auxiliary
-    // set (of "pat_idents that refer to nullary enums")
-    pat_ident(@path, option<@pat>),
-    pat_enum(@path, [@pat]),
-    pat_rec([field_pat], bool),
-    pat_tup([@pat]),
-    pat_box(@pat),
-    pat_uniq(@pat),
-    pat_lit(@expr),
-    pat_range(@expr, @expr),
-}
-
-enum mutability { m_mutbl, m_imm, m_const, }
-
-enum proto {
-    proto_bare,    // native fn
-    proto_any,     // fn
-    proto_uniq,    // fn~
-    proto_box,     // fn@
-    proto_block,   // fn&
-}
-
-pure fn is_blockish(p: ast::proto) -> bool {
-    alt p {
-      proto_any | proto_block { true }
-      proto_bare | proto_uniq | proto_box { false }
-    }
-}
-
-enum binop {
-    add,
-    subtract,
-    mul,
-    div,
-    rem,
-    and,
-    or,
-    bitxor,
-    bitand,
-    bitor,
-    lsl,
-    lsr,
-    asr,
-    eq,
-    lt,
-    le,
-    ne,
-    ge,
-    gt,
-}
-
-enum unop {
-    box(mutability),
-    uniq(mutability),
-    deref, not, neg,
-}
-
-// Generally, after typeck you can get the inferred value
-// using ty::resolved_T(...).
-enum inferable<T> {
-    expl(T), infer(node_id)
-}
-
-// "resolved" mode: the real modes.
-enum rmode { by_ref, by_val, by_mutbl_ref, by_move, by_copy }
-
-// inferable mode.
-type mode = inferable<rmode>;
-
-type stmt = spanned<stmt_>;
-
-enum stmt_ {
-    stmt_decl(@decl, node_id),
-
-    // expr without trailing semi-colon (must have unit type):
-    stmt_expr(@expr, node_id),
-
-    // expr with trailing semi-colon (may have any type):
-    stmt_semi(@expr, node_id),
-}
-
-enum init_op { init_assign, init_move, }
-
-type initializer = {op: init_op, expr: @expr};
-
-type local_ =  // FIXME: should really be a refinement on pat
-    {is_mutbl: bool, ty: @ty, pat: @pat,
-     init: option<initializer>, id: node_id};
-
-type local = spanned<local_>;
-
-type decl = spanned<decl_>;
-
-enum decl_ { decl_local([@local]), decl_item(@item), }
-
-type arm = {pats: [@pat], guard: option<@expr>, body: blk};
-
-type field_ = {mutbl: mutability, ident: ident, expr: @expr};
-
-type field = spanned<field_>;
-
-enum blk_check_mode { default_blk, unchecked_blk, unsafe_blk, }
-
-enum expr_check_mode { claimed_expr, checked_expr, }
-
-type expr = {id: node_id, node: expr_, span: span};
-
-enum alt_mode { alt_check, alt_exhaustive, }
-
-enum expr_ {
-    expr_vec([@expr], mutability),
-    expr_rec([field], option<@expr>),
-    expr_call(@expr, [@expr], bool),
-    expr_tup([@expr]),
-    expr_bind(@expr, [option<@expr>]),
-    expr_binary(binop, @expr, @expr),
-    expr_unary(unop, @expr),
-    expr_lit(@lit),
-    expr_cast(@expr, @ty),
-    expr_if(@expr, blk, option<@expr>),
-    expr_while(@expr, blk),
-    expr_for(@local, @expr, blk),
-    expr_do_while(blk, @expr),
-    expr_alt(@expr, [arm], alt_mode),
-    expr_fn(proto, fn_decl, blk, @capture_clause),
-    expr_fn_block(fn_decl, blk),
-    expr_block(blk),
-
-    /*
-     * FIXME: many of these @exprs should be constrained with
-     * is_lval once we have constrained types working.
-     */
-    expr_copy(@expr),
-    expr_move(@expr, @expr),
-    expr_assign(@expr, @expr),
-    expr_swap(@expr, @expr),
-    expr_assign_op(binop, @expr, @expr),
-    expr_field(@expr, ident, [@ty]),
-    expr_index(@expr, @expr),
-    expr_path(@path),
-    expr_fail(option<@expr>),
-    expr_break,
-    expr_cont,
-    expr_ret(option<@expr>),
-    expr_be(@expr),
-    expr_log(int, @expr, @expr),
-
-    /* just an assert, no significance to typestate */
-    expr_assert(@expr),
-
-    /* preds that typestate is aware of */
-    expr_check(expr_check_mode, @expr),
-
-    /* FIXME Would be nice if expr_check desugared
-       to expr_if_check. */
-    expr_if_check(@expr, blk, option<@expr>),
-    expr_mac(mac),
-}
-
-type capture_item = {
-    id: int,
-    name: ident, // Currently, can only capture a local var.
-    span: span
-};
-type capture_clause = {
-    copies: [@capture_item],
-    moves: [@capture_item]
-};
-
-/*
-// Says whether this is a block the user marked as
-// "unchecked"
-enum blk_sort {
-    blk_unchecked, // declared as "exception to effect-checking rules"
-    blk_checked, // all typing rules apply
-}
-*/
-
-type mac = spanned<mac_>;
-
-type mac_arg = option::t<@expr>;
-
-type mac_body_ = {span: span};
-type mac_body = option::t<mac_body_>;
-
-enum mac_ {
-    mac_invoc(@path, mac_arg, mac_body),
-    mac_embed_type(@ty),
-    mac_embed_block(blk),
-    mac_ellipsis,
-    // the span is used by the quoter/anti-quoter ...
-    mac_aq(span /* span of quote */, @expr), // anti-quote
-    mac_var(uint)
-}
-
-type lit = spanned<lit_>;
-
-enum lit_ {
-    lit_str(str),
-    lit_int(i64, int_ty),
-    lit_uint(u64, uint_ty),
-    lit_float(str, float_ty),
-    lit_nil,
-    lit_bool(bool),
-}
-
-// NB: If you change this, you'll probably want to change the corresponding
-// type structure in middle/ty.rs as well.
-type mt = {ty: @ty, mutbl: mutability};
-
-type ty_field_ = {ident: ident, mt: mt};
-
-type ty_field = spanned<ty_field_>;
-
-type ty_method = {ident: ident, attrs: [attribute],
-                  decl: fn_decl, tps: [ty_param], span: span};
-
-enum int_ty { ty_i, ty_char, ty_i8, ty_i16, ty_i32, ty_i64, }
-
-enum uint_ty { ty_u, ty_u8, ty_u16, ty_u32, ty_u64, }
-
-enum float_ty { ty_f, ty_f32, ty_f64, }
-
-type ty = spanned<ty_>;
-
-// Not represented directly in the AST, referred to by name through a ty_path.
-enum prim_ty {
-    ty_int(int_ty),
-    ty_uint(uint_ty),
-    ty_float(float_ty),
-    ty_str,
-    ty_bool,
-}
-
-enum ty_ {
-    ty_nil,
-    ty_bot, /* bottom type */
-    ty_box(mt),
-    ty_uniq(mt),
-    ty_vec(mt),
-    ty_ptr(mt),
-    ty_rec([ty_field]),
-    ty_fn(proto, fn_decl),
-    ty_tup([@ty]),
-    ty_path(@path, node_id),
-    ty_constr(@ty, [@ty_constr]),
-    ty_mac(mac),
-    // ty_infer means the type should be inferred instead of it having been
-    // specified. This should only appear at the "top level" of a type and not
-    // nested in one.
-    ty_infer,
-}
-
-
-/*
-A constraint arg that's a function argument is referred to by its position
-rather than name.  This is so we could have higher-order functions that have
-constraints (potentially -- right now there's no way to write that), and also
-so that the typestate pass doesn't have to map a function name onto its decl.
-So, the constr_arg type is parameterized: it's instantiated with uint for
-declarations, and ident for uses.
-*/
-enum constr_arg_general_<T> { carg_base, carg_ident(T), carg_lit(@lit), }
-
-type fn_constr_arg = constr_arg_general_<uint>;
-type sp_constr_arg<T> = spanned<constr_arg_general_<T>>;
-type ty_constr_arg = sp_constr_arg<@path>;
-type constr_arg = spanned<fn_constr_arg>;
-
-// Constrained types' args are parameterized by paths, since
-// we refer to paths directly and not by indices.
-// The implicit root of such path, in the constraint-list for a
-// constrained type, is * (referring to the base record)
-
-type constr_general_<ARG, ID> =
-    {path: @path, args: [@spanned<constr_arg_general_<ARG>>], id: ID};
-
-// In the front end, constraints have a node ID attached.
-// Typeck turns this to a def_id, using the output of resolve.
-type constr_general<ARG> = spanned<constr_general_<ARG, node_id>>;
-type constr_ = constr_general_<uint, node_id>;
-type constr = spanned<constr_general_<uint, node_id>>;
-type ty_constr_ = constr_general_<@path, node_id>;
-type ty_constr = spanned<ty_constr_>;
-
-/* The parser generates ast::constrs; resolve generates
- a mapping from each function to a list of ty::constr_defs,
- corresponding to these. */
-type arg = {mode: mode, ty: @ty, ident: ident, id: node_id};
-
-type fn_decl =
-    {inputs: [arg],
-     output: @ty,
-     purity: purity,
-     cf: ret_style,
-     constraints: [@constr]};
-
-enum purity {
-    pure_fn, // declared with "pure fn"
-    unsafe_fn, // declared with "unsafe fn"
-    impure_fn, // declared with "fn"
-    crust_fn, // declared with "crust fn"
-}
-
-enum ret_style {
-    noreturn, // functions with return type _|_ that always
-              // raise an error or exit (i.e. never return to the caller)
-    return_val, // everything else
-}
-
-type method = {ident: ident, attrs: [attribute],
-               tps: [ty_param], decl: fn_decl, body: blk,
-               id: node_id, span: span};
-
-type _mod = {view_items: [@view_item], items: [@item]};
-
-enum native_abi {
-    native_abi_rust_intrinsic,
-    native_abi_cdecl,
-    native_abi_stdcall,
-}
-
-type native_mod =
-    {view_items: [@view_item],
-     items: [@native_item]};
-
-type variant_arg = {ty: @ty, id: node_id};
-
-type variant_ = {name: ident, attrs: [attribute], args: [variant_arg],
-                 id: node_id, disr_expr: option<@expr>};
-
-type variant = spanned<variant_>;
-
-
-// FIXME: May want to just use path here, which would allow things like
-// 'import ::foo'
-type simple_path = [ident];
-
-type path_list_ident_ = {name: ident, id: node_id};
-type path_list_ident = spanned<path_list_ident_>;
-
-type view_path = spanned<view_path_>;
-enum view_path_ {
-
-    // quux = foo::bar::baz
-    //
-    // or just
-    //
-    // foo::bar::baz  (with 'baz =' implicitly on the left)
-    view_path_simple(ident, @simple_path, node_id),
-
-    // foo::bar::*
-    view_path_glob(@simple_path, node_id),
-
-    // foo::bar::{a,b,c}
-    view_path_list(@simple_path, [path_list_ident], node_id)
-}
-
-type view_item = spanned<view_item_>;
-enum view_item_ {
-    view_item_use(ident, [@meta_item], node_id),
-    view_item_import([@view_path]),
-    view_item_export([@view_path])
-}
-
-// Meta-data associated with an item
-type attribute = spanned<attribute_>;
-
-
-// Distinguishes between attributes that decorate items and attributes that
-// are contained as statements within items. These two cases need to be
-// distinguished for pretty-printing.
-enum attr_style { attr_outer, attr_inner, }
-
-type attribute_ = {style: attr_style, value: meta_item};
-
-type item = {ident: ident, attrs: [attribute],
-             id: node_id, node: item_, span: span};
-
-enum item_ {
-    item_const(@ty, @expr),
-    item_fn(fn_decl, [ty_param], blk),
-    item_mod(_mod),
-    item_native_mod(native_mod),
-    item_ty(@ty, [ty_param]),
-    item_enum([variant], [ty_param]),
-    item_res(fn_decl /* dtor */, [ty_param], blk,
-             node_id /* dtor id */, node_id /* ctor id */),
-    item_class([ty_param], /* ty params for class */
-               [@class_item], /* methods, etc. */
-                             /* (not including ctor) */
-               node_id,  /* ctor id */
-               fn_decl, /* ctor decl */
-               blk /* ctor body */
-               ),
-    item_iface([ty_param], [ty_method]),
-    item_impl([ty_param], option<@ty> /* iface */,
-              @ty /* self */, [@method]),
-}
-
-type class_item_ = {privacy: privacy, decl: class_member};
-type class_item = spanned<class_item_>;
-
-enum class_member {
-    instance_var(ident, @ty, class_mutability, node_id),
-    class_method(@item) // FIXME: methods aren't allowed to be
-    // type-parametric.
-    // without constrained types, have to duplicate some stuff. or factor out
-    // item to separate out things with type params?
-}
-
-enum class_mutability { class_mutable, class_immutable }
-
-enum privacy { priv, pub }
-
-type native_item =
-    {ident: ident,
-     attrs: [attribute],
-     node: native_item_,
-     id: node_id,
-     span: span};
-
-enum native_item_ {
-    native_item_fn(fn_decl, [ty_param]),
-}
-
-// The data we save and restore about an inlined item or method.  This is not
-// part of the AST that we parse from a file, but it becomes part of the tree
-// that we trans.
-enum inlined_item {
-    ii_item(@item),
-    ii_method(def_id /* impl id */, @method)
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs
deleted file mode 100644
index 04bd4236c9b..00000000000
--- a/src/comp/syntax/ast_util.rs
+++ /dev/null
@@ -1,443 +0,0 @@
-import codemap::span;
-import ast::*;
-
-fn respan<T: copy>(sp: span, t: T) -> spanned<T> {
-    ret {node: t, span: sp};
-}
-
-/* assuming that we're not in macro expansion */
-fn mk_sp(lo: uint, hi: uint) -> span {
-    ret {lo: lo, hi: hi, expn_info: none};
-}
-
-// make this a const, once the compiler supports it
-fn dummy_sp() -> span { ret mk_sp(0u, 0u); }
-
-fn path_name(p: @path) -> str { path_name_i(p.node.idents) }
-
-fn path_name_i(idents: [ident]) -> str { str::connect(idents, "::") }
-
-fn local_def(id: node_id) -> def_id { ret {crate: local_crate, node: id}; }
-
-fn stmt_id(s: stmt) -> node_id {
-    alt s.node {
-      stmt_decl(_, id) { id }
-      stmt_expr(_, id) { id }
-      stmt_semi(_, id) { id }
-    }
-}
-
-fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
-    alt d { def_variant(enum_id, var_id) {
-            ret {enm: enum_id, var: var_id}; }
-        _ { fail "non-variant in variant_def_ids"; } }
-}
-
-fn def_id_of_def(d: def) -> def_id {
-    alt d {
-      def_fn(id, _) | def_mod(id) |
-      def_native_mod(id) | def_const(id) |
-      def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
-      def_use(id) |
-      def_class(id) | def_class_field(_, id) | def_class_method(_, id) { id }
-
-      def_self(id) | def_arg(id, _) | def_local(id, _) |
-      def_upvar(id, _, _) | def_binding(id) {
-        local_def(id)
-      }
-
-      def_prim_ty(_) { fail; }
-    }
-}
-
-fn binop_to_str(op: binop) -> str {
-    alt op {
-      add { ret "+"; }
-      subtract { ret "-"; }
-      mul { ret "*"; }
-      div { ret "/"; }
-      rem { ret "%"; }
-      and { ret "&&"; }
-      or { ret "||"; }
-      bitxor { ret "^"; }
-      bitand { ret "&"; }
-      bitor { ret "|"; }
-      lsl { ret "<<"; }
-      lsr { ret ">>"; }
-      asr { ret ">>>"; }
-      eq { ret "=="; }
-      lt { ret "<"; }
-      le { ret "<="; }
-      ne { ret "!="; }
-      ge { ret ">="; }
-      gt { ret ">"; }
-    }
-}
-
-pure fn lazy_binop(b: binop) -> bool {
-    alt b { and { true } or { true } _ { false } }
-}
-
-pure fn is_shift_binop(b: binop) -> bool {
-    alt b {
-      lsl { true }
-      lsr { true }
-      asr { true }
-      _ { false }
-    }
-}
-
-fn unop_to_str(op: unop) -> str {
-    alt op {
-      box(mt) { if mt == m_mutbl { ret "@mut "; } ret "@"; }
-      uniq(mt) { if mt == m_mutbl { ret "~mut "; } ret "~"; }
-      deref { ret "*"; }
-      not { ret "!"; }
-      neg { ret "-"; }
-    }
-}
-
-fn is_path(e: @expr) -> bool {
-    ret alt e.node { expr_path(_) { true } _ { false } };
-}
-
-fn int_ty_to_str(t: int_ty) -> str {
-    alt t {
-      ty_char { "u8" } // ???
-      ty_i { "" } ty_i8 { "i8" } ty_i16 { "i16" }
-      ty_i32 { "i32" } ty_i64 { "i64" }
-    }
-}
-
-fn int_ty_max(t: int_ty) -> u64 {
-    alt t {
-      ty_i8 { 0x80u64 }
-      ty_i16 { 0x800u64 }
-      ty_i | ty_char | ty_i32 { 0x80000000u64 } // actually ni about ty_i
-      ty_i64 { 0x8000000000000000u64 }
-    }
-}
-
-fn uint_ty_to_str(t: uint_ty) -> str {
-    alt t {
-      ty_u { "u" } ty_u8 { "u8" } ty_u16 { "u16" }
-      ty_u32 { "u32" } ty_u64 { "u64" }
-    }
-}
-
-fn uint_ty_max(t: uint_ty) -> u64 {
-    alt t {
-      ty_u8 { 0xffu64 }
-      ty_u16 { 0xffffu64 }
-      ty_u | ty_u32 { 0xffffffffu64 } // actually ni about ty_u
-      ty_u64 { 0xffffffffffffffffu64 }
-    }
-}
-
-fn float_ty_to_str(t: float_ty) -> str {
-    alt t { ty_f { "" } ty_f32 { "f32" } ty_f64 { "f64" } }
-}
-
-fn is_exported(i: ident, m: _mod) -> bool {
-    let local = false;
-    let parent_enum : option<ident> = none;
-    for it: @item in m.items {
-        if it.ident == i { local = true; }
-        alt it.node {
-          item_enum(variants, _) {
-            for v: variant in variants {
-                if v.node.name == i {
-                   local = true;
-                   parent_enum = some(it.ident);
-                }
-            }
-          }
-          _ { }
-        }
-        if local { break; }
-    }
-    let has_explicit_exports = false;
-    for vi: @view_item in m.view_items {
-        alt vi.node {
-          view_item_export(vps) {
-            has_explicit_exports = true;
-            for vp in vps {
-                alt vp.node {
-                  ast::view_path_simple(id, _, _) {
-                    if id == i { ret true; }
-                    alt parent_enum {
-                      some(parent_enum_id) {
-                        if id == parent_enum_id { ret true; }
-                      }
-                      _ {}
-                    }
-                  }
-
-                  ast::view_path_list(path, ids, _) {
-                    if vec::len(*path) == 1u {
-                        if i == path[0] { ret true; }
-                        for id in ids {
-                            if id.node.name == i { ret true; }
-                        }
-                    } else {
-                        fail "export of path-qualified list";
-                    }
-                  }
-
-                  // FIXME: glob-exports aren't supported yet.
-                  _ {}
-                }
-            }
-          }
-          _ {}
-        }
-    }
-    // If there are no declared exports then
-    // everything not imported is exported
-    // even if it's local (since it's explicit)
-    ret !has_explicit_exports && local;
-}
-
-pure fn is_call_expr(e: @expr) -> bool {
-    alt e.node { expr_call(_, _, _) { true } _ { false } }
-}
-
-fn is_constraint_arg(e: @expr) -> bool {
-    alt e.node {
-      expr_lit(_) { ret true; }
-      expr_path(_) { ret true; }
-      _ { ret false; }
-    }
-}
-
-fn eq_ty(&&a: @ty, &&b: @ty) -> bool { ret box::ptr_eq(a, b); }
-
-fn hash_ty(&&t: @ty) -> uint {
-    let res = (t.span.lo << 16u) + t.span.hi;
-    ret res;
-}
-
-fn hash_def_id(&&id: def_id) -> uint {
-    (id.crate as uint << 16u) + (id.node as uint)
-}
-
-fn eq_def_id(&&a: def_id, &&b: def_id) -> bool {
-    a == b
-}
-
-fn new_def_id_hash<T: copy>() -> std::map::hashmap<def_id, T> {
-    std::map::mk_hashmap(hash_def_id, eq_def_id)
-}
-
-fn block_from_expr(e: @expr) -> blk {
-    let blk_ = default_block([], option::some::<@expr>(e), e.id);
-    ret {node: blk_, span: e.span};
-}
-
-fn default_block(stmts1: [@stmt], expr1: option<@expr>, id1: node_id) ->
-   blk_ {
-    {view_items: [], stmts: stmts1, expr: expr1, id: id1, rules: default_blk}
-}
-
-// FIXME this doesn't handle big integer/float literals correctly (nor does
-// the rest of our literal handling)
-enum const_val {
-    const_float(float),
-    const_int(i64),
-    const_uint(u64),
-    const_str(str),
-}
-
-// FIXME: issue #1417
-fn eval_const_expr(e: @expr) -> const_val {
-    fn fromb(b: bool) -> const_val { const_int(b as i64) }
-    alt e.node {
-      expr_unary(neg, inner) {
-        alt eval_const_expr(inner) {
-          const_float(f) { const_float(-f) }
-          const_int(i) { const_int(-i) }
-          const_uint(i) { const_uint(-i) }
-          _ { fail "eval_const_expr: bad neg argument"; }
-        }
-      }
-      expr_unary(not, inner) {
-        alt eval_const_expr(inner) {
-          const_int(i) { const_int(!i) }
-          const_uint(i) { const_uint(!i) }
-          _ { fail "eval_const_expr: bad not argument"; }
-        }
-      }
-      expr_binary(op, a, b) {
-        alt (eval_const_expr(a), eval_const_expr(b)) {
-          (const_float(a), const_float(b)) {
-            alt op {
-              add { const_float(a + b) } subtract { const_float(a - b) }
-              mul { const_float(a * b) } div { const_float(a / b) }
-              rem { const_float(a % b) } eq { fromb(a == b) }
-              lt { fromb(a < b) } le { fromb(a <= b) } ne { fromb(a != b) }
-              ge { fromb(a >= b) } gt { fromb(a > b) }
-              _ { fail "eval_const_expr: can't apply this binop to floats"; }
-            }
-          }
-          (const_int(a), const_int(b)) {
-            alt op {
-              add { const_int(a + b) } subtract { const_int(a - b) }
-              mul { const_int(a * b) } div { const_int(a / b) }
-              rem { const_int(a % b) } and | bitand { const_int(a & b) }
-              or | bitor { const_int(a | b) } bitxor { const_int(a ^ b) }
-              lsl { const_int(a << b) } lsr { const_int(a >> b) }
-              asr { const_int(a >>> b) }
-              eq { fromb(a == b) } lt { fromb(a < b) }
-              le { fromb(a <= b) } ne { fromb(a != b) }
-              ge { fromb(a >= b) } gt { fromb(a > b) }
-              _ { fail "eval_const_expr: can't apply this binop to ints"; }
-            }
-          }
-          (const_uint(a), const_uint(b)) {
-            alt op {
-              add { const_uint(a + b) } subtract { const_uint(a - b) }
-              mul { const_uint(a * b) } div { const_uint(a / b) }
-              rem { const_uint(a % b) } and | bitand { const_uint(a & b) }
-              or | bitor { const_uint(a | b) } bitxor { const_uint(a ^ b) }
-              lsl { const_int((a << b) as i64) }
-              lsr { const_int((a >> b) as i64) }
-              asr { const_int((a >>> b) as i64) }
-              eq { fromb(a == b) } lt { fromb(a < b) }
-              le { fromb(a <= b) } ne { fromb(a != b) }
-              ge { fromb(a >= b) } gt { fromb(a > b) }
-              _ { fail "eval_const_expr: can't apply this binop to uints"; }
-            }
-          }
-          _ { fail "eval_constr_expr: bad binary arguments"; }
-        }
-      }
-      expr_lit(lit) { lit_to_const(lit) }
-      // Precondition?
-      _ {
-          fail "eval_const_expr: non-constant expression";
-      }
-    }
-}
-
-fn lit_to_const(lit: @lit) -> const_val {
-    alt lit.node {
-      lit_str(s) { const_str(s) }
-      lit_int(n, _) { const_int(n) }
-      lit_uint(n, _) { const_uint(n) }
-      lit_float(n, _) { const_float(option::get(float::from_str(n))) }
-      lit_nil { const_int(0i64) }
-      lit_bool(b) { const_int(b as i64) }
-    }
-}
-
-fn compare_const_vals(a: const_val, b: const_val) -> int {
-  alt (a, b) {
-    (const_int(a), const_int(b)) {
-        if a == b {
-            0
-        } else if a < b {
-            -1
-        } else {
-            1
-        }
-    }
-    (const_uint(a), const_uint(b)) {
-        if a == b {
-            0
-        } else if a < b {
-            -1
-        } else {
-            1
-        }
-    }
-    (const_float(a), const_float(b)) {
-        if a == b {
-            0
-        } else if a < b {
-            -1
-        } else {
-            1
-        }
-    }
-    (const_str(a), const_str(b)) {
-        if a == b {
-            0
-        } else if a < b {
-            -1
-        } else {
-            1
-        }
-    }
-    _ {
-        fail "compare_const_vals: ill-typed comparison";
-    }
-  }
-}
-
-fn compare_lit_exprs(a: @expr, b: @expr) -> int {
-  compare_const_vals(eval_const_expr(a), eval_const_expr(b))
-}
-
-fn lit_expr_eq(a: @expr, b: @expr) -> bool { compare_lit_exprs(a, b) == 0 }
-
-fn lit_eq(a: @lit, b: @lit) -> bool {
-    compare_const_vals(lit_to_const(a), lit_to_const(b)) == 0
-}
-
-fn ident_to_path(s: span, i: ident) -> @path {
-    @respan(s, {global: false, idents: [i], types: []})
-}
-
-pure fn is_unguarded(&&a: arm) -> bool {
-    alt a.guard {
-      none { true }
-      _    { false }
-    }
-}
-
-pure fn unguarded_pat(a: arm) -> option<[@pat]> {
-    if is_unguarded(a) { some(a.pats) } else { none }
-}
-
-// Provides an extra node_id to hang callee information on, in case the
-// operator is deferred to a user-supplied method. The parser is responsible
-// for reserving this id.
-fn op_expr_callee_id(e: @expr) -> node_id { e.id - 1 }
-
-pure fn class_item_ident(ci: @class_item) -> ident {
-    alt ci.node.decl {
-      instance_var(i,_,_,_) { i }
-      class_method(it) { it.ident }
-    }
-}
-
-impl inlined_item_methods for inlined_item {
-    fn ident() -> ident {
-        alt self {
-          ii_item(i) { i.ident }
-          ii_method(_, m) { m.ident }
-        }
-    }
-
-    fn id() -> ast::node_id {
-        alt self {
-          ii_item(i) { i.id }
-          ii_method(_, m) { m.id }
-        }
-    }
-
-    fn accept<E>(e: E, v: visit::vt<E>) {
-        alt self {
-          ii_item(i) { v.visit_item(i, e, v) }
-          ii_method(_, m) { visit::visit_method_helper(m, e, v) }
-        }
-    }
-}
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
deleted file mode 100644
index a7dbe574717..00000000000
--- a/src/comp/syntax/codemap.rs
+++ /dev/null
@@ -1,204 +0,0 @@
-type filename = str;
-
-type file_pos = {ch: uint, byte: uint};
-
-/* A codemap is a thing that maps uints to file/line/column positions
- * in a crate. This to make it possible to represent the positions
- * with single-word things, rather than passing records all over the
- * compiler.
- */
-
-enum file_substr {
-    fss_none,
-    fss_internal(span),
-    fss_external({filename: str, line: uint, col: uint})
-}
-
-type filemap =
-    @{name: filename, substr: file_substr, src: @str,
-      start_pos: file_pos, mutable lines: [file_pos]};
-
-type codemap = @{mutable files: [filemap]};
-
-type loc = {file: filemap, line: uint, col: uint};
-
-fn new_codemap() -> codemap { @{mutable files: [] } }
-
-fn new_filemap_w_substr(filename: filename, substr: file_substr,
-                        src: @str,
-                        start_pos_ch: uint, start_pos_byte: uint)
-   -> filemap {
-    ret @{name: filename, substr: substr, src: src,
-          start_pos: {ch: start_pos_ch, byte: start_pos_byte},
-          mutable lines: [{ch: start_pos_ch, byte: start_pos_byte}]};
-}
-
-fn new_filemap(filename: filename, src: @str,
-               start_pos_ch: uint, start_pos_byte: uint)
-    -> filemap {
-    ret new_filemap_w_substr(filename, fss_none, src,
-                             start_pos_ch, start_pos_byte);
-}
-
-fn mk_substr_filename(cm: codemap, sp: span) -> str
-{
-    let pos = lookup_char_pos(cm, sp.lo);
-    ret #fmt("<%s:%u:%u>", pos.file.name, pos.line, pos.col);
-}
-
-fn next_line(file: filemap, chpos: uint, byte_pos: uint) {
-    file.lines += [{ch: chpos, byte: byte_pos}];
-}
-
-type lookup_fn = fn@(file_pos) -> uint;
-
-fn lookup_line(map: codemap, pos: uint, lookup: lookup_fn)
-    -> {fm: filemap, line: uint}
-{
-    let len = vec::len(map.files);
-    let a = 0u;
-    let b = len;
-    while b - a > 1u {
-        let m = (a + b) / 2u;
-        if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
-    }
-    if (a >= len) {
-        fail #fmt("position %u does not resolve to a source location", pos)
-    }
-    let f = map.files[a];
-    a = 0u;
-    b = vec::len(f.lines);
-    while b - a > 1u {
-        let m = (a + b) / 2u;
-        if lookup(f.lines[m]) > pos { b = m; } else { a = m; }
-    }
-    ret {fm: f, line: a};
-}
-
-fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
-    let {fm: f, line: a} = lookup_line(map, pos, lookup);
-    ret {file: f, line: a + 1u, col: pos - lookup(f.lines[a])};
-}
-
-fn lookup_char_pos(map: codemap, pos: uint) -> loc {
-    fn lookup(pos: file_pos) -> uint { ret pos.ch; }
-    ret lookup_pos(map, pos, lookup);
-}
-
-fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
-    fn lookup(pos: file_pos) -> uint { ret pos.byte; }
-    ret lookup_pos(map, pos, lookup);
-}
-
-fn lookup_char_pos_adj(map: codemap, pos: uint)
-    -> {filename: str, line: uint, col: uint, file: option<filemap>}
-{
-    let loc = lookup_char_pos(map, pos);
-    alt (loc.file.substr) {
-      fss_none {
-        {filename: loc.file.name, line: loc.line, col: loc.col,
-         file: some(loc.file)}
-      }
-      fss_internal(sp) {
-        lookup_char_pos_adj(map, sp.lo + (pos - loc.file.start_pos.ch))
-      }
-      fss_external(eloc) {
-        {filename: eloc.filename,
-         line: eloc.line + loc.line - 1u,
-         col: if loc.line == 1u {eloc.col + loc.col} else {loc.col},
-         file: none}
-      }
-    }
-}
-
-fn adjust_span(map: codemap, sp: span) -> span {
-    fn lookup(pos: file_pos) -> uint { ret pos.ch; }
-    let line = lookup_line(map, sp.lo, lookup);
-    alt (line.fm.substr) {
-      fss_none {sp}
-      fss_internal(s) {
-        adjust_span(map, {lo: s.lo + (sp.lo - line.fm.start_pos.ch),
-                          hi: s.lo + (sp.hi - line.fm.start_pos.ch),
-                          expn_info: sp.expn_info})}
-      fss_external(_) {sp}
-    }
-}
-
-enum expn_info_ {
-    expanded_from({call_site: span,
-                   callie: {name: str, span: option<span>}})
-}
-type expn_info = option<@expn_info_>;
-type span = {lo: uint, hi: uint, expn_info: expn_info};
-
-fn span_to_str_no_adj(sp: span, cm: codemap) -> str {
-    let lo = lookup_char_pos(cm, sp.lo);
-    let hi = lookup_char_pos(cm, sp.hi);
-    ret #fmt("%s:%u:%u: %u:%u", lo.file.name,
-             lo.line, lo.col, hi.line, hi.col)
-}
-
-fn span_to_str(sp: span, cm: codemap) -> str {
-    let lo = lookup_char_pos_adj(cm, sp.lo);
-    let hi = lookup_char_pos_adj(cm, sp.hi);
-    ret #fmt("%s:%u:%u: %u:%u", lo.filename,
-             lo.line, lo.col, hi.line, hi.col)
-}
-
-type file_lines = {file: filemap, lines: [uint]};
-
-fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
-    let lo = lookup_char_pos(cm, sp.lo);
-    let hi = lookup_char_pos(cm, sp.hi);
-    let lines = [];
-    uint::range(lo.line - 1u, hi.line as uint) {|i| lines += [i]; };
-    ret @{file: lo.file, lines: lines};
-}
-
-fn get_line(fm: filemap, line: int) -> str unsafe {
-    let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
-    let end = alt str::find_char_from(*fm.src, '\n', begin) {
-      some(e) { e }
-      none { str::len(*fm.src) }
-    };
-    str::slice(*fm.src, begin, end)
-}
-
-fn lookup_byte_offset(cm: codemap::codemap, chpos: uint)
-    -> {fm: filemap, pos: uint} {
-    let {fm, line} = lookup_line(cm, chpos, {|pos| pos.ch});
-    let line_offset = fm.lines[line].byte - fm.start_pos.byte;
-    let col = chpos - fm.lines[line].ch;
-    let col_offset = str::count_bytes(*fm.src, line_offset, col);
-    {fm: fm, pos: line_offset + col_offset}
-}
-
-fn span_to_snippet(sp: span, cm: codemap::codemap) -> str {
-    let begin = lookup_byte_offset(cm, sp.lo);
-    let end = lookup_byte_offset(cm, sp.hi);
-    assert begin.fm == end.fm;
-    ret str::slice(*begin.fm.src, begin.pos, end.pos);
-}
-
-fn get_snippet(cm: codemap::codemap, fidx: uint, lo: uint, hi: uint) -> str
-{
-    let fm = cm.files[fidx];
-    ret str::slice(*fm.src, lo, hi)
-}
-
-fn get_filemap(cm: codemap, filename: str) -> filemap {
-    for fm: filemap in cm.files { if fm.name == filename { ret fm; } }
-    //XXjdm the following triggers a mismatched type bug
-    //      (or expected function, found _|_)
-    fail; // ("asking for " + filename + " which we don't know about");
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs
deleted file mode 100644
index d59591d849a..00000000000
--- a/src/comp/syntax/ext/base.rs
+++ /dev/null
@@ -1,157 +0,0 @@
-import std::map::hashmap;
-import driver::session::session;
-import codemap::{span, expn_info, expanded_from};
-import std::map::new_str_hash;
-
-type syntax_expander_ =
-    fn@(ext_ctxt, span, ast::mac_arg, ast::mac_body) -> @ast::expr;
-type syntax_expander = {
-    expander: syntax_expander_,
-    span: option<span>};
-type macro_def = {ident: str, ext: syntax_extension};
-type macro_definer =
-    fn@(ext_ctxt, span, ast::mac_arg, ast::mac_body) -> macro_def;
-
-enum syntax_extension {
-    normal(syntax_expander),
-    macro_defining(macro_definer),
-}
-
-// A temporary hard-coded map of methods for expanding syntax extension
-// AST nodes into full ASTs
-fn syntax_expander_table() -> hashmap<str, syntax_extension> {
-    fn builtin(f: syntax_expander_) -> syntax_extension
-        {normal({expander: f, span: none})}
-    let syntax_expanders = new_str_hash::<syntax_extension>();
-    syntax_expanders.insert("fmt", builtin(ext::fmt::expand_syntax_ext));
-    syntax_expanders.insert("env", builtin(ext::env::expand_syntax_ext));
-    syntax_expanders.insert("macro",
-                            macro_defining(ext::simplext::add_new_extension));
-    syntax_expanders.insert("concat_idents",
-                            builtin(ext::concat_idents::expand_syntax_ext));
-    syntax_expanders.insert("ident_to_str",
-                            builtin(ext::ident_to_str::expand_syntax_ext));
-    syntax_expanders.insert("log_syntax",
-                            builtin(ext::log_syntax::expand_syntax_ext));
-    syntax_expanders.insert("ast",
-                            builtin(ext::qquote::expand_ast));
-    ret syntax_expanders;
-}
-
-iface ext_ctxt {
-    fn session() -> session;
-    fn print_backtrace();
-    fn backtrace() -> expn_info;
-    fn bt_push(ei: codemap::expn_info_);
-    fn bt_pop();
-    fn span_fatal(sp: span, msg: str) -> !;
-    fn span_err(sp: span, msg: str);
-    fn span_unimpl(sp: span, msg: str) -> !;
-    fn span_bug(sp: span, msg: str) -> !;
-    fn bug(msg: str) -> !;
-    fn next_id() -> ast::node_id;
-}
-
-fn mk_ctxt(sess: session) -> ext_ctxt {
-    type ctxt_repr = {sess: session,
-                      mutable backtrace: expn_info};
-    impl of ext_ctxt for ctxt_repr {
-        fn session() -> session { self.sess }
-        fn print_backtrace() { }
-        fn backtrace() -> expn_info { self.backtrace }
-        fn bt_push(ei: codemap::expn_info_) {
-            alt ei {
-              expanded_from({call_site: cs, callie: callie}) {
-                self.backtrace =
-                    some(@expanded_from({
-                        call_site: {lo: cs.lo, hi: cs.hi,
-                                    expn_info: self.backtrace},
-                        callie: callie}));
-              }
-            }
-        }
-        fn bt_pop() {
-            alt self.backtrace {
-              some(@expanded_from({call_site: {expn_info: prev, _}, _})) {
-                self.backtrace = prev
-              }
-              _ { self.bug("tried to pop without a push"); }
-            }
-        }
-        fn span_fatal(sp: span, msg: str) -> ! {
-            self.print_backtrace();
-            self.sess.span_fatal(sp, msg);
-        }
-        fn span_err(sp: span, msg: str) {
-            self.print_backtrace();
-            self.sess.span_err(sp, msg);
-        }
-        fn span_unimpl(sp: span, msg: str) -> ! {
-            self.print_backtrace();
-            self.sess.span_unimpl(sp, msg);
-        }
-        fn span_bug(sp: span, msg: str) -> ! {
-            self.print_backtrace();
-            self.sess.span_bug(sp, msg);
-        }
-        fn bug(msg: str) -> ! { self.print_backtrace(); self.sess.bug(msg); }
-        fn next_id() -> ast::node_id { ret self.sess.next_node_id(); }
-    }
-    let imp : ctxt_repr = {sess: sess, mutable backtrace: none};
-    ret imp as ext_ctxt
-}
-
-fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, error: str) -> str {
-    alt expr.node {
-      ast::expr_lit(l) {
-        alt l.node {
-          ast::lit_str(s) { ret s; }
-          _ { cx.span_fatal(l.span, error); }
-        }
-      }
-      _ { cx.span_fatal(expr.span, error); }
-    }
-}
-
-fn expr_to_ident(cx: ext_ctxt, expr: @ast::expr, error: str) -> ast::ident {
-    alt expr.node {
-      ast::expr_path(p) {
-        if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
-            cx.span_fatal(expr.span, error);
-        } else { ret p.node.idents[0]; }
-      }
-      _ { cx.span_fatal(expr.span, error); }
-    }
-}
-
-fn make_new_lit(cx: ext_ctxt, sp: codemap::span, lit: ast::lit_) ->
-   @ast::expr {
-    let sp_lit = @{node: lit, span: sp};
-    ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp};
-}
-
-fn get_mac_arg(cx: ext_ctxt, sp: span, arg: ast::mac_arg) -> @ast::expr {
-    alt (arg) {
-      some(expr) {expr}
-      none {cx.span_fatal(sp, "missing macro args")}
-    }
-}
-
-fn get_mac_body(cx: ext_ctxt, sp: span, args: ast::mac_body)
-    -> ast::mac_body_
-{
-    alt (args) {
-      some(body) {body}
-      none {cx.span_fatal(sp, "missing macro body")}
-    }
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/ext/build.rs b/src/comp/syntax/ext/build.rs
deleted file mode 100644
index 5d615c4305d..00000000000
--- a/src/comp/syntax/ext/build.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-import codemap::span;
-import syntax::ext::base::ext_ctxt;
-
-// NOTE: Moved from fmt.rs which had this fixme:
-// FIXME: Cleanup the naming of these functions
-
-fn mk_lit(cx: ext_ctxt, sp: span, lit: ast::lit_) -> @ast::expr {
-    let sp_lit = @{node: lit, span: sp};
-    ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp};
-}
-fn mk_str(cx: ext_ctxt, sp: span, s: str) -> @ast::expr {
-    let lit = ast::lit_str(s);
-    ret mk_lit(cx, sp, lit);
-}
-fn mk_int(cx: ext_ctxt, sp: span, i: int) -> @ast::expr {
-    let lit = ast::lit_int(i as i64, ast::ty_i);
-    ret mk_lit(cx, sp, lit);
-}
-fn mk_uint(cx: ext_ctxt, sp: span, u: uint) -> @ast::expr {
-    let lit = ast::lit_uint(u as u64, ast::ty_u);
-    ret mk_lit(cx, sp, lit);
-}
-fn mk_binary(cx: ext_ctxt, sp: span, op: ast::binop,
-             lhs: @ast::expr, rhs: @ast::expr)
-   -> @ast::expr {
-    let binexpr = ast::expr_binary(op, lhs, rhs);
-    ret @{id: cx.next_id(), node: binexpr, span: sp};
-}
-fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
-    -> @ast::expr {
-    let expr = ast::expr_unary(op, e);
-    ret @{id: cx.next_id(), node: expr, span: sp};
-}
-fn mk_path(cx: ext_ctxt, sp: span, idents: [ast::ident]) ->
-    @ast::expr {
-    let path = {global: false, idents: idents, types: []};
-    let sp_path = @{node: path, span: sp};
-    let pathexpr = ast::expr_path(sp_path);
-    ret @{id: cx.next_id(), node: pathexpr, span: sp};
-}
-fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
-    -> @ast::expr {
-    let expr = ast::expr_field(p, m, []);
-    ret @{id: cx.next_id(), node: expr, span: sp};
-}
-fn mk_access(cx: ext_ctxt, sp: span, p: [ast::ident], m: ast::ident)
-    -> @ast::expr {
-    let pathexpr = mk_path(cx, sp, p);
-    ret mk_access_(cx, sp, pathexpr, m);
-}
-fn mk_call_(cx: ext_ctxt, sp: span, fn_expr: @ast::expr,
-            args: [@ast::expr]) -> @ast::expr {
-    let callexpr = ast::expr_call(fn_expr, args, false);
-    ret @{id: cx.next_id(), node: callexpr, span: sp};
-}
-fn mk_call(cx: ext_ctxt, sp: span, fn_path: [ast::ident],
-             args: [@ast::expr]) -> @ast::expr {
-    let pathexpr = mk_path(cx, sp, fn_path);
-    ret mk_call_(cx, sp, pathexpr, args);
-}
-// e = expr, t = type
-fn mk_vec_e(cx: ext_ctxt, sp: span, exprs: [@ast::expr]) ->
-   @ast::expr {
-    let vecexpr = ast::expr_vec(exprs, ast::m_imm);
-    ret @{id: cx.next_id(), node: vecexpr, span: sp};
-}
-fn mk_rec_e(cx: ext_ctxt, sp: span,
-            fields: [{ident: ast::ident, ex: @ast::expr}]) ->
-    @ast::expr {
-    let astfields: [ast::field] = [];
-    for field: {ident: ast::ident, ex: @ast::expr} in fields {
-        let ident = field.ident;
-        let val = field.ex;
-        let astfield =
-            {node: {mutbl: ast::m_imm, ident: ident, expr: val}, span: sp};
-        astfields += [astfield];
-    }
-    let recexpr = ast::expr_rec(astfields, option::none::<@ast::expr>);
-    ret @{id: cx.next_id(), node: recexpr, span: sp};
-}
-
diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs
deleted file mode 100644
index 4b9402f9cd9..00000000000
--- a/src/comp/syntax/ext/concat_idents.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-import base::*;
-import syntax::ast;
-
-fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> @ast::expr {
-    let arg = get_mac_arg(cx,sp,arg);
-    let args: [@ast::expr] =
-        alt arg.node {
-          ast::expr_vec(elts, _) { elts }
-          _ {
-            cx.span_fatal(sp, "#concat_idents requires a vector argument .")
-          }
-        };
-    let res: ast::ident = "";
-    for e: @ast::expr in args {
-        res += expr_to_ident(cx, e, "expected an ident");
-    }
-
-    ret @{id: cx.next_id(),
-          node: ast::expr_path(@{node: {global: false, idents: [res],
-                                        types: []},
-                                 span: sp}),
-          span: sp};
-}
diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs
deleted file mode 100644
index cb9453ae062..00000000000
--- a/src/comp/syntax/ext/env.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-
-/*
- * The compiler code necessary to support the #env extension.  Eventually this
- * should all get sucked into either the compiler syntax extension plugin
- * interface.
- */
-import std::generic_os;
-import base::*;
-export expand_syntax_ext;
-
-fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> @ast::expr {
-    let arg = get_mac_arg(cx,sp,arg);
-    let args: [@ast::expr] =
-        alt arg.node {
-          ast::expr_vec(elts, _) { elts }
-          _ {
-            cx.span_fatal(sp, "#env requires arguments of the form `[...]`.")
-          }
-        };
-    if vec::len::<@ast::expr>(args) != 1u {
-        cx.span_fatal(sp, "malformed #env call");
-    }
-    // FIXME: if this was more thorough it would manufacture an
-    // option<str> rather than just an maybe-empty string.
-
-    let var = expr_to_str(cx, args[0], "#env requires a string");
-    alt generic_os::getenv(var) {
-      option::none { ret make_new_str(cx, sp, ""); }
-      option::some(s) { ret make_new_str(cx, sp, s); }
-    }
-}
-
-fn make_new_str(cx: ext_ctxt, sp: codemap::span, s: str) -> @ast::expr {
-    ret make_new_lit(cx, sp, ast::lit_str(s));
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs
deleted file mode 100644
index 104f49aebac..00000000000
--- a/src/comp/syntax/ext/expand.rs
+++ /dev/null
@@ -1,102 +0,0 @@
-import driver::session;
-
-import std::map::hashmap;
-
-import syntax::ast::{crate, expr_, expr_mac, mac_invoc};
-import syntax::fold::*;
-import syntax::ext::base::*;
-import syntax::ext::qquote::{qq_helper};
-import syntax::parse::parser::parse_expr_from_source_str;
-
-import codemap::{span, expanded_from};
-
-fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt,
-               e: expr_, s: span, fld: ast_fold,
-               orig: fn@(expr_, span, ast_fold) -> (expr_, span))
-    -> (expr_, span)
-{
-    ret alt e {
-          expr_mac(mac) {
-            alt mac.node {
-              mac_invoc(pth, args, body) {
-                assert (vec::len(pth.node.idents) > 0u);
-                let extname = pth.node.idents[0];
-                alt exts.find(extname) {
-                  none {
-                    cx.span_fatal(pth.span,
-                                  #fmt["macro undefined: '%s'", extname])
-                  }
-                  some(normal({expander: exp, span: exp_sp})) {
-                    let expanded = exp(cx, pth.span, args, body);
-
-                    let info = {call_site: s,
-                                callie: {name: extname, span: exp_sp}};
-                    cx.bt_push(expanded_from(info));
-                    //keep going, outside-in
-                    let fully_expanded = fld.fold_expr(expanded).node;
-                    cx.bt_pop();
-
-                    (fully_expanded, s)
-                  }
-                  some(macro_defining(ext)) {
-                    let named_extension = ext(cx, pth.span, args, body);
-                    exts.insert(named_extension.ident, named_extension.ext);
-                    (ast::expr_rec([], none), s)
-                  }
-                }
-              }
-              _ { cx.span_bug(mac.span, "naked syntactic bit") }
-            }
-          }
-          _ { orig(e, s, fld) }
-        };
-}
-
-fn new_span(cx: ext_ctxt, sp: span) -> span {
-    /* this discards information in the case of macro-defining macros */
-    ret {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()};
-}
-
-// FIXME: this is a terrible kludge to inject some macros into the default
-// compilation environment. When the macro-definition system is substantially
-// more mature, these should move from here, into a compiled part of libcore
-// at very least.
-
-fn core_macros() -> str {
-    ret
-"{
-    #macro([#error[f, ...], log(core::error, #fmt[f, ...])]);
-    #macro([#warn[f, ...], log(core::warn, #fmt[f, ...])]);
-    #macro([#info[f, ...], log(core::info, #fmt[f, ...])]);
-    #macro([#debug[f, ...], log(core::debug, #fmt[f, ...])]);
-}";
-}
-
-fn expand_crate(sess: session::session, c: @crate) -> @crate {
-    let exts = syntax_expander_table();
-    let afp = default_ast_fold();
-    let cx: ext_ctxt = mk_ctxt(sess);
-    let f_pre =
-        {fold_expr: bind expand_expr(exts, cx, _, _, _, afp.fold_expr),
-         new_span: bind new_span(cx, _)
-            with *afp};
-    let f = make_fold(f_pre);
-    let cm = parse_expr_from_source_str("<core-macros>",
-                                        @core_macros(),
-                                        sess.opts.cfg,
-                                        sess.parse_sess);
-
-    // This is run for its side-effects on the expander env,
-    // as it registers all the core macros as expanders.
-    f.fold_expr(cm);
-
-    let res = @f.fold_crate(*c);
-    ret res;
-}
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs
deleted file mode 100644
index 29b19a2d66c..00000000000
--- a/src/comp/syntax/ext/fmt.rs
+++ /dev/null
@@ -1,300 +0,0 @@
-
-
-/*
- * The compiler code necessary to support the #fmt extension. Eventually this
- * should all get sucked into either the standard library extfmt module or the
- * compiler syntax extension plugin interface.
- */
-import extfmt::ct::*;
-import base::*;
-import codemap::span;
-import syntax::ext::build::*;
-export expand_syntax_ext;
-
-fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> @ast::expr {
-    let arg = get_mac_arg(cx,sp,arg);
-    let args: [@ast::expr] =
-        alt arg.node {
-          ast::expr_vec(elts, _) { elts }
-          _ {
-            cx.span_fatal(sp, "#fmt requires arguments of the form `[...]`.")
-          }
-        };
-    if vec::len::<@ast::expr>(args) == 0u {
-        cx.span_fatal(sp, "#fmt requires a format string");
-    }
-    let fmt =
-        expr_to_str(cx, args[0],
-                    "first argument to #fmt must be a string literal.");
-    let fmtspan = args[0].span;
-    #debug("Format string:");
-    log(debug, fmt);
-    fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: str) -> ! {
-        cx.span_fatal(sp, msg);
-    }
-    let parse_fmt_err = bind parse_fmt_err_(cx, fmtspan, _);
-    let pieces = parse_fmt_string(fmt, parse_fmt_err);
-    ret pieces_to_expr(cx, sp, pieces, args);
-}
-
-// FIXME: A lot of these functions for producing expressions can probably
-// be factored out in common with other code that builds expressions.
-// FIXME: Cleanup the naming of these functions
-// NOTE: Moved many of the common ones to build.rs --kevina
-fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
-   -> @ast::expr {
-    fn make_path_vec(_cx: ext_ctxt, ident: ast::ident) -> [ast::ident] {
-        ret ["extfmt", "rt", ident];
-    }
-    fn make_rt_path_expr(cx: ext_ctxt, sp: span, ident: str) -> @ast::expr {
-        let path = make_path_vec(cx, ident);
-        ret mk_path(cx, sp, path);
-    }
-    // Produces an AST expression that represents a RT::conv record,
-    // which tells the RT::conv* functions how to perform the conversion
-
-    fn make_rt_conv_expr(cx: ext_ctxt, sp: span, cnv: conv) -> @ast::expr {
-        fn make_flags(cx: ext_ctxt, sp: span, flags: [flag]) -> @ast::expr {
-            let flagexprs: [@ast::expr] = [];
-            for f: flag in flags {
-                let fstr;
-                alt f {
-                  flag_left_justify { fstr = "flag_left_justify"; }
-                  flag_left_zero_pad { fstr = "flag_left_zero_pad"; }
-                  flag_space_for_sign { fstr = "flag_space_for_sign"; }
-                  flag_sign_always { fstr = "flag_sign_always"; }
-                  flag_alternate { fstr = "flag_alternate"; }
-                }
-                flagexprs += [make_rt_path_expr(cx, sp, fstr)];
-            }
-            // FIXME: 0-length vectors can't have their type inferred
-            // through the rec that these flags are a member of, so
-            // this is a hack placeholder flag
-
-            if vec::len::<@ast::expr>(flagexprs) == 0u {
-                flagexprs += [make_rt_path_expr(cx, sp, "flag_none")];
-            }
-            ret mk_vec_e(cx, sp, flagexprs);
-        }
-        fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr {
-            alt cnt {
-              count_implied {
-                ret make_rt_path_expr(cx, sp, "count_implied");
-              }
-              count_is(c) {
-                let count_lit = mk_int(cx, sp, c);
-                let count_is_path = make_path_vec(cx, "count_is");
-                let count_is_args = [count_lit];
-                ret mk_call(cx, sp, count_is_path, count_is_args);
-              }
-              _ { cx.span_unimpl(sp, "unimplemented #fmt conversion"); }
-            }
-        }
-        fn make_ty(cx: ext_ctxt, sp: span, t: ty) -> @ast::expr {
-            let rt_type;
-            alt t {
-              ty_hex(c) {
-                alt c {
-                  case_upper { rt_type = "ty_hex_upper"; }
-                  case_lower { rt_type = "ty_hex_lower"; }
-                }
-              }
-              ty_bits { rt_type = "ty_bits"; }
-              ty_octal { rt_type = "ty_octal"; }
-              _ { rt_type = "ty_default"; }
-            }
-            ret make_rt_path_expr(cx, sp, rt_type);
-        }
-        fn make_conv_rec(cx: ext_ctxt, sp: span, flags_expr: @ast::expr,
-                         width_expr: @ast::expr, precision_expr: @ast::expr,
-                         ty_expr: @ast::expr) -> @ast::expr {
-            ret mk_rec_e(cx, sp,
-                         [{ident: "flags", ex: flags_expr},
-                          {ident: "width", ex: width_expr},
-                          {ident: "precision", ex: precision_expr},
-                          {ident: "ty", ex: ty_expr}]);
-        }
-        let rt_conv_flags = make_flags(cx, sp, cnv.flags);
-        let rt_conv_width = make_count(cx, sp, cnv.width);
-        let rt_conv_precision = make_count(cx, sp, cnv.precision);
-        let rt_conv_ty = make_ty(cx, sp, cnv.ty);
-        ret make_conv_rec(cx, sp, rt_conv_flags, rt_conv_width,
-                          rt_conv_precision, rt_conv_ty);
-    }
-    fn make_conv_call(cx: ext_ctxt, sp: span, conv_type: str, cnv: conv,
-                      arg: @ast::expr) -> @ast::expr {
-        let fname = "conv_" + conv_type;
-        let path = make_path_vec(cx, fname);
-        let cnv_expr = make_rt_conv_expr(cx, sp, cnv);
-        let args = [cnv_expr, arg];
-        ret mk_call(cx, arg.span, path, args);
-    }
-    fn make_new_conv(cx: ext_ctxt, sp: span, cnv: conv, arg: @ast::expr) ->
-       @ast::expr {
-        // FIXME: Extract all this validation into extfmt::ct
-
-        fn is_signed_type(cnv: conv) -> bool {
-            alt cnv.ty {
-              ty_int(s) {
-                alt s { signed { ret true; } unsigned { ret false; } }
-              }
-              ty_float { ret true; }
-              _ { ret false; }
-            }
-        }
-        let unsupported = "conversion not supported in #fmt string";
-        alt cnv.param {
-          option::none { }
-          _ { cx.span_unimpl(sp, unsupported); }
-        }
-        for f: flag in cnv.flags {
-            alt f {
-              flag_left_justify { }
-              flag_sign_always {
-                if !is_signed_type(cnv) {
-                    cx.span_fatal(sp,
-                                  "+ flag only valid in " +
-                                      "signed #fmt conversion");
-                }
-              }
-              flag_space_for_sign {
-                if !is_signed_type(cnv) {
-                    cx.span_fatal(sp,
-                                  "space flag only valid in " +
-                                      "signed #fmt conversions");
-                }
-              }
-              flag_left_zero_pad { }
-              _ { cx.span_unimpl(sp, unsupported); }
-            }
-        }
-        alt cnv.width {
-          count_implied { }
-          count_is(_) { }
-          _ { cx.span_unimpl(sp, unsupported); }
-        }
-        alt cnv.precision {
-          count_implied { }
-          count_is(_) { }
-          _ { cx.span_unimpl(sp, unsupported); }
-        }
-        alt cnv.ty {
-          ty_str { ret make_conv_call(cx, arg.span, "str", cnv, arg); }
-          ty_int(sign) {
-            alt sign {
-              signed { ret make_conv_call(cx, arg.span, "int", cnv, arg); }
-              unsigned {
-                ret make_conv_call(cx, arg.span, "uint", cnv, arg);
-              }
-            }
-          }
-          ty_bool { ret make_conv_call(cx, arg.span, "bool", cnv, arg); }
-          ty_char { ret make_conv_call(cx, arg.span, "char", cnv, arg); }
-          ty_hex(_) { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
-          ty_bits { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
-          ty_octal { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
-          ty_float { ret make_conv_call(cx, arg.span, "float", cnv, arg); }
-          ty_poly { ret make_conv_call(cx, arg.span, "poly", cnv, arg); }
-          _ { cx.span_unimpl(sp, unsupported); }
-        }
-    }
-    fn log_conv(c: conv) {
-        alt c.param {
-          some(p) { log(debug, "param: " + int::to_str(p, 10u)); }
-          _ { #debug("param: none"); }
-        }
-        for f: flag in c.flags {
-            alt f {
-              flag_left_justify { #debug("flag: left justify"); }
-              flag_left_zero_pad { #debug("flag: left zero pad"); }
-              flag_space_for_sign { #debug("flag: left space pad"); }
-              flag_sign_always { #debug("flag: sign always"); }
-              flag_alternate { #debug("flag: alternate"); }
-            }
-        }
-        alt c.width {
-          count_is(i) { log(debug,
-                                 "width: count is " + int::to_str(i, 10u)); }
-          count_is_param(i) {
-            log(debug,
-                     "width: count is param " + int::to_str(i, 10u));
-          }
-          count_is_next_param { #debug("width: count is next param"); }
-          count_implied { #debug("width: count is implied"); }
-        }
-        alt c.precision {
-          count_is(i) { log(debug,
-                                 "prec: count is " + int::to_str(i, 10u)); }
-          count_is_param(i) {
-            log(debug,
-                     "prec: count is param " + int::to_str(i, 10u));
-          }
-          count_is_next_param { #debug("prec: count is next param"); }
-          count_implied { #debug("prec: count is implied"); }
-        }
-        alt c.ty {
-          ty_bool { #debug("type: bool"); }
-          ty_str { #debug("type: str"); }
-          ty_char { #debug("type: char"); }
-          ty_int(s) {
-            alt s {
-              signed { #debug("type: signed"); }
-              unsigned { #debug("type: unsigned"); }
-            }
-          }
-          ty_bits { #debug("type: bits"); }
-          ty_hex(cs) {
-            alt cs {
-              case_upper { #debug("type: uhex"); }
-              case_lower { #debug("type: lhex"); }
-            }
-          }
-          ty_octal { #debug("type: octal"); }
-          ty_float { #debug("type: float"); }
-          ty_poly { #debug("type: poly"); }
-        }
-    }
-    let fmt_sp = args[0].span;
-    let n = 0u;
-    let tmp_expr = mk_str(cx, sp, "");
-    let nargs = vec::len::<@ast::expr>(args);
-    for pc: piece in pieces {
-        alt pc {
-          piece_string(s) {
-            let s_expr = mk_str(cx, fmt_sp, s);
-            tmp_expr = mk_binary(cx, fmt_sp, ast::add, tmp_expr, s_expr);
-          }
-          piece_conv(conv) {
-            n += 1u;
-            if n >= nargs {
-                cx.span_fatal(sp,
-                              "not enough arguments to #fmt " +
-                                  "for the given format string");
-            }
-            #debug("Building conversion:");
-            log_conv(conv);
-            let arg_expr = args[n];
-            let c_expr = make_new_conv(cx, fmt_sp, conv, arg_expr);
-            tmp_expr = mk_binary(cx, fmt_sp, ast::add, tmp_expr, c_expr);
-          }
-        }
-    }
-    let expected_nargs = n + 1u; // n conversions + the fmt string
-
-    if expected_nargs < nargs {
-        cx.span_fatal
-            (sp, #fmt["too many arguments to #fmt. found %u, expected %u",
-                           nargs, expected_nargs]);
-    }
-    ret tmp_expr;
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs
deleted file mode 100644
index 2bb6dac7f2a..00000000000
--- a/src/comp/syntax/ext/ident_to_str.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-import base::*;
-import syntax::ast;
-
-fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> @ast::expr {
-    let arg = get_mac_arg(cx,sp,arg);
-    let args: [@ast::expr] =
-        alt arg.node {
-          ast::expr_vec(elts, _) { elts }
-          _ {
-            cx.span_fatal(sp, "#ident_to_str requires a vector argument .")
-          }
-        };
-    if vec::len::<@ast::expr>(args) != 1u {
-        cx.span_fatal(sp, "malformed #ident_to_str call");
-    }
-
-    ret make_new_lit(cx, sp,
-                     ast::lit_str(expr_to_ident(cx, args[0u],
-                                                "expected an ident")));
-
-}
diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs
deleted file mode 100644
index 911cf9ff2eb..00000000000
--- a/src/comp/syntax/ext/log_syntax.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-import base::*;
-import syntax::ast;
-import std::io::writer_util;
-
-fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> @ast::expr {
-    let arg = get_mac_arg(cx,sp,arg);
-    cx.print_backtrace();
-    std::io::stdout().write_line(print::pprust::expr_to_str(arg));
-
-    //trivial expression
-    ret @{id: cx.next_id(), node: ast::expr_rec([], option::none), span: sp};
-}
diff --git a/src/comp/syntax/ext/qquote.rs b/src/comp/syntax/ext/qquote.rs
deleted file mode 100644
index 7f7d5a387f0..00000000000
--- a/src/comp/syntax/ext/qquote.rs
+++ /dev/null
@@ -1,338 +0,0 @@
-import driver::session;
-
-import syntax::ast::{crate, expr_, mac_invoc,
-                     mac_aq, mac_var};
-import syntax::fold::*;
-import syntax::visit::*;
-import syntax::ext::base::*;
-import syntax::ext::build::*;
-import syntax::parse::parser;
-import syntax::parse::parser::{parser, parse_from_source_str};
-
-import syntax::print::*;
-import std::io::*;
-
-import codemap::span;
-
-type aq_ctxt = @{lo: uint,
-                 mutable gather: [{lo: uint, hi: uint,
-                                   e: @ast::expr,
-                                   constr: str}]};
-enum fragment {
-    from_expr(@ast::expr),
-    from_ty(@ast::ty)
-}
-
-iface qq_helper {
-    fn span() -> span;
-    fn visit(aq_ctxt, vt<aq_ctxt>);
-    fn extract_mac() -> option<ast::mac_>;
-    fn mk_parse_fn(ext_ctxt,span) -> @ast::expr;
-    fn get_fold_fn() -> str;
-}
-
-impl of qq_helper for @ast::crate {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_crate(*self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {fail}
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_crate"])
-    }
-    fn get_fold_fn() -> str {"fold_crate"}
-}
-impl of qq_helper for @ast::expr {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_expr(self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {
-        alt (self.node) {
-          ast::expr_mac({node: mac, _}) {some(mac)}
-          _ {none}
-        }
-    }
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "parse", "parser", "parse_expr"])
-    }
-    fn get_fold_fn() -> str {"fold_expr"}
-}
-impl of qq_helper for @ast::ty {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_ty(self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {
-        alt (self.node) {
-          ast::ty_mac({node: mac, _}) {some(mac)}
-          _ {none}
-        }
-    }
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_ty"])
-    }
-    fn get_fold_fn() -> str {"fold_ty"}
-}
-impl of qq_helper for @ast::item {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_item(self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {fail}
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_item"])
-    }
-    fn get_fold_fn() -> str {"fold_item"}
-}
-impl of qq_helper for @ast::stmt {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_stmt(self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {fail}
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_stmt"])
-    }
-    fn get_fold_fn() -> str {"fold_stmt"}
-}
-impl of qq_helper for @ast::pat {
-    fn span() -> span {self.span}
-    fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_pat(self, cx, v);}
-    fn extract_mac() -> option<ast::mac_> {fail}
-    fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr {
-        mk_path(cx, sp, ["syntax", "parse", "parser", "parse_pat"])
-    }
-    fn get_fold_fn() -> str {"fold_pat"}
-}
-
-fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt
-{
-    let v = @{visit_expr: visit_aq_expr,
-              visit_ty: visit_aq_ty
-              with *default_visitor()};
-    let cx = @{lo:lo, mutable gather: []};
-    node.visit(cx, mk_vt(v));
-    ret cx;
-}
-
-fn visit_aq<T:qq_helper>(node: T, constr: str, &&cx: aq_ctxt, v: vt<aq_ctxt>)
-{
-    alt (node.extract_mac()) {
-      some(mac_aq(sp, e)) {
-        cx.gather += [{lo: sp.lo - cx.lo, hi: sp.hi - cx.lo,
-                       e: e, constr: constr}];
-      }
-      _ {node.visit(cx, v);}
-    }
-}
-// FIXME: these are only here because I (kevina) couldn't figure out how to
-// get bind to work in gather_anti_quotes
-fn visit_aq_expr(node: @ast::expr, &&cx: aq_ctxt, v: vt<aq_ctxt>) {
-    visit_aq(node,"from_expr",cx,v);
-}
-fn visit_aq_ty(node: @ast::ty, &&cx: aq_ctxt, v: vt<aq_ctxt>) {
-    visit_aq(node,"from_ty",cx,v);
-}
-
-fn is_space(c: char) -> bool {
-    syntax::parse::lexer::is_whitespace(c)
-}
-
-fn expand_ast(ecx: ext_ctxt, _sp: span,
-              arg: ast::mac_arg, body: ast::mac_body)
-    -> @ast::expr
-{
-    let what = "expr";
-    option::may(arg) {|arg|
-        let args: [@ast::expr] =
-            alt arg.node {
-              ast::expr_vec(elts, _) { elts }
-              _ {
-                ecx.span_fatal
-                    (_sp, "#ast requires arguments of the form `[...]`.")
-              }
-            };
-        if vec::len::<@ast::expr>(args) != 1u {
-            ecx.span_fatal(_sp, "#ast requires exactly one arg");
-        }
-        alt (args[0].node) {
-          ast::expr_path(@{node: {idents: id, _},_}) if vec::len(id) == 1u
-              {what = id[0]}
-          _ {ecx.span_fatal(args[0].span, "expected an identifier");}
-        }
-    }
-    let body = get_mac_body(ecx,_sp,body);
-
-    ret alt what {
-      "crate" {finish(ecx, body, parse_crate)}
-      "expr" {finish(ecx, body, parser::parse_expr)}
-      "ty" {finish(ecx, body, parse_ty)}
-      "item" {finish(ecx, body, parse_item)}
-      "stmt" {finish(ecx, body, parse_stmt)}
-      "pat" {finish(ecx, body, parser::parse_pat)}
-      _ {ecx.span_fatal(_sp, "unsupported ast type")}
-    };
-}
-
-fn parse_crate(p: parser) -> @ast::crate {
-    parser::parse_crate_mod(p, [])
-}
-
-fn parse_ty(p: parser) -> @ast::ty {
-    parser::parse_ty(p, false)
-}
-
-fn parse_stmt(p: parser) -> @ast::stmt {
-    parser::parse_stmt(p, [])
-}
-
-fn parse_item(p: parser) -> @ast::item {
-    alt (parser::parse_item(p, [])) {
-      some(item) {item}
-      none {fail; /* FIXME: Error message, somehow */}
-    }
-}
-
-fn finish<T: qq_helper>
-    (ecx: ext_ctxt, body: ast::mac_body_, f: fn (p: parser) -> T)
-    -> @ast::expr
-{
-    let cm = ecx.session().parse_sess.cm;
-    let str = @codemap::span_to_snippet(body.span, cm);
-    let fname = codemap::mk_substr_filename(cm, body.span);
-    let node = parse_from_source_str
-        (f, fname, codemap::fss_internal(body.span), str,
-         ecx.session().opts.cfg, ecx.session().parse_sess);
-    let loc = codemap::lookup_char_pos(cm, body.span.lo);
-
-    let sp = node.span();
-    let qcx = gather_anti_quotes(sp.lo, node);
-    let cx = qcx;
-
-    // assert that the vector is sorted by position:
-    uint::range(1u, vec::len(cx.gather)) {|i|
-        assert cx.gather[i-1u].lo < cx.gather[i].lo;
-    }
-
-    let str2 = "";
-    enum state {active, skip(uint), blank};
-    let state = active;
-    let i = 0u, j = 0u;
-    let g_len = vec::len(cx.gather);
-    str::chars_iter(*str) {|ch|
-        if (j < g_len && i == cx.gather[j].lo) {
-            assert ch == '$';
-            let repl = #fmt("$%u ", j);
-            state = skip(str::char_len(repl));
-            str2 += repl;
-        }
-        alt state {
-          active {str::push_char(str2, ch);}
-          skip(1u) {state = blank;}
-          skip(sk) {state = skip (sk-1u);}
-          blank if is_space(ch) {str::push_char(str2, ch);}
-          blank {str::push_char(str2, ' ');}
-        }
-        i += 1u;
-        if (j < g_len && i == cx.gather[j].hi) {
-            assert ch == ')';
-            state = active;
-            j += 1u;
-        }
-    }
-
-    let cx = ecx;
-    let session_call = bind mk_call_(cx,sp,
-                                     mk_access(cx,sp,["ext_cx"], "session"),
-                                     []);
-    let pcall = mk_call(cx,sp,
-                       ["syntax", "parse", "parser",
-                        "parse_from_source_str"],
-                       [node.mk_parse_fn(cx,sp),
-                        mk_str(cx,sp, fname),
-                        mk_call(cx,sp,
-                                ["syntax","ext","qquote", "mk_file_substr"],
-                                [mk_str(cx,sp, loc.file.name),
-                                 mk_uint(cx,sp, loc.line),
-                                 mk_uint(cx,sp, loc.col)]),
-                        mk_unary(cx,sp, ast::box(ast::m_imm),
-                                 mk_str(cx,sp, str2)),
-                        mk_access_(cx,sp,
-                                   mk_access_(cx,sp, session_call(), "opts"),
-                                   "cfg"),
-                        mk_access_(cx,sp, session_call(), "parse_sess")]
-                      );
-    let rcall = pcall;
-    if (g_len > 0u) {
-        rcall = mk_call(cx,sp,
-                        ["syntax", "ext", "qquote", "replace"],
-                        [pcall,
-                         mk_vec_e(cx,sp, vec::map(copy qcx.gather) {|g|
-                             mk_call(cx,sp,
-                                     ["syntax", "ext", "qquote", g.constr],
-                                     [g.e])}),
-                         mk_path(cx,sp,
-                                 ["syntax", "ext", "qquote",
-                                  node.get_fold_fn()])]);
-    }
-    ret rcall;
-}
-
-fn replace<T>(node: T, repls: [fragment], ff: fn (ast_fold, T) -> T)
-    -> T
-{
-    let aft = default_ast_fold();
-    let f_pre = {fold_expr: bind replace_expr(repls, _, _, _,
-                                              aft.fold_expr),
-                 fold_ty: bind replace_ty(repls, _, _, _,
-                                          aft.fold_ty)
-                 with *aft};
-    ret ff(make_fold(f_pre), node);
-}
-fn fold_crate(f: ast_fold, &&n: @ast::crate) -> @ast::crate {
-    @f.fold_crate(*n)
-}
-fn fold_expr(f: ast_fold, &&n: @ast::expr) -> @ast::expr {f.fold_expr(n)}
-fn fold_ty(f: ast_fold, &&n: @ast::ty) -> @ast::ty {f.fold_ty(n)}
-fn fold_item(f: ast_fold, &&n: @ast::item) -> @ast::item {f.fold_item(n)}
-fn fold_stmt(f: ast_fold, &&n: @ast::stmt) -> @ast::stmt {f.fold_stmt(n)}
-fn fold_pat(f: ast_fold, &&n: @ast::pat) -> @ast::pat {f.fold_pat(n)}
-
-fn replace_expr(repls: [fragment],
-                e: ast::expr_, s: span, fld: ast_fold,
-                orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
-    -> (ast::expr_, span)
-{
-    alt e {
-      ast::expr_mac({node: mac_var(i), _}) {
-        alt (repls[i]) {
-          from_expr(r) {(r.node, r.span)}
-          _ {fail /* fixme error message */}}}
-      _ {orig(e,s,fld)}
-    }
-}
-
-fn replace_ty(repls: [fragment],
-                e: ast::ty_, s: span, fld: ast_fold,
-                orig: fn@(ast::ty_, span, ast_fold)->(ast::ty_, span))
-    -> (ast::ty_, span)
-{
-    alt e {
-      ast::ty_mac({node: mac_var(i), _}) {
-        alt (repls[i]) {
-          from_ty(r) {(r.node, r.span)}
-          _ {fail /* fixme error message */}}}
-      _ {orig(e,s,fld)}
-    }
-}
-
-fn print_expr(expr: @ast::expr) {
-    let stdout = std::io::stdout();
-    let pp = pprust::rust_printer(stdout);
-    pprust::print_expr(pp, expr);
-    pp::eof(pp.s);
-    stdout.write_str("\n");
-}
-
-fn mk_file_substr(fname: str, line: uint, col: uint) -> codemap::file_substr {
-    codemap::fss_external({filename: fname, line: line, col: col})
-}
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs
deleted file mode 100644
index 1baf5f97d20..00000000000
--- a/src/comp/syntax/ext/simplext.rs
+++ /dev/null
@@ -1,779 +0,0 @@
-use std;
-
-import codemap::span;
-import std::map::{hashmap, new_str_hash};
-import driver::session::session;
-
-import base::*;
-
-import fold::*;
-import ast_util::respan;
-import ast::{ident, path, ty, blk_, expr, path_, expr_path,
-             expr_vec, expr_mac, mac_invoc, node_id};
-
-export add_new_extension;
-
-fn path_to_ident(pth: @path) -> option<ident> {
-    if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u {
-        ret some(pth.node.idents[0u]);
-    }
-    ret none;
-}
-
-//a vec of binders might be a little big.
-type clause = {params: binders, body: @expr};
-
-/* logically, an arb_depth should contain only one kind of matchable */
-enum arb_depth<T> { leaf(T), seq(@[arb_depth<T>], span), }
-
-
-enum matchable {
-    match_expr(@expr),
-    match_path(@path),
-    match_ident(ast::spanned<ident>),
-    match_ty(@ty),
-    match_block(ast::blk),
-    match_exact, /* don't bind anything, just verify the AST traversal */
-}
-
-/* for when given an incompatible bit of AST */
-fn match_error(cx: ext_ctxt, m: matchable, expected: str) -> ! {
-    alt m {
-      match_expr(x) {
-        cx.span_fatal(x.span,
-                      "this argument is an expr, expected " + expected);
-      }
-      match_path(x) {
-        cx.span_fatal(x.span,
-                      "this argument is a path, expected " + expected);
-      }
-      match_ident(x) {
-        cx.span_fatal(x.span,
-                      "this argument is an ident, expected " + expected);
-      }
-      match_ty(x) {
-        cx.span_fatal(x.span,
-                      "this argument is a type, expected " + expected);
-      }
-      match_block(x) {
-        cx.span_fatal(x.span,
-                      "this argument is a block, expected " + expected);
-      }
-      match_exact { cx.bug("what is a match_exact doing in a bindings?"); }
-    }
-}
-
-// We can't make all the matchables in a match_result the same type because
-// idents can be paths, which can be exprs.
-
-// If we want better match failure error messages (like in Fortifying Syntax),
-// we'll want to return something indicating amount of progress and location
-// of failure instead of `none`.
-type match_result = option<arb_depth<matchable>>;
-type selector = fn@(matchable) -> match_result;
-
-fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) ->
-   {pre: [@expr], rep: option<@expr>, post: [@expr]} {
-    let idx: uint = 0u;
-    let res = none;
-    for elt: @expr in elts {
-        alt elt.node {
-          expr_mac(m) {
-            alt m.node {
-              ast::mac_ellipsis {
-                if res != none {
-                    cx.span_fatal(m.span, "only one ellipsis allowed");
-                }
-                res =
-                    some({pre: vec::slice(elts, 0u, idx - 1u),
-                          rep: some(elts[idx - 1u]),
-                          post: vec::slice(elts, idx + 1u, vec::len(elts))});
-              }
-              _ { }
-            }
-          }
-          _ { }
-        }
-        idx += 1u;
-    }
-    ret alt res {
-          some(val) { val }
-          none { {pre: elts, rep: none, post: []} }
-        }
-}
-
-fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option<U>, v: [T]) ->
-   option<[U]> {
-    let res = [];
-    for elem: T in v {
-        alt f(elem) { none { ret none; } some(fv) { res += [fv]; } }
-    }
-    ret some(res);
-}
-
-fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result {
-    alt ad {
-      leaf(x) { ret f(x); }
-      seq(ads, span) {
-        alt option_flatten_map(bind a_d_map(_, f), *ads) {
-          none { ret none; }
-          some(ts) { ret some(seq(@ts, span)); }
-        }
-      }
-    }
-}
-
-fn compose_sels(s1: selector, s2: selector) -> selector {
-    fn scomp(s1: selector, s2: selector, m: matchable) -> match_result {
-        ret alt s1(m) {
-              none { none }
-              some(matches) { a_d_map(matches, s2) }
-            }
-    }
-    ret bind scomp(s1, s2, _);
-}
-
-
-
-type binders =
-    {real_binders: hashmap<ident, selector>,
-     mutable literal_ast_matchers: [selector]};
-type bindings = hashmap<ident, arb_depth<matchable>>;
-
-fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { }
-
-/* these three functions are the big moving parts */
-
-/* create the selectors needed to bind and verify the pattern */
-
-fn pattern_to_selectors(cx: ext_ctxt, e: @expr) -> binders {
-    let res: binders =
-        {real_binders: new_str_hash::<selector>(),
-         mutable literal_ast_matchers: []};
-    //this oughta return binders instead, but macro args are a sequence of
-    //expressions, rather than a single expression
-    fn trivial_selector(m: matchable) -> match_result { ret some(leaf(m)); }
-    p_t_s_rec(cx, match_expr(e), trivial_selector, res);
-    ret res;
-}
-
-
-
-/* use the selectors on the actual arguments to the macro to extract
-bindings. Most of the work is done in p_t_s, which generates the
-selectors. */
-
-fn use_selectors_to_bind(b: binders, e: @expr) -> option<bindings> {
-    let res = new_str_hash::<arb_depth<matchable>>();
-    //need to do this first, to check vec lengths.
-    for sel: selector in b.literal_ast_matchers {
-        alt sel(match_expr(e)) { none { ret none; } _ { } }
-    }
-    let never_mind: bool = false;
-    b.real_binders.items {|key, val|
-        alt val(match_expr(e)) {
-          none { never_mind = true; }
-          some(mtc) { res.insert(key, mtc); }
-        }
-    };
-    //HACK: `ret` doesn't work in `for each`
-    if never_mind { ret none; }
-    ret some(res);
-}
-
-/* use the bindings on the body to generate the expanded code */
-
-fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
-    let idx_path: @mutable [uint] = @mutable [];
-    fn new_id(_old: node_id, cx: ext_ctxt) -> node_id { ret cx.next_id(); }
-    fn new_span(cx: ext_ctxt, sp: span) -> span {
-        /* this discards information in the case of macro-defining macros */
-        ret {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()};
-    }
-    let afp = default_ast_fold();
-    let f_pre =
-        {fold_ident: bind transcribe_ident(cx, b, idx_path, _, _),
-         fold_path: bind transcribe_path(cx, b, idx_path, _, _, _),
-         fold_expr:
-             bind transcribe_expr(cx, b, idx_path, _, _, _, afp.fold_expr),
-         fold_ty: bind transcribe_type(cx, b, idx_path, _, _, _, afp.fold_ty),
-         fold_block:
-             bind transcribe_block(cx, b, idx_path, _, _, _, afp.fold_block),
-         map_exprs: bind transcribe_exprs(cx, b, idx_path, _, _),
-         new_id: bind new_id(_, cx)
-         with *afp};
-    let f = make_fold(f_pre);
-    let result = f.fold_expr(body);
-    ret result;
-}
-
-
-/* helper: descend into a matcher */
-fn follow(m: arb_depth<matchable>, idx_path: @mutable [uint]) ->
-   arb_depth<matchable> {
-    let res: arb_depth<matchable> = m;
-    for idx: uint in *idx_path {
-        alt res {
-          leaf(_) { ret res;/* end of the line */ }
-          seq(new_ms, _) { res = new_ms[idx]; }
-        }
-    }
-    ret res;
-}
-
-fn follow_for_trans(cx: ext_ctxt, mmaybe: option<arb_depth<matchable>>,
-                    idx_path: @mutable [uint]) -> option<matchable> {
-    alt mmaybe {
-      none { ret none }
-      some(m) {
-        ret alt follow(m, idx_path) {
-              seq(_, sp) {
-                cx.span_fatal(sp,
-                              "syntax matched under ... but not " +
-                                  "used that way.")
-              }
-              leaf(m) { ret some(m) }
-            }
-      }
-    }
-
-}
-
-/* helper for transcribe_exprs: what vars from `b` occur in `e`? */
-fn free_vars(b: bindings, e: @expr, it: fn(ident)) {
-    let idents: hashmap<ident, ()> = new_str_hash::<()>();
-    fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings,
-                  idents: hashmap<ident, ()>) -> ident {
-        if b.contains_key(i) { idents.insert(i, ()); }
-        ret i;
-    }
-    // using fold is a hack: we want visit, but it doesn't hit idents ) :
-    // solve this with macros
-    let f_pre =
-        {fold_ident: bind mark_ident(_, _, b, idents)
-            with *default_ast_fold()};
-    let f = make_fold(f_pre);
-    f.fold_expr(e); // ignore result
-    idents.keys {|x| it(x); };
-}
-
-
-/* handle sequences (anywhere in the AST) of exprs, either real or ...ed */
-fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                    recur: fn@(&&@expr) -> @expr, exprs: [@expr]) -> [@expr] {
-    alt elts_to_ell(cx, exprs) {
-      {pre: pre, rep: repeat_me_maybe, post: post} {
-        let res = vec::map(pre, recur);
-        alt repeat_me_maybe {
-          none { }
-          some(repeat_me) {
-            let repeat: option<{rep_count: uint, name: ident}> = none;
-            /* we need to walk over all the free vars in lockstep, except for
-            the leaves, which are just duplicated */
-            free_vars(b, repeat_me) {|fv|
-                let cur_pos = follow(b.get(fv), idx_path);
-                alt cur_pos {
-                  leaf(_) { }
-                  seq(ms, _) {
-                    alt repeat {
-                      none {
-                        repeat = some({rep_count: vec::len(*ms), name: fv});
-                      }
-                      some({rep_count: old_len, name: old_name}) {
-                        let len = vec::len(*ms);
-                        if old_len != len {
-                            let msg =
-                                #fmt["'%s' occurs %u times, but ", fv, len] +
-                                    #fmt["'%s' occurs %u times", old_name,
-                                         old_len];
-                            cx.span_fatal(repeat_me.span, msg);
-                        }
-                      }
-                    }
-                  }
-                }
-            };
-            alt repeat {
-              none {
-                cx.span_fatal(repeat_me.span,
-                              "'...' surrounds an expression without any" +
-                                  " repeating syntax variables");
-              }
-              some({rep_count: rc, _}) {
-                /* Whew, we now know how how many times to repeat */
-                let idx: uint = 0u;
-                while idx < rc {
-                    *idx_path += [idx];
-                    res += [recur(repeat_me)]; // whew!
-                    vec::pop(*idx_path);
-                    idx += 1u;
-                }
-              }
-            }
-          }
-        }
-        res += vec::map(post, recur);
-        ret res;
-      }
-    }
-}
-
-
-
-// substitute, in a position that's required to be an ident
-fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                    &&i: ident, _fld: ast_fold) -> ident {
-    ret alt follow_for_trans(cx, b.find(i), idx_path) {
-          some(match_ident(a_id)) { a_id.node }
-          some(m) { match_error(cx, m, "an identifier") }
-          none { i }
-        }
-}
-
-
-fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                   p: path_, s:span, _fld: ast_fold) -> (path_, span) {
-    // Don't substitute into qualified names.
-    if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret (p, s); }
-    ret alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
-          some(match_ident(id)) {
-            ({global: false, idents: [id.node], types: []}, id.span)
-          }
-          some(match_path(a_pth)) { (a_pth.node, a_pth.span) }
-          some(m) { match_error(cx, m, "a path") }
-          none { (p, s) }
-        }
-}
-
-
-fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                   e: ast::expr_, s: span, fld: ast_fold,
-                   orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
-    -> (ast::expr_, span)
-{
-    ret alt e {
-          expr_path(p) {
-            // Don't substitute into qualified names.
-            if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
-                (e, s);
-            }
-            alt follow_for_trans(cx, b.find(p.node.idents[0]), idx_path) {
-              some(match_ident(id)) {
-                (expr_path(@respan(id.span,
-                                   {global: false,
-                                    idents: [id.node],
-                                    types: []})), id.span)
-              }
-              some(match_path(a_pth)) { (expr_path(a_pth), s) }
-              some(match_expr(a_exp)) { (a_exp.node, a_exp.span) }
-              some(m) { match_error(cx, m, "an expression") }
-              none { orig(e, s, fld) }
-            }
-          }
-          _ { orig(e, s, fld) }
-        }
-}
-
-fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                   t: ast::ty_, s: span, fld: ast_fold,
-                   orig: fn@(ast::ty_, span, ast_fold) -> (ast::ty_, span))
-    -> (ast::ty_, span)
-{
-    ret alt t {
-          ast::ty_path(pth, _) {
-            alt path_to_ident(pth) {
-              some(id) {
-                alt follow_for_trans(cx, b.find(id), idx_path) {
-                  some(match_ty(ty)) { (ty.node, ty.span) }
-                  some(m) { match_error(cx, m, "a type") }
-                  none { orig(t, s, fld) }
-                }
-              }
-              none { orig(t, s, fld) }
-            }
-          }
-          _ { orig(t, s, fld) }
-        }
-}
-
-
-/* for parsing reasons, syntax variables bound to blocks must be used like
-`{v}` */
-
-fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
-                    blk: blk_, s: span, fld: ast_fold,
-                    orig: fn@(blk_, span, ast_fold) -> (blk_, span))
-    -> (blk_, span)
-{
-    ret alt block_to_ident(blk) {
-          some(id) {
-            alt follow_for_trans(cx, b.find(id), idx_path) {
-              some(match_block(new_blk)) { (new_blk.node, new_blk.span) }
-
-
-
-
-
-              // possibly allow promotion of ident/path/expr to blocks?
-              some(m) {
-                match_error(cx, m, "a block")
-              }
-              none { orig(blk, s, fld) }
-            }
-          }
-          none { orig(blk, s, fld) }
-        }
-}
-
-
-/* traverse the pattern, building instructions on how to bind the actual
-argument. ps accumulates instructions on navigating the tree.*/
-fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
-
-    //it might be possible to traverse only exprs, not matchables
-    alt m {
-      match_expr(e) {
-        alt e.node {
-          expr_path(p_pth) { p_t_s_r_path(cx, p_pth, s, b); }
-          expr_vec(p_elts, _) {
-            alt elts_to_ell(cx, p_elts) {
-              {pre: pre, rep: some(repeat_me), post: post} {
-                p_t_s_r_length(cx, vec::len(pre) + vec::len(post), true, s,
-                               b);
-                if vec::len(pre) > 0u {
-                    p_t_s_r_actual_vector(cx, pre, true, s, b);
-                }
-                p_t_s_r_ellipses(cx, repeat_me, vec::len(pre), s, b);
-
-                if vec::len(post) > 0u {
-                    cx.span_unimpl(e.span,
-                                   "matching after `...` not yet supported");
-                }
-              }
-              {pre: pre, rep: none, post: post} {
-                if post != [] {
-                    cx.bug("elts_to_ell provided an invalid result");
-                }
-                p_t_s_r_length(cx, vec::len(pre), false, s, b);
-                p_t_s_r_actual_vector(cx, pre, false, s, b);
-              }
-            }
-          }
-          /* FIXME: handle embedded types and blocks, at least */
-          expr_mac(mac) {
-            p_t_s_r_mac(cx, mac, s, b);
-          }
-          _ {
-            fn select(cx: ext_ctxt, m: matchable, pat: @expr) ->
-               match_result {
-                ret alt m {
-                      match_expr(e) {
-                        if e == pat { some(leaf(match_exact)) } else { none }
-                      }
-                      _ { cx.bug("broken traversal in p_t_s_r") }
-                    }
-            }
-            b.literal_ast_matchers += [bind select(cx, _, e)];
-          }
-        }
-      }
-      _ {
-          cx.session().bug("undocumented invariant in p_t_s_rec");
-      }
-    }
-}
-
-
-/* make a match more precise */
-fn specialize_match(m: matchable) -> matchable {
-    ret alt m {
-          match_expr(e) {
-            alt e.node {
-              expr_path(pth) {
-                alt path_to_ident(pth) {
-                  some(id) { match_ident(respan(pth.span, id)) }
-                  none { match_path(pth) }
-                }
-              }
-              _ { m }
-            }
-          }
-          _ { m }
-        }
-}
-
-/* pattern_to_selectors helper functions */
-fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) {
-    alt path_to_ident(p) {
-      some(p_id) {
-        fn select(cx: ext_ctxt, m: matchable) -> match_result {
-            ret alt m {
-                  match_expr(e) { some(leaf(specialize_match(m))) }
-                  _ { cx.bug("broken traversal in p_t_s_r") }
-                }
-        }
-        if b.real_binders.contains_key(p_id) {
-            cx.span_fatal(p.span, "duplicate binding identifier");
-        }
-        b.real_binders.insert(p_id, compose_sels(s, bind select(cx, _)));
-      }
-      none { }
-    }
-}
-
-fn block_to_ident(blk: blk_) -> option<ident> {
-    if vec::len(blk.stmts) != 0u { ret none; }
-    ret alt blk.expr {
-          some(expr) {
-            alt expr.node { expr_path(pth) { path_to_ident(pth) } _ { none } }
-          }
-          none { none }
-        }
-}
-
-fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, s: selector, b: binders) {
-    fn select_pt_1(cx: ext_ctxt, m: matchable,
-                   fn_m: fn(ast::mac) -> match_result) -> match_result {
-        ret alt m {
-              match_expr(e) {
-                alt e.node { expr_mac(mac) { fn_m(mac) } _ { none } }
-              }
-              _ { cx.bug("broken traversal in p_t_s_r") }
-            }
-    }
-    fn no_des(cx: ext_ctxt, sp: span, syn: str) -> ! {
-        cx.span_fatal(sp, "destructuring " + syn + " is not yet supported");
-    }
-    alt mac.node {
-      ast::mac_ellipsis { cx.span_fatal(mac.span, "misused `...`"); }
-      ast::mac_invoc(_, _, _) { no_des(cx, mac.span, "macro calls"); }
-      ast::mac_embed_type(ty) {
-        alt ty.node {
-          ast::ty_path(pth, _) {
-            alt path_to_ident(pth) {
-              some(id) {
-                /* look for an embedded type */
-                fn select_pt_2(m: ast::mac) -> match_result {
-                    ret alt m.node {
-                          ast::mac_embed_type(t) { some(leaf(match_ty(t))) }
-                          _ { none }
-                        }
-                }
-                let final_step = bind select_pt_1(cx, _, select_pt_2);
-                b.real_binders.insert(id, compose_sels(s, final_step));
-              }
-              none { no_des(cx, pth.span, "under `#<>`"); }
-            }
-          }
-          _ { no_des(cx, ty.span, "under `#<>`"); }
-        }
-      }
-      ast::mac_embed_block(blk) {
-        alt block_to_ident(blk.node) {
-          some(id) {
-            fn select_pt_2(m: ast::mac) -> match_result {
-                ret alt m.node {
-                      ast::mac_embed_block(blk) {
-                        some(leaf(match_block(blk)))
-                      }
-                      _ { none }
-                    }
-            }
-            let final_step = bind select_pt_1(cx, _, select_pt_2);
-            b.real_binders.insert(id, compose_sels(s, final_step));
-          }
-          none { no_des(cx, blk.span, "under `#{}`"); }
-        }
-      }
-      ast::mac_aq(_,_) { no_des(cx, mac.span, "antiquotes"); }
-      ast::mac_var(_) { no_des(cx, mac.span, "antiquote variables"); }
-    }
-}
-
-fn p_t_s_r_ellipses(cx: ext_ctxt, repeat_me: @expr, offset: uint, s: selector,
-                    b: binders) {
-    fn select(cx: ext_ctxt, repeat_me: @expr, offset: uint, m: matchable) ->
-       match_result {
-        ret alt m {
-              match_expr(e) {
-                alt e.node {
-                  expr_vec(arg_elts, _) {
-                    let elts = [];
-                    let idx = offset;
-                    while idx < vec::len(arg_elts) {
-                        elts += [leaf(match_expr(arg_elts[idx]))];
-                        idx += 1u;
-                    }
-
-                    // using repeat_me.span is a little wacky, but the
-                    // error we want to report is one in the macro def
-                    some(seq(@elts, repeat_me.span))
-                  }
-                  _ { none }
-                }
-              }
-              _ { cx.bug("broken traversal in p_t_s_r") }
-            }
-    }
-    p_t_s_rec(cx, match_expr(repeat_me),
-              compose_sels(s, bind select(cx, repeat_me, offset, _)), b);
-}
-
-
-fn p_t_s_r_length(cx: ext_ctxt, len: uint, at_least: bool, s: selector,
-                  b: binders) {
-    fn len_select(_cx: ext_ctxt, m: matchable, at_least: bool, len: uint) ->
-       match_result {
-        ret alt m {
-              match_expr(e) {
-                alt e.node {
-                  expr_vec(arg_elts, _) {
-                    let actual_len = vec::len(arg_elts);
-                    if at_least && actual_len >= len || actual_len == len {
-                        some(leaf(match_exact))
-                    } else { none }
-                  }
-                  _ { none }
-                }
-              }
-              _ { none }
-            }
-    }
-    b.literal_ast_matchers +=
-        [compose_sels(s, bind len_select(cx, _, at_least, len))];
-}
-
-fn p_t_s_r_actual_vector(cx: ext_ctxt, elts: [@expr], _repeat_after: bool,
-                         s: selector, b: binders) {
-    let idx: uint = 0u;
-    while idx < vec::len(elts) {
-        fn select(cx: ext_ctxt, m: matchable, idx: uint) -> match_result {
-            ret alt m {
-                  match_expr(e) {
-                    alt e.node {
-                      expr_vec(arg_elts, _) {
-                        some(leaf(match_expr(arg_elts[idx])))
-                      }
-                      _ { none }
-                    }
-                  }
-                  _ { cx.bug("broken traversal in p_t_s_r") }
-                }
-        }
-        p_t_s_rec(cx, match_expr(elts[idx]),
-                  compose_sels(s, bind select(cx, _, idx)), b);
-        idx += 1u;
-    }
-}
-
-fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
-                     _body: ast::mac_body) -> base::macro_def {
-    let arg = get_mac_arg(cx,sp,arg);
-    let args: [@ast::expr] =
-        alt arg.node {
-          ast::expr_vec(elts, _) { elts }
-          _ {
-            cx.span_fatal(sp,
-                          "#macro requires arguments of the form `[...]`.")
-          }
-        };
-
-    let macro_name: option<str> = none;
-    let clauses: [@clause] = [];
-    for arg: @expr in args {
-        alt arg.node {
-          expr_vec(elts, mutbl) {
-            if vec::len(elts) != 2u {
-                cx.span_fatal((*arg).span,
-                              "extension clause must consist of [" +
-                                  "macro invocation, expansion body]");
-            }
-
-
-            alt elts[0u].node {
-              expr_mac(mac) {
-                alt mac.node {
-                  mac_invoc(pth, invoc_arg, body) {
-                    alt path_to_ident(pth) {
-                      some(id) {
-                        alt macro_name {
-                          none { macro_name = some(id); }
-                          some(other_id) {
-                            if id != other_id {
-                                cx.span_fatal(pth.span,
-                                              "macro name must be " +
-                                                  "consistent");
-                            }
-                          }
-                        }
-                      }
-                      none {
-                        cx.span_fatal(pth.span,
-                                      "macro name must not be a path");
-                      }
-                    }
-                    clauses +=
-                        [@{params: pattern_to_selectors
-                               (cx, get_mac_arg(cx,mac.span,invoc_arg)),
-                           body: elts[1u]}];
-
-                    // FIXME: check duplicates (or just simplify
-                    // the macro arg situation)
-                  }
-                  _ {
-                      cx.span_bug(mac.span, "undocumented invariant in \
-                         add_extension");
-                  }
-                }
-              }
-              _ {
-                cx.span_fatal(elts[0u].span,
-                              "extension clause must" +
-                                  " start with a macro invocation.");
-              }
-            }
-          }
-          _ {
-            cx.span_fatal((*arg).span,
-                          "extension must be [clause, " + " ...]");
-          }
-        }
-    }
-
-    let ext = bind generic_extension(_, _, _, _, clauses);
-
-    ret {ident:
-             alt macro_name {
-               some(id) { id }
-               none {
-                 cx.span_fatal(sp,
-                               "macro definition must have " +
-                                   "at least one clause")
-               }
-             },
-         ext: normal({expander: ext, span: some(arg.span)})};
-
-    fn generic_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
-                         _body: ast::mac_body, clauses: [@clause]) -> @expr {
-        let arg = get_mac_arg(cx,sp,arg);
-        for c: @clause in clauses {
-            alt use_selectors_to_bind(c.params, arg) {
-              some(bindings) { ret transcribe(cx, bindings, c.body); }
-              none { cont; }
-            }
-        }
-        cx.span_fatal(sp, "no clauses match macro invocation");
-    }
-}
-
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs
deleted file mode 100644
index 7ceae548769..00000000000
--- a/src/comp/syntax/fold.rs
+++ /dev/null
@@ -1,761 +0,0 @@
-import syntax::codemap::span;
-import ast::*;
-
-export ast_fold_precursor;
-export ast_fold;
-export default_ast_fold;
-export make_fold;
-export noop_fold_crate;
-export noop_fold_item;
-export noop_fold_expr;
-export noop_fold_pat;
-export noop_fold_mod;
-export noop_fold_ty;
-export wrap;
-
-type ast_fold = @mutable a_f;
-
-// We may eventually want to be able to fold over type parameters, too
-
-type ast_fold_precursor =
-    //unlike the others, item_ is non-trivial
-    {fold_crate: fn@(crate_, span, ast_fold) -> (crate_, span),
-     fold_crate_directive: fn@(crate_directive_, span,
-                               ast_fold) -> (crate_directive_, span),
-     fold_view_item: fn@(view_item_, ast_fold) -> view_item_,
-     fold_native_item: fn@(&&@native_item, ast_fold) -> @native_item,
-     fold_item: fn@(&&@item, ast_fold) -> @item,
-     fold_class_item: fn@(&&@class_item, ast_fold) -> @class_item,
-     fold_item_underscore: fn@(item_, ast_fold) -> item_,
-     fold_method: fn@(&&@method, ast_fold) -> @method,
-     fold_block: fn@(blk_, span, ast_fold) -> (blk_, span),
-     fold_stmt: fn@(stmt_, span, ast_fold) -> (stmt_, span),
-     fold_arm: fn@(arm, ast_fold) -> arm,
-     fold_pat: fn@(pat_, span, ast_fold) -> (pat_, span),
-     fold_decl: fn@(decl_, span, ast_fold) -> (decl_, span),
-     fold_expr: fn@(expr_, span, ast_fold) -> (expr_, span),
-     fold_ty: fn@(ty_, span, ast_fold) -> (ty_, span),
-     fold_constr: fn@(ast::constr_, span, ast_fold) -> (constr_, span),
-     fold_mod: fn@(_mod, ast_fold) -> _mod,
-     fold_native_mod: fn@(native_mod, ast_fold) -> native_mod,
-     fold_variant: fn@(variant_, span, ast_fold) -> (variant_, span),
-     fold_ident: fn@(&&ident, ast_fold) -> ident,
-     fold_path: fn@(path_, span, ast_fold) -> (path_, span),
-     fold_local: fn@(local_, span, ast_fold) -> (local_, span),
-     map_exprs: fn@(fn@(&&@expr) -> @expr, [@expr]) -> [@expr],
-     new_id: fn@(node_id) -> node_id,
-     new_span: fn@(span) -> span};
-
-type a_f =
-    {fold_crate: fn@(crate) -> crate,
-     fold_crate_directive: fn@(&&@crate_directive) -> @crate_directive,
-     fold_view_item: fn@(&&@view_item) -> @view_item,
-     fold_native_item: fn@(&&@native_item) -> @native_item,
-     fold_item: fn@(&&@item) -> @item,
-     fold_class_item: fn@(&&@class_item) -> @class_item,
-     fold_item_underscore: fn@(item_) -> item_,
-     fold_method: fn@(&&@method) -> @method,
-     fold_block: fn@(blk) -> blk,
-     fold_stmt: fn@(&&@stmt) -> @stmt,
-     fold_arm: fn@(arm) -> arm,
-     fold_pat: fn@(&&@pat) -> @pat,
-     fold_decl: fn@(&&@decl) -> @decl,
-     fold_expr: fn@(&&@expr) -> @expr,
-     fold_ty: fn@(&&@ty) -> @ty,
-     fold_constr: fn@(&&@constr) -> @constr,
-     fold_mod: fn@(_mod) -> _mod,
-     fold_native_mod: fn@(native_mod) -> native_mod,
-     fold_variant: fn@(variant) -> variant,
-     fold_ident: fn@(&&ident) -> ident,
-     fold_path: fn@(&&@path) -> @path,
-     fold_local: fn@(&&@local) -> @local,
-     map_exprs: fn@(fn@(&&@expr) -> @expr, [@expr]) -> [@expr],
-     new_id: fn@(node_id) -> node_id,
-     new_span: fn@(span) -> span};
-
-
-//fn nf_dummy<T>(&T node) -> T { fail; }
-fn nf_crate_dummy(_c: crate) -> crate { fail; }
-fn nf_crate_directive_dummy(&&_c: @crate_directive) -> @crate_directive {
-    fail;
-}
-fn nf_view_item_dummy(&&_v: @view_item) -> @view_item { fail; }
-fn nf_native_item_dummy(&&_n: @native_item) -> @native_item { fail; }
-fn nf_item_dummy(&&_i: @item) -> @item { fail; }
-fn nf_class_item_dummy(&&_ci: @class_item) -> @class_item { fail; }
-fn nf_item_underscore_dummy(_i: item_) -> item_ { fail; }
-fn nf_method_dummy(&&_m: @method) -> @method { fail; }
-fn nf_blk_dummy(_b: blk) -> blk { fail; }
-fn nf_stmt_dummy(&&_s: @stmt) -> @stmt { fail; }
-fn nf_arm_dummy(_a: arm) -> arm { fail; }
-fn nf_pat_dummy(&&_p: @pat) -> @pat { fail; }
-fn nf_decl_dummy(&&_d: @decl) -> @decl { fail; }
-fn nf_expr_dummy(&&_e: @expr) -> @expr { fail; }
-fn nf_ty_dummy(&&_t: @ty) -> @ty { fail; }
-fn nf_constr_dummy(&&_c: @constr) -> @constr { fail; }
-fn nf_mod_dummy(_m: _mod) -> _mod { fail; }
-fn nf_native_mod_dummy(_n: native_mod) -> native_mod { fail; }
-fn nf_variant_dummy(_v: variant) -> variant { fail; }
-fn nf_ident_dummy(&&_i: ident) -> ident { fail; }
-fn nf_path_dummy(&&_p: @path) -> @path { fail; }
-fn nf_local_dummy(&&_o: @local) -> @local { fail; }
-
-/* some little folds that probably aren't useful to have in ast_fold itself*/
-
-//used in noop_fold_item and noop_fold_crate and noop_fold_crate_directive
-fn fold_meta_item_(&&mi: @meta_item, fld: ast_fold) -> @meta_item {
-    ret @{node:
-              alt mi.node {
-                meta_word(id) { meta_word(fld.fold_ident(id)) }
-                meta_list(id, mis) {
-                  let fold_meta_item = bind fold_meta_item_(_, fld);
-                  meta_list(id, vec::map(mis, fold_meta_item))
-                }
-                meta_name_value(id, s) {
-                  meta_name_value(fld.fold_ident(id), s)
-                }
-              },
-          span: mi.span};
-}
-//used in noop_fold_item and noop_fold_crate
-fn fold_attribute_(at: attribute, fmi: fn@(&&@meta_item) -> @meta_item) ->
-   attribute {
-    ret {node: {style: at.node.style, value: *fmi(@at.node.value)},
-         span: at.span};
-}
-//used in noop_fold_native_item and noop_fold_fn_decl
-fn fold_arg_(a: arg, fld: ast_fold) -> arg {
-    ret {mode: a.mode,
-         ty: fld.fold_ty(a.ty),
-         ident: fld.fold_ident(a.ident),
-         id: fld.new_id(a.id)};
-}
-//used in noop_fold_expr, and possibly elsewhere in the future
-fn fold_mac_(m: mac, fld: ast_fold) -> mac {
-    ret {node:
-             alt m.node {
-               mac_invoc(pth, arg, body) {
-                 mac_invoc(fld.fold_path(pth),
-                           // FIXME: bind should work, but causes a crash
-                           option::map(arg) {|arg| fld.fold_expr(arg)},
-                           body)
-               }
-               mac_embed_type(ty) { mac_embed_type(fld.fold_ty(ty)) }
-               mac_embed_block(blk) { mac_embed_block(fld.fold_block(blk)) }
-               mac_ellipsis { mac_ellipsis }
-               mac_aq(_,_) { /* fixme */ m.node }
-               mac_var(_) { /* fixme */ m.node }
-             },
-         span: m.span};
-}
-
-fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl {
-    ret {inputs: vec::map(decl.inputs, bind fold_arg_(_, fld)),
-         output: fld.fold_ty(decl.output),
-         purity: decl.purity,
-         cf: decl.cf,
-         constraints: vec::map(decl.constraints, fld.fold_constr)}
-}
-
-fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound {
-    alt tpb {
-      bound_copy | bound_send { tpb }
-      bound_iface(ty) { bound_iface(fld.fold_ty(ty)) }
-    }
-}
-
-fn fold_ty_param(tp: ty_param, fld: ast_fold) -> ty_param {
-    {ident: tp.ident,
-     id: fld.new_id(tp.id),
-     bounds: @vec::map(*tp.bounds, fold_ty_param_bound(_, fld))}
-}
-
-fn fold_ty_params(tps: [ty_param], fld: ast_fold) -> [ty_param] {
-    vec::map(tps, fold_ty_param(_, fld))
-}
-
-fn noop_fold_crate(c: crate_, fld: ast_fold) -> crate_ {
-    let fold_meta_item = bind fold_meta_item_(_, fld);
-    let fold_attribute = bind fold_attribute_(_, fold_meta_item);
-
-    ret {directives: vec::map(c.directives, fld.fold_crate_directive),
-         module: fld.fold_mod(c.module),
-         attrs: vec::map(c.attrs, fold_attribute),
-         config: vec::map(c.config, fold_meta_item)};
-}
-
-fn noop_fold_crate_directive(cd: crate_directive_, fld: ast_fold) ->
-   crate_directive_ {
-    ret alt cd {
-          cdir_src_mod(id, attrs) {
-            cdir_src_mod(fld.fold_ident(id), attrs)
-          }
-          cdir_dir_mod(id, cds, attrs) {
-            cdir_dir_mod(fld.fold_ident(id),
-                         vec::map(cds, fld.fold_crate_directive), attrs)
-          }
-          cdir_view_item(vi) { cdir_view_item(fld.fold_view_item(vi)) }
-          cdir_syntax(_) { cd }
-        }
-}
-
-fn noop_fold_view_item(vi: view_item_, _fld: ast_fold) -> view_item_ {
-    ret vi;
-}
-
-
-fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item {
-    let fold_arg = bind fold_arg_(_, fld);
-    let fold_meta_item = bind fold_meta_item_(_, fld);
-    let fold_attribute = bind fold_attribute_(_, fold_meta_item);
-
-    ret @{ident: fld.fold_ident(ni.ident),
-          attrs: vec::map(ni.attrs, fold_attribute),
-          node:
-              alt ni.node {
-                native_item_fn(fdec, typms) {
-                  native_item_fn({inputs: vec::map(fdec.inputs, fold_arg),
-                                  output: fld.fold_ty(fdec.output),
-                                  purity: fdec.purity,
-                                  cf: fdec.cf,
-                                  constraints:
-                                      vec::map(fdec.constraints,
-                                               fld.fold_constr)},
-                                 fold_ty_params(typms, fld))
-                }
-              },
-          id: fld.new_id(ni.id),
-          span: fld.new_span(ni.span)};
-}
-
-fn noop_fold_item(&&i: @item, fld: ast_fold) -> @item {
-    let fold_meta_item = bind fold_meta_item_(_, fld);
-    let fold_attribute = bind fold_attribute_(_, fold_meta_item);
-
-    ret @{ident: fld.fold_ident(i.ident),
-          attrs: vec::map(i.attrs, fold_attribute),
-          id: fld.new_id(i.id),
-          node: fld.fold_item_underscore(i.node),
-          span: fld.new_span(i.span)};
-}
-
-fn noop_fold_class_item(&&ci: @class_item, fld: ast_fold)
-    -> @class_item {
-    @{node: {
-      privacy:ci.node.privacy,
-            decl:
-      alt ci.node.decl {
-        instance_var(ident, t, cm, id) {
-            instance_var(ident, fld.fold_ty(t), cm, id)
-        }
-        class_method(i) { class_method(fld.fold_item(i)) }
-         }},
-       span: ci.span}
-}
-
-fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
-    ret alt i {
-          item_const(t, e) { item_const(fld.fold_ty(t), fld.fold_expr(e)) }
-          item_fn(decl, typms, body) {
-              item_fn(fold_fn_decl(decl, fld),
-                      fold_ty_params(typms, fld),
-                      fld.fold_block(body))
-          }
-          item_mod(m) { item_mod(fld.fold_mod(m)) }
-          item_native_mod(nm) { item_native_mod(fld.fold_native_mod(nm)) }
-          item_ty(t, typms) { item_ty(fld.fold_ty(t),
-                                      fold_ty_params(typms, fld)) }
-          item_enum(variants, typms) {
-            item_enum(vec::map(variants, fld.fold_variant),
-                      fold_ty_params(typms, fld))
-          }
-          item_class(typms, items, id, ctor_decl, ctor_body) {
-              item_class(fold_ty_params(typms, fld),
-                         vec::map(items, fld.fold_class_item),
-                         id,
-                         fold_fn_decl(ctor_decl, fld),
-                         fld.fold_block(ctor_body))
-          }
-          item_impl(tps, ifce, ty, methods) {
-            item_impl(tps, option::map(ifce, fld.fold_ty), fld.fold_ty(ty),
-                      vec::map(methods, fld.fold_method))
-          }
-          item_iface(tps, methods) { item_iface(tps, methods) }
-          item_res(decl, typms, body, did, cid) {
-            item_res(fold_fn_decl(decl, fld),
-                     fold_ty_params(typms, fld),
-                     fld.fold_block(body),
-                     did,
-                     cid)
-          }
-        };
-}
-
-fn noop_fold_method(&&m: @method, fld: ast_fold) -> @method {
-    ret @{ident: fld.fold_ident(m.ident),
-          attrs: m.attrs,
-          tps: fold_ty_params(m.tps, fld),
-          decl: fold_fn_decl(m.decl, fld),
-          body: fld.fold_block(m.body),
-          id: fld.new_id(m.id),
-          span: fld.new_span(m.span)};
-}
-
-
-fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
-    ret {view_items: vec::map(b.view_items, fld.fold_view_item),
-         stmts: vec::map(b.stmts, fld.fold_stmt),
-         expr: option::map(b.expr, fld.fold_expr),
-         id: fld.new_id(b.id),
-         rules: b.rules};
-}
-
-fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {
-    ret alt s {
-      stmt_decl(d, nid) { stmt_decl(fld.fold_decl(d), fld.new_id(nid)) }
-      stmt_expr(e, nid) { stmt_expr(fld.fold_expr(e), fld.new_id(nid)) }
-      stmt_semi(e, nid) { stmt_semi(fld.fold_expr(e), fld.new_id(nid)) }
-    };
-}
-
-fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {
-    ret {pats: vec::map(a.pats, fld.fold_pat),
-         guard: option::map(a.guard, fld.fold_expr),
-         body: fld.fold_block(a.body)};
-}
-
-fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
-    ret alt p {
-          pat_wild { p }
-          pat_ident(pth, sub) {
-            pat_ident(fld.fold_path(pth), option::map(sub, fld.fold_pat))
-          }
-          pat_lit(_) { p }
-          pat_enum(pth, pats) {
-            pat_enum(fld.fold_path(pth), vec::map(pats, fld.fold_pat))
-          }
-          pat_rec(fields, etc) {
-            let fs = [];
-            for f: ast::field_pat in fields {
-                fs += [{ident: f.ident, pat: fld.fold_pat(f.pat)}];
-            }
-            pat_rec(fs, etc)
-          }
-          pat_tup(elts) { pat_tup(vec::map(elts, fld.fold_pat)) }
-          pat_box(inner) { pat_box(fld.fold_pat(inner)) }
-          pat_uniq(inner) { pat_uniq(fld.fold_pat(inner)) }
-          pat_range(_, _) { p }
-        };
-}
-
-fn noop_fold_decl(d: decl_, fld: ast_fold) -> decl_ {
-    alt d {
-      decl_local(ls) { decl_local(vec::map(ls, fld.fold_local)) }
-      decl_item(it) { decl_item(fld.fold_item(it)) }
-    }
-}
-
-fn wrap<T>(f: fn@(T, ast_fold) -> T)
-    -> fn@(T, span, ast_fold) -> (T, span)
-{
-    ret fn@(x: T, s: span, fld: ast_fold) -> (T, span) {
-        (f(x, fld), s)
-    }
-}
-
-fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
-    fn fold_field_(field: field, fld: ast_fold) -> field {
-        ret {node:
-                 {mutbl: field.node.mutbl,
-                  ident: fld.fold_ident(field.node.ident),
-                  expr: fld.fold_expr(field.node.expr)},
-             span: field.span};
-    }
-    let fold_field = bind fold_field_(_, fld);
-
-    let fold_mac = bind fold_mac_(_, fld);
-
-    ret alt e {
-            expr_vec(exprs, mutt) {
-            expr_vec(fld.map_exprs(fld.fold_expr, exprs), mutt)
-          }
-          expr_rec(fields, maybe_expr) {
-            expr_rec(vec::map(fields, fold_field),
-                     option::map(maybe_expr, fld.fold_expr))
-          }
-          expr_tup(elts) { expr_tup(vec::map(elts, fld.fold_expr)) }
-          expr_call(f, args, blk) {
-            expr_call(fld.fold_expr(f), fld.map_exprs(fld.fold_expr, args),
-                      blk)
-          }
-          expr_bind(f, args) {
-            let opt_map_se = bind option::map(_, fld.fold_expr);
-            expr_bind(fld.fold_expr(f), vec::map(args, opt_map_se))
-          }
-          expr_binary(binop, lhs, rhs) {
-            expr_binary(binop, fld.fold_expr(lhs), fld.fold_expr(rhs))
-          }
-          expr_unary(binop, ohs) { expr_unary(binop, fld.fold_expr(ohs)) }
-          expr_lit(_) { e }
-          expr_cast(expr, ty) { expr_cast(fld.fold_expr(expr), ty) }
-          expr_if(cond, tr, fl) {
-            expr_if(fld.fold_expr(cond), fld.fold_block(tr),
-                    option::map(fl, fld.fold_expr))
-          }
-          expr_while(cond, body) {
-            expr_while(fld.fold_expr(cond), fld.fold_block(body))
-          }
-          expr_for(decl, expr, blk) {
-            expr_for(fld.fold_local(decl), fld.fold_expr(expr),
-                     fld.fold_block(blk))
-          }
-          expr_do_while(blk, expr) {
-            expr_do_while(fld.fold_block(blk), fld.fold_expr(expr))
-          }
-          expr_alt(expr, arms, mode) {
-            expr_alt(fld.fold_expr(expr), vec::map(arms, fld.fold_arm), mode)
-          }
-          expr_fn(proto, decl, body, captures) {
-              expr_fn(proto, fold_fn_decl(decl, fld),
-                      fld.fold_block(body), captures)
-          }
-          expr_fn_block(decl, body) {
-            expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body))
-          }
-          expr_block(blk) { expr_block(fld.fold_block(blk)) }
-          expr_move(el, er) {
-            expr_move(fld.fold_expr(el), fld.fold_expr(er))
-          }
-          expr_copy(e) { expr_copy(fld.fold_expr(e)) }
-          expr_assign(el, er) {
-            expr_assign(fld.fold_expr(el), fld.fold_expr(er))
-          }
-          expr_swap(el, er) {
-            expr_swap(fld.fold_expr(el), fld.fold_expr(er))
-          }
-          expr_assign_op(op, el, er) {
-            expr_assign_op(op, fld.fold_expr(el), fld.fold_expr(er))
-          }
-          expr_field(el, id, tys) {
-            expr_field(fld.fold_expr(el), fld.fold_ident(id),
-                       vec::map(tys, fld.fold_ty))
-          }
-          expr_index(el, er) {
-            expr_index(fld.fold_expr(el), fld.fold_expr(er))
-          }
-          expr_path(pth) { expr_path(fld.fold_path(pth)) }
-          expr_fail(e) { expr_fail(option::map(e, fld.fold_expr)) }
-          expr_break | expr_cont { e }
-          expr_ret(e) { expr_ret(option::map(e, fld.fold_expr)) }
-          expr_be(e) { expr_be(fld.fold_expr(e)) }
-          expr_log(i, lv, e) { expr_log(i, fld.fold_expr(lv),
-                                        fld.fold_expr(e)) }
-          expr_assert(e) { expr_assert(fld.fold_expr(e)) }
-          expr_check(m, e) { expr_check(m, fld.fold_expr(e)) }
-          expr_if_check(cond, tr, fl) {
-            expr_if_check(fld.fold_expr(cond), fld.fold_block(tr),
-                          option::map(fl, fld.fold_expr))
-          }
-          expr_mac(mac) { expr_mac(fold_mac(mac)) }
-        }
-}
-
-fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
-    let fold_mac = bind fold_mac_(_, fld);
-    fn fold_mt(mt: mt, fld: ast_fold) -> mt {
-        {ty: fld.fold_ty(mt.ty), mutbl: mt.mutbl}
-    }
-    fn fold_field(f: ty_field, fld: ast_fold) -> ty_field {
-        {node: {ident: fld.fold_ident(f.node.ident),
-                mt: fold_mt(f.node.mt, fld)},
-         span: fld.new_span(f.span)}
-    }
-    alt t {
-      ty_nil | ty_bot {t}
-      ty_box(mt) {ty_box(fold_mt(mt, fld))}
-      ty_uniq(mt) {ty_uniq(fold_mt(mt, fld))}
-      ty_vec(mt) {ty_vec(fold_mt(mt, fld))}
-      ty_ptr(mt) {ty_ptr(fold_mt(mt, fld))}
-      ty_rec(fields) {ty_rec(vec::map(fields) {|f| fold_field(f, fld)})}
-      ty_fn(proto, decl) {ty_fn(proto, fold_fn_decl(decl, fld))}
-      ty_tup(tys) {ty_tup(vec::map(tys) {|ty| fld.fold_ty(ty)})}
-      ty_path(path, id) {ty_path(fld.fold_path(path), fld.new_id(id))}
-      // FIXME: constrs likely needs to be folded...
-      ty_constr(ty, constrs) {ty_constr(fld.fold_ty(ty), constrs)}
-      ty_mac(mac) {ty_mac(fold_mac(mac))}
-      ty_infer {t}
-    }
-}
-
-fn noop_fold_constr(c: constr_, fld: ast_fold) -> constr_ {
-    {path: fld.fold_path(c.path), args: c.args, id: fld.new_id(c.id)}
-}
-
-// ...nor do modules
-fn noop_fold_mod(m: _mod, fld: ast_fold) -> _mod {
-    ret {view_items: vec::map(m.view_items, fld.fold_view_item),
-         items: vec::map(m.items, fld.fold_item)};
-}
-
-fn noop_fold_native_mod(nm: native_mod, fld: ast_fold) -> native_mod {
-    ret {view_items: vec::map(nm.view_items, fld.fold_view_item),
-         items: vec::map(nm.items, fld.fold_native_item)}
-}
-
-fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
-    fn fold_variant_arg_(va: variant_arg, fld: ast_fold) -> variant_arg {
-        ret {ty: fld.fold_ty(va.ty), id: fld.new_id(va.id)};
-    }
-    let fold_variant_arg = bind fold_variant_arg_(_, fld);
-    let args = vec::map(v.args, fold_variant_arg);
-
-    let fold_meta_item = bind fold_meta_item_(_, fld);
-    let fold_attribute = bind fold_attribute_(_, fold_meta_item);
-    let attrs = vec::map(v.attrs, fold_attribute);
-
-    let de = alt v.disr_expr {
-      some(e) {some(fld.fold_expr(e))}
-      none {none}
-    };
-    ret {name: v.name,
-         attrs: attrs,
-         args: args, id: fld.new_id(v.id),
-         disr_expr: de};
-}
-
-fn noop_fold_ident(&&i: ident, _fld: ast_fold) -> ident { ret i; }
-
-fn noop_fold_path(&&p: path_, fld: ast_fold) -> path_ {
-    ret {global: p.global,
-         idents: vec::map(p.idents, fld.fold_ident),
-         types: vec::map(p.types, fld.fold_ty)};
-}
-
-fn noop_fold_local(l: local_, fld: ast_fold) -> local_ {
-    ret {is_mutbl: l.is_mutbl,
-         ty: fld.fold_ty(l.ty),
-         pat: fld.fold_pat(l.pat),
-         init:
-             alt l.init {
-               option::none::<initializer> { l.init }
-               option::some::<initializer>(init) {
-                 option::some::<initializer>({op: init.op,
-                                              expr: fld.fold_expr(init.expr)})
-               }
-             },
-         id: fld.new_id(l.id)};
-}
-
-/* temporarily eta-expand because of a compiler bug with using `fn<T>` as a
-   value */
-fn noop_map_exprs(f: fn@(&&@expr) -> @expr, es: [@expr]) -> [@expr] {
-    ret vec::map(es, f);
-}
-
-fn noop_id(i: node_id) -> node_id { ret i; }
-
-fn noop_span(sp: span) -> span { ret sp; }
-
-
-fn default_ast_fold() -> @ast_fold_precursor {
-    ret @{fold_crate: wrap(noop_fold_crate),
-          fold_crate_directive: wrap(noop_fold_crate_directive),
-          fold_view_item: noop_fold_view_item,
-          fold_native_item: noop_fold_native_item,
-          fold_item: noop_fold_item,
-          fold_class_item: noop_fold_class_item,
-          fold_item_underscore: noop_fold_item_underscore,
-          fold_method: noop_fold_method,
-          fold_block: wrap(noop_fold_block),
-          fold_stmt: wrap(noop_fold_stmt),
-          fold_arm: noop_fold_arm,
-          fold_pat: wrap(noop_fold_pat),
-          fold_decl: wrap(noop_fold_decl),
-          fold_expr: wrap(noop_fold_expr),
-          fold_ty: wrap(noop_fold_ty),
-          fold_constr: wrap(noop_fold_constr),
-          fold_mod: noop_fold_mod,
-          fold_native_mod: noop_fold_native_mod,
-          fold_variant: wrap(noop_fold_variant),
-          fold_ident: noop_fold_ident,
-          fold_path: wrap(noop_fold_path),
-          fold_local: wrap(noop_fold_local),
-          map_exprs: noop_map_exprs,
-          new_id: noop_id,
-          new_span: noop_span};
-}
-
-fn make_fold(afp: ast_fold_precursor) -> ast_fold {
-    // FIXME: Have to bind all the bare functions into shared functions
-    // because @mutable is invariant with respect to its contents
-    let result: ast_fold =
-        @mutable {fold_crate: bind nf_crate_dummy(_),
-                  fold_crate_directive: bind nf_crate_directive_dummy(_),
-                  fold_view_item: bind nf_view_item_dummy(_),
-                  fold_native_item: bind nf_native_item_dummy(_),
-                  fold_item: bind nf_item_dummy(_),
-                  fold_class_item: bind nf_class_item_dummy(_),
-                  fold_item_underscore: bind nf_item_underscore_dummy(_),
-                  fold_method: bind nf_method_dummy(_),
-                  fold_block: bind nf_blk_dummy(_),
-                  fold_stmt: bind nf_stmt_dummy(_),
-                  fold_arm: bind nf_arm_dummy(_),
-                  fold_pat: bind nf_pat_dummy(_),
-                  fold_decl: bind nf_decl_dummy(_),
-                  fold_expr: bind nf_expr_dummy(_),
-                  fold_ty: bind nf_ty_dummy(_),
-                  fold_constr: bind nf_constr_dummy(_),
-                  fold_mod: bind nf_mod_dummy(_),
-                  fold_native_mod: bind nf_native_mod_dummy(_),
-                  fold_variant: bind nf_variant_dummy(_),
-                  fold_ident: bind nf_ident_dummy(_),
-                  fold_path: bind nf_path_dummy(_),
-                  fold_local: bind nf_local_dummy(_),
-                  map_exprs: bind noop_map_exprs(_, _),
-                  new_id: bind noop_id(_),
-                  new_span: bind noop_span(_)};
-
-    /* naturally, a macro to write these would be nice */
-    fn f_crate(afp: ast_fold_precursor, f: ast_fold, c: crate) -> crate {
-        let (n, s) = afp.fold_crate(c.node, c.span, f);
-        ret {node: n, span: afp.new_span(s)};
-    }
-    fn f_crate_directive(afp: ast_fold_precursor, f: ast_fold,
-                         &&c: @crate_directive) -> @crate_directive {
-        let (n, s) = afp.fold_crate_directive(c.node, c.span, f);
-        ret @{node: n,
-              span: afp.new_span(s)};
-    }
-    fn f_view_item(afp: ast_fold_precursor, f: ast_fold, &&x: @view_item) ->
-       @view_item {
-        ret @{node: afp.fold_view_item(x.node, f),
-              span: afp.new_span(x.span)};
-    }
-    fn f_native_item(afp: ast_fold_precursor, f: ast_fold, &&x: @native_item)
-        -> @native_item {
-        ret afp.fold_native_item(x, f);
-    }
-    fn f_item(afp: ast_fold_precursor, f: ast_fold, &&i: @item) -> @item {
-        ret afp.fold_item(i, f);
-    }
-    fn f_class_item(afp: ast_fold_precursor, f: ast_fold,
-                      &&ci: @class_item) -> @class_item {
-        @{node:
-         {privacy:ci.node.privacy,
-               decl:
-         alt ci.node.decl {
-           instance_var(nm, t, mt, id) {
-               instance_var(nm, f_ty(afp, f, t),
-                                 mt, id)
-           }
-           class_method(i) {
-               class_method(afp.fold_item(i, f))
-           }
-            }}, span: afp.new_span(ci.span)}
-    }
-    fn f_item_underscore(afp: ast_fold_precursor, f: ast_fold, i: item_) ->
-       item_ {
-        ret afp.fold_item_underscore(i, f);
-    }
-    fn f_method(afp: ast_fold_precursor, f: ast_fold, &&x: @method)
-        -> @method {
-        ret afp.fold_method(x, f);
-    }
-    fn f_block(afp: ast_fold_precursor, f: ast_fold, x: blk) -> blk {
-        let (n, s) = afp.fold_block(x.node, x.span, f);
-        ret {node: n, span: afp.new_span(s)};
-    }
-    fn f_stmt(afp: ast_fold_precursor, f: ast_fold, &&x: @stmt) -> @stmt {
-        let (n, s) = afp.fold_stmt(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-    fn f_arm(afp: ast_fold_precursor, f: ast_fold, x: arm) -> arm {
-        ret afp.fold_arm(x, f);
-    }
-    fn f_pat(afp: ast_fold_precursor, f: ast_fold, &&x: @pat) -> @pat {
-        let (n, s) =  afp.fold_pat(x.node, x.span, f);
-        ret @{id: afp.new_id(x.id),
-              node: n,
-              span: afp.new_span(s)};
-    }
-    fn f_decl(afp: ast_fold_precursor, f: ast_fold, &&x: @decl) -> @decl {
-        let (n, s) = afp.fold_decl(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-    fn f_expr(afp: ast_fold_precursor, f: ast_fold, &&x: @expr) -> @expr {
-        let (n, s) = afp.fold_expr(x.node, x.span, f);
-        ret @{id: afp.new_id(x.id),
-              node: n,
-              span: afp.new_span(s)};
-    }
-    fn f_ty(afp: ast_fold_precursor, f: ast_fold, &&x: @ty) -> @ty {
-        let (n, s) = afp.fold_ty(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-    fn f_constr(afp: ast_fold_precursor, f: ast_fold, &&x: @ast::constr) ->
-       @ast::constr {
-        let (n, s) = afp.fold_constr(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-    fn f_mod(afp: ast_fold_precursor, f: ast_fold, x: _mod) -> _mod {
-        ret afp.fold_mod(x, f);
-    }
-    fn f_native_mod(afp: ast_fold_precursor, f: ast_fold, x: native_mod) ->
-       native_mod {
-        ret afp.fold_native_mod(x, f);
-    }
-    fn f_variant(afp: ast_fold_precursor, f: ast_fold, x: variant) ->
-       variant {
-        let (n, s) = afp.fold_variant(x.node, x.span, f);
-        ret {node: n, span: afp.new_span(s)};
-    }
-    fn f_ident(afp: ast_fold_precursor, f: ast_fold, &&x: ident) -> ident {
-        ret afp.fold_ident(x, f);
-    }
-    fn f_path(afp: ast_fold_precursor, f: ast_fold, &&x: @path) -> @path {
-        let (n, s) = afp.fold_path(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-    fn f_local(afp: ast_fold_precursor, f: ast_fold, &&x: @local) -> @local {
-        let (n, s) = afp.fold_local(x.node, x.span, f);
-        ret @{node: n, span: afp.new_span(s)};
-    }
-
-    *result =
-        {fold_crate: bind f_crate(afp, result, _),
-         fold_crate_directive: bind f_crate_directive(afp, result, _),
-         fold_view_item: bind f_view_item(afp, result, _),
-         fold_native_item: bind f_native_item(afp, result, _),
-         fold_item: bind f_item(afp, result, _),
-         fold_class_item: bind f_class_item(afp, result, _),
-         fold_item_underscore: bind f_item_underscore(afp, result, _),
-         fold_method: bind f_method(afp, result, _),
-         fold_block: bind f_block(afp, result, _),
-         fold_stmt: bind f_stmt(afp, result, _),
-         fold_arm: bind f_arm(afp, result, _),
-         fold_pat: bind f_pat(afp, result, _),
-         fold_decl: bind f_decl(afp, result, _),
-         fold_expr: bind f_expr(afp, result, _),
-         fold_ty: bind f_ty(afp, result, _),
-         fold_constr: bind f_constr(afp, result, _),
-         fold_mod: bind f_mod(afp, result, _),
-         fold_native_mod: bind f_native_mod(afp, result, _),
-         fold_variant: bind f_variant(afp, result, _),
-         fold_ident: bind f_ident(afp, result, _),
-         fold_path: bind f_path(afp, result, _),
-         fold_local: bind f_local(afp, result, _),
-         map_exprs: afp.map_exprs,
-         new_id: afp.new_id,
-         new_span: afp.new_span};
-    ret result;
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs
deleted file mode 100644
index 06f26905550..00000000000
--- a/src/comp/syntax/parse/eval.rs
+++ /dev/null
@@ -1,150 +0,0 @@
-
-import front::attr;
-import std::{io, fs};
-import syntax::ast;
-import syntax::parse::token;
-import syntax::parse::parser::{parser, new_parser_from_file,
-                               parse_inner_attrs_and_next,
-                               parse_mod_items, SOURCE_FILE};
-
-export eval_crate_directives_to_mod;
-
-type ctx =
-    @{p: parser,
-      sess: parser::parse_sess,
-      cfg: ast::crate_cfg};
-
-fn eval_crate_directives(cx: ctx, cdirs: [@ast::crate_directive], prefix: str,
-                         &view_items: [@ast::view_item],
-                         &items: [@ast::item]) {
-    for sub_cdir: @ast::crate_directive in cdirs {
-        eval_crate_directive(cx, sub_cdir, prefix, view_items, items);
-    }
-}
-
-fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive],
-                                prefix: str, suffix: option<str>)
-    -> (ast::_mod, [ast::attribute]) {
-    #debug("eval crate prefix: %s", prefix);
-    #debug("eval crate suffix: %s",
-           option::from_maybe("none", suffix));
-    let (cview_items, citems, cattrs)
-        = parse_companion_mod(cx, prefix, suffix);
-    let view_items: [@ast::view_item] = [];
-    let items: [@ast::item] = [];
-    eval_crate_directives(cx, cdirs, prefix, view_items, items);
-    ret ({view_items: view_items + cview_items,
-          items: items + citems},
-         cattrs);
-}
-
-/*
-The 'companion mod'. So .rc crates and directory mod crate directives define
-modules but not a .rs file to fill those mods with stuff. The companion mod is
-a convention for location a .rs file to go with them.  For .rc files the
-companion mod is a .rs file with the same name; for directory mods the
-companion mod is a .rs file with the same name as the directory.
-
-We build the path to the companion mod by combining the prefix and the
-optional suffix then adding the .rs extension.
-*/
-fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>)
-    -> ([@ast::view_item], [@ast::item], [ast::attribute]) {
-
-    fn companion_file(prefix: str, suffix: option<str>) -> str {
-        ret alt suffix {
-          option::some(s) { fs::connect(prefix, s) }
-          option::none { prefix }
-        } + ".rs";
-    }
-
-    fn file_exists(path: str) -> bool {
-        // Crude, but there's no lib function for this and I'm not
-        // up to writing it just now
-        alt io::file_reader(path) {
-          result::ok(_) { true }
-          result::err(_) { false }
-        }
-    }
-
-    let modpath = companion_file(prefix, suffix);
-    #debug("looking for companion mod %s", modpath);
-    if file_exists(modpath) {
-        #debug("found companion mod");
-        let p0 = new_parser_from_file(cx.sess, cx.cfg, modpath,
-                                     SOURCE_FILE);
-        let inner_attrs = parse_inner_attrs_and_next(p0);
-        let first_item_outer_attrs = inner_attrs.next;
-        let m0 = parse_mod_items(p0, token::EOF, first_item_outer_attrs);
-        cx.sess.chpos = p0.reader.chpos;
-        cx.sess.byte_pos = cx.sess.byte_pos + p0.reader.pos;
-        ret (m0.view_items, m0.items, inner_attrs.inner);
-    } else {
-        ret ([], [], []);
-    }
-}
-
-fn cdir_path_opt(id: str, attrs: [ast::attribute]) -> str {
-    alt attr::get_meta_item_value_str_by_name(attrs, "path") {
-      some(d) {
-        ret d;
-      }
-      none { ret id; }
-    }
-}
-
-fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str,
-                        &view_items: [@ast::view_item],
-                        &items: [@ast::item]) {
-    alt cdir.node {
-      ast::cdir_src_mod(id, attrs) {
-        let file_path = cdir_path_opt(id + ".rs", attrs);
-        let full_path =
-            if std::fs::path_is_absolute(file_path) {
-                file_path
-            } else { prefix + std::fs::path_sep() + file_path };
-        let p0 =
-            new_parser_from_file(cx.sess, cx.cfg, full_path, SOURCE_FILE);
-        let inner_attrs = parse_inner_attrs_and_next(p0);
-        let mod_attrs = attrs + inner_attrs.inner;
-        let first_item_outer_attrs = inner_attrs.next;
-        let m0 = parse_mod_items(p0, token::EOF, first_item_outer_attrs);
-
-        let i =
-            syntax::parse::parser::mk_item(p0, cdir.span.lo, cdir.span.hi, id,
-                                           ast::item_mod(m0), mod_attrs);
-        // Thread defids, chpos and byte_pos through the parsers
-        cx.sess.chpos = p0.reader.chpos;
-        cx.sess.byte_pos = cx.sess.byte_pos + p0.reader.pos;
-        items += [i];
-      }
-      ast::cdir_dir_mod(id, cdirs, attrs) {
-        let path = cdir_path_opt(id, attrs);
-        let full_path =
-            if std::fs::path_is_absolute(path) {
-                path
-            } else { prefix + std::fs::path_sep() + path };
-        let (m0, a0) = eval_crate_directives_to_mod(
-            cx, cdirs, full_path, none);
-        let i =
-            @{ident: id,
-              attrs: attrs + a0,
-              id: cx.sess.next_id,
-              node: ast::item_mod(m0),
-              span: cdir.span};
-        cx.sess.next_id += 1;
-        items += [i];
-      }
-      ast::cdir_view_item(vi) { view_items += [vi]; }
-      ast::cdir_syntax(pth) { }
-    }
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
deleted file mode 100644
index 3350d7a7c95..00000000000
--- a/src/comp/syntax/parse/lexer.rs
+++ /dev/null
@@ -1,748 +0,0 @@
-
-import std::io;
-import io::reader_util;
-import util::interner;
-import util::interner::intern;
-import driver::diagnostic;
-
-type reader = @{
-    cm: codemap::codemap,
-    span_diagnostic: diagnostic::span_handler,
-    src: @str,
-    len: uint,
-    mutable col: uint,
-    mutable pos: uint,
-    mutable curr: char,
-    mutable chpos: uint,
-    mutable strs: [str],
-    filemap: codemap::filemap,
-    interner: @interner::interner<str>
-};
-
-impl reader for reader {
-    fn is_eof() -> bool { self.curr == -1 as char }
-    fn get_str_from(start: uint) -> str unsafe {
-        // I'm pretty skeptical about this subtraction. What if there's a
-        // multi-byte character before the mark?
-        ret str::slice(*self.src, start - 1u, self.pos - 1u);
-    }
-    fn next() -> char {
-        if self.pos < self.len {
-            ret str::char_at(*self.src, self.pos);
-        } else { ret -1 as char; }
-    }
-    fn bump() {
-        if self.pos < self.len {
-            self.col += 1u;
-            self.chpos += 1u;
-            if self.curr == '\n' {
-                codemap::next_line(self.filemap, self.chpos, self.pos +
-                                   self.filemap.start_pos.byte);
-                self.col = 0u;
-            }
-            let next = str::char_range_at(*self.src, self.pos);
-            self.pos = next.next;
-            self.curr = next.ch;
-        } else {
-            if (self.curr != -1 as char) {
-                self.col += 1u;
-                self.chpos += 1u;
-                self.curr = -1 as char;
-            }
-        }
-    }
-    fn fatal(m: str) -> ! {
-        self.span_diagnostic.span_fatal(
-            ast_util::mk_sp(self.chpos, self.chpos),
-            m)
-    }
-}
-
-fn new_reader(cm: codemap::codemap,
-              span_diagnostic: diagnostic::span_handler,
-              filemap: codemap::filemap,
-              itr: @interner::interner<str>) -> reader {
-    let r = @{cm: cm,
-              span_diagnostic: span_diagnostic,
-              src: filemap.src, len: str::len(*filemap.src),
-              mutable col: 0u, mutable pos: 0u, mutable curr: -1 as char,
-              mutable chpos: filemap.start_pos.ch, mutable strs: [],
-              filemap: filemap, interner: itr};
-    if r.pos < r.len {
-        let next = str::char_range_at(*r.src, r.pos);
-        r.pos = next.next;
-        r.curr = next.ch;
-    }
-    ret r;
-}
-
-fn dec_digit_val(c: char) -> int { ret (c as int) - ('0' as int); }
-
-fn hex_digit_val(c: char) -> int {
-    if in_range(c, '0', '9') { ret (c as int) - ('0' as int); }
-    if in_range(c, 'a', 'f') { ret (c as int) - ('a' as int) + 10; }
-    if in_range(c, 'A', 'F') { ret (c as int) - ('A' as int) + 10; }
-    fail;
-}
-
-fn bin_digit_value(c: char) -> int { if c == '0' { ret 0; } ret 1; }
-
-fn is_whitespace(c: char) -> bool {
-    ret c == ' ' || c == '\t' || c == '\r' || c == '\n';
-}
-
-fn may_begin_ident(c: char) -> bool { ret is_alpha(c) || c == '_'; }
-
-fn in_range(c: char, lo: char, hi: char) -> bool { ret lo <= c && c <= hi; }
-
-fn is_alpha(c: char) -> bool {
-    ret in_range(c, 'a', 'z') || in_range(c, 'A', 'Z');
-}
-
-fn is_dec_digit(c: char) -> bool { ret in_range(c, '0', '9'); }
-
-fn is_alnum(c: char) -> bool { ret is_alpha(c) || is_dec_digit(c); }
-
-fn is_hex_digit(c: char) -> bool {
-    ret in_range(c, '0', '9') || in_range(c, 'a', 'f') ||
-            in_range(c, 'A', 'F');
-}
-
-fn is_bin_digit(c: char) -> bool { ret c == '0' || c == '1'; }
-
-fn consume_whitespace_and_comments(rdr: reader) {
-    while is_whitespace(rdr.curr) { rdr.bump(); }
-    be consume_any_line_comment(rdr);
-}
-
-fn consume_any_line_comment(rdr: reader) {
-    if rdr.curr == '/' {
-        alt rdr.next() {
-          '/' {
-            while rdr.curr != '\n' && !rdr.is_eof() { rdr.bump(); }
-            // Restart whitespace munch.
-
-            be consume_whitespace_and_comments(rdr);
-          }
-          '*' { rdr.bump(); rdr.bump(); be consume_block_comment(rdr); }
-          _ { ret; }
-        }
-    }
-}
-
-fn consume_block_comment(rdr: reader) {
-    let level: int = 1;
-    while level > 0 {
-        if rdr.is_eof() { rdr.fatal("unterminated block comment"); }
-        if rdr.curr == '/' && rdr.next() == '*' {
-            rdr.bump();
-            rdr.bump();
-            level += 1;
-        } else {
-            if rdr.curr == '*' && rdr.next() == '/' {
-                rdr.bump();
-                rdr.bump();
-                level -= 1;
-            } else { rdr.bump(); }
-        }
-    }
-    // restart whitespace munch.
-
-    be consume_whitespace_and_comments(rdr);
-}
-
-fn scan_exponent(rdr: reader) -> option<str> {
-    let c = rdr.curr;
-    let rslt = "";
-    if c == 'e' || c == 'E' {
-        str::push_char(rslt, c);
-        rdr.bump();
-        c = rdr.curr;
-        if c == '-' || c == '+' {
-            str::push_char(rslt, c);
-            rdr.bump();
-        }
-        let exponent = scan_digits(rdr, 10u);
-        if str::len(exponent) > 0u {
-            ret some(rslt + exponent);
-        } else { rdr.fatal("scan_exponent: bad fp literal"); }
-    } else { ret none::<str>; }
-}
-
-fn scan_digits(rdr: reader, radix: uint) -> str {
-    let rslt = "";
-    while true {
-        let c = rdr.curr;
-        if c == '_' { rdr.bump(); cont; }
-        alt char::to_digit(c, radix) {
-          some(d) {
-            str::push_char(rslt, c);
-            rdr.bump();
-          }
-          _ { break; }
-        }
-    }
-    ret rslt;
-}
-
-fn scan_number(c: char, rdr: reader) -> token::token {
-    let num_str, base = 10u, c = c, n = rdr.next();
-    if c == '0' && n == 'x' {
-        rdr.bump();
-        rdr.bump();
-        base = 16u;
-    } else if c == '0' && n == 'b' {
-        rdr.bump();
-        rdr.bump();
-        base = 2u;
-    }
-    num_str = scan_digits(rdr, base);
-    c = rdr.curr;
-    n = rdr.next();
-    if c == 'u' || c == 'i' {
-        let signed = c == 'i', tp = if signed { either::left(ast::ty_i) }
-                                         else { either::right(ast::ty_u) };
-        rdr.bump();
-        c = rdr.curr;
-        if c == '8' {
-            rdr.bump();
-            tp = if signed { either::left(ast::ty_i8) }
-                      else { either::right(ast::ty_u8) };
-        }
-        n = rdr.next();
-        if c == '1' && n == '6' {
-            rdr.bump();
-            rdr.bump();
-            tp = if signed { either::left(ast::ty_i16) }
-                      else { either::right(ast::ty_u16) };
-        } else if c == '3' && n == '2' {
-            rdr.bump();
-            rdr.bump();
-            tp = if signed { either::left(ast::ty_i32) }
-                      else { either::right(ast::ty_u32) };
-        } else if c == '6' && n == '4' {
-            rdr.bump();
-            rdr.bump();
-            tp = if signed { either::left(ast::ty_i64) }
-                      else { either::right(ast::ty_u64) };
-        }
-        if str::len(num_str) == 0u {
-            rdr.fatal("no valid digits found for number");
-        }
-        let parsed = option::get(u64::from_str(num_str, base as u64));
-        alt tp {
-          either::left(t) { ret token::LIT_INT(parsed as i64, t); }
-          either::right(t) { ret token::LIT_UINT(parsed, t); }
-        }
-    }
-    let is_float = false;
-    if rdr.curr == '.' && !(is_alpha(rdr.next()) || rdr.next() == '_') {
-        is_float = true;
-        rdr.bump();
-        let dec_part = scan_digits(rdr, 10u);
-        num_str += "." + dec_part;
-    }
-    alt scan_exponent(rdr) {
-      some(s) {
-        is_float = true;
-        num_str += s;
-      }
-      none {}
-    }
-    if rdr.curr == 'f' {
-        rdr.bump();
-        c = rdr.curr;
-        n = rdr.next();
-        if c == '3' && n == '2' {
-            rdr.bump();
-            rdr.bump();
-            ret token::LIT_FLOAT(intern(*rdr.interner, num_str),
-                                 ast::ty_f32);
-        } else if c == '6' && n == '4' {
-            rdr.bump();
-            rdr.bump();
-            ret token::LIT_FLOAT(intern(*rdr.interner, num_str),
-                                 ast::ty_f64);
-            /* FIXME: if this is out of range for either a 32-bit or
-            64-bit float, it won't be noticed till the back-end */
-        } else {
-            is_float = true;
-        }
-    }
-    if is_float {
-        ret token::LIT_FLOAT(interner::intern(*rdr.interner, num_str),
-                             ast::ty_f);
-    } else {
-        if str::len(num_str) == 0u {
-            rdr.fatal("no valid digits found for number");
-        }
-        let parsed = option::get(u64::from_str(num_str, base as u64));
-        ret token::LIT_INT(parsed as i64, ast::ty_i);
-    }
-}
-
-fn scan_numeric_escape(rdr: reader, n_hex_digits: uint) -> char {
-    let accum_int = 0, i = n_hex_digits;
-    while i != 0u {
-        let n = rdr.curr;
-        rdr.bump();
-        if !is_hex_digit(n) {
-            rdr.fatal(#fmt["illegal numeric character escape: %d", n as int]);
-        }
-        accum_int *= 16;
-        accum_int += hex_digit_val(n);
-        i -= 1u;
-    }
-    ret accum_int as char;
-}
-
-fn next_token(rdr: reader) -> {tok: token::token, chpos: uint, bpos: uint} {
-    consume_whitespace_and_comments(rdr);
-    let start_chpos = rdr.chpos;
-    let start_bpos = rdr.pos;
-    let tok = if rdr.is_eof() { token::EOF } else { next_token_inner(rdr) };
-    ret {tok: tok, chpos: start_chpos, bpos: start_bpos};
-}
-
-fn next_token_inner(rdr: reader) -> token::token {
-    let accum_str = "";
-    let c = rdr.curr;
-    if (c >= 'a' && c <= 'z')
-        || (c >= 'A' && c <= 'Z')
-        || c == '_'
-        || (c > 'z' && char::is_XID_start(c)) {
-        while (c >= 'a' && c <= 'z')
-            || (c >= 'A' && c <= 'Z')
-            || (c >= '0' && c <= '9')
-            || c == '_'
-            || (c > 'z' && char::is_XID_continue(c)) {
-            str::push_char(accum_str, c);
-            rdr.bump();
-            c = rdr.curr;
-        }
-        if str::eq(accum_str, "_") { ret token::UNDERSCORE; }
-        let is_mod_name = c == ':' && rdr.next() == ':';
-
-        // FIXME: perform NFKC normalization here.
-        ret token::IDENT(interner::intern::<str>(*rdr.interner,
-                                                 accum_str), is_mod_name);
-    }
-    if is_dec_digit(c) {
-        ret scan_number(c, rdr);
-    }
-    fn binop(rdr: reader, op: token::binop) -> token::token {
-        rdr.bump();
-        if rdr.curr == '=' {
-            rdr.bump();
-            ret token::BINOPEQ(op);
-        } else { ret token::BINOP(op); }
-    }
-    alt c {
-
-
-
-
-
-      // One-byte tokens.
-      ';' { rdr.bump(); ret token::SEMI; }
-      ',' { rdr.bump(); ret token::COMMA; }
-      '.' {
-        rdr.bump();
-        if rdr.curr == '.' && rdr.next() == '.' {
-            rdr.bump();
-            rdr.bump();
-            ret token::ELLIPSIS;
-        }
-        ret token::DOT;
-      }
-      '(' { rdr.bump(); ret token::LPAREN; }
-      ')' { rdr.bump(); ret token::RPAREN; }
-      '{' { rdr.bump(); ret token::LBRACE; }
-      '}' { rdr.bump(); ret token::RBRACE; }
-      '[' { rdr.bump(); ret token::LBRACKET; }
-      ']' { rdr.bump(); ret token::RBRACKET; }
-      '@' { rdr.bump(); ret token::AT; }
-      '#' {
-        rdr.bump();
-        if rdr.curr == '<' { rdr.bump(); ret token::POUND_LT; }
-        if rdr.curr == '{' { rdr.bump(); ret token::POUND_LBRACE; }
-        ret token::POUND;
-      }
-      '~' { rdr.bump(); ret token::TILDE; }
-      ':' {
-        rdr.bump();
-        if rdr.curr == ':' {
-            rdr.bump();
-            ret token::MOD_SEP;
-        } else { ret token::COLON; }
-      }
-
-      '$' {
-        rdr.bump();
-        if is_dec_digit(rdr.curr) {
-            let val = dec_digit_val(rdr.curr) as uint;
-            while is_dec_digit(rdr.next()) {
-                rdr.bump();
-                val = val * 10u + (dec_digit_val(rdr.curr) as uint);
-            }
-            rdr.bump();
-            ret token::DOLLAR_NUM(val);
-        } else if rdr.curr == '(' {
-            rdr.bump();
-            ret token::DOLLAR_LPAREN;
-        } else {
-            rdr.fatal("expected digit");
-        }
-      }
-
-
-
-
-
-      // Multi-byte tokens.
-      '=' {
-        rdr.bump();
-        if rdr.curr == '=' {
-            rdr.bump();
-            ret token::EQEQ;
-        } else { ret token::EQ; }
-      }
-      '!' {
-        rdr.bump();
-        if rdr.curr == '=' {
-            rdr.bump();
-            ret token::NE;
-        } else { ret token::NOT; }
-      }
-      '<' {
-        rdr.bump();
-        alt rdr.curr {
-          '=' { rdr.bump(); ret token::LE; }
-          '<' { ret binop(rdr, token::LSL); }
-          '-' {
-            rdr.bump();
-            alt rdr.curr {
-              '>' { rdr.bump(); ret token::DARROW; }
-              _ { ret token::LARROW; }
-            }
-          }
-          _ { ret token::LT; }
-        }
-      }
-      '>' {
-        rdr.bump();
-        alt rdr.curr {
-          '=' { rdr.bump(); ret token::GE; }
-          '>' {
-            if rdr.next() == '>' {
-                rdr.bump();
-                ret binop(rdr, token::ASR);
-            } else { ret binop(rdr, token::LSR); }
-          }
-          _ { ret token::GT; }
-        }
-      }
-      '\'' {
-        rdr.bump();
-        let c2 = rdr.curr;
-        rdr.bump();
-        if c2 == '\\' {
-            let escaped = rdr.curr;
-            rdr.bump();
-            alt escaped {
-              'n' { c2 = '\n'; }
-              'r' { c2 = '\r'; }
-              't' { c2 = '\t'; }
-              '\\' { c2 = '\\'; }
-              '\'' { c2 = '\''; }
-              'x' { c2 = scan_numeric_escape(rdr, 2u); }
-              'u' { c2 = scan_numeric_escape(rdr, 4u); }
-              'U' { c2 = scan_numeric_escape(rdr, 8u); }
-              c2 {
-                rdr.fatal(#fmt["unknown character escape: %d", c2 as int]);
-              }
-            }
-        }
-        if rdr.curr != '\'' {
-            rdr.fatal("unterminated character constant");
-        }
-        rdr.bump(); // advance curr past token
-        ret token::LIT_INT(c2 as i64, ast::ty_char);
-      }
-      '"' {
-        let n = rdr.chpos;
-        rdr.bump();
-        while rdr.curr != '"' {
-            if rdr.is_eof() {
-                rdr.fatal(#fmt["unterminated double quote string: %s",
-                             rdr.get_str_from(n)]);
-            }
-
-            let ch = rdr.curr;
-            rdr.bump();
-            alt ch {
-              '\\' {
-                let escaped = rdr.curr;
-                rdr.bump();
-                alt escaped {
-                  'n' { str::push_char(accum_str, '\n'); }
-                  'r' { str::push_char(accum_str, '\r'); }
-                  't' { str::push_char(accum_str, '\t'); }
-                  '\\' { str::push_char(accum_str, '\\'); }
-                  '"' { str::push_char(accum_str, '"'); }
-                  '\n' { consume_whitespace(rdr); }
-                  'x' {
-                    str::push_char(accum_str, scan_numeric_escape(rdr, 2u));
-                  }
-                  'u' {
-                    str::push_char(accum_str, scan_numeric_escape(rdr, 4u));
-                  }
-                  'U' {
-                    str::push_char(accum_str, scan_numeric_escape(rdr, 8u));
-                  }
-                  c2 {
-                    rdr.fatal(#fmt["unknown string escape: %d", c2 as int]);
-                  }
-                }
-              }
-              _ { str::push_char(accum_str, ch); }
-            }
-        }
-        rdr.bump();
-        ret token::LIT_STR(interner::intern::<str>(*rdr.interner,
-                                                   accum_str));
-      }
-      '-' {
-        if rdr.next() == '>' {
-            rdr.bump();
-            rdr.bump();
-            ret token::RARROW;
-        } else { ret binop(rdr, token::MINUS); }
-      }
-      '&' {
-        if rdr.next() == '&' {
-            rdr.bump();
-            rdr.bump();
-            ret token::ANDAND;
-        } else { ret binop(rdr, token::AND); }
-      }
-      '|' {
-        alt rdr.next() {
-          '|' { rdr.bump(); rdr.bump(); ret token::OROR; }
-          _ { ret binop(rdr, token::OR); }
-        }
-      }
-      '+' { ret binop(rdr, token::PLUS); }
-      '*' { ret binop(rdr, token::STAR); }
-      '/' { ret binop(rdr, token::SLASH); }
-      '^' { ret binop(rdr, token::CARET); }
-      '%' { ret binop(rdr, token::PERCENT); }
-      c { rdr.fatal(#fmt["unkown start of token: %d", c as int]); }
-    }
-}
-
-enum cmnt_style {
-    isolated, // No code on either side of each line of the comment
-    trailing, // Code exists to the left of the comment
-    mixed, // Code before /* foo */ and after the comment
-    blank_line, // Just a manual blank line "\n\n", for layout
-}
-
-type cmnt = {style: cmnt_style, lines: [str], pos: uint};
-
-fn read_to_eol(rdr: reader) -> str {
-    let val = "";
-    while rdr.curr != '\n' && !rdr.is_eof() {
-        str::push_char(val, rdr.curr);
-        rdr.bump();
-    }
-    if rdr.curr == '\n' { rdr.bump(); }
-    ret val;
-}
-
-fn read_one_line_comment(rdr: reader) -> str {
-    let val = read_to_eol(rdr);
-    assert (val[0] == '/' as u8 && val[1] == '/' as u8);
-    ret val;
-}
-
-fn consume_whitespace(rdr: reader) {
-    while is_whitespace(rdr.curr) && !rdr.is_eof() { rdr.bump(); }
-}
-
-fn consume_non_eol_whitespace(rdr: reader) {
-    while is_whitespace(rdr.curr) && rdr.curr != '\n' && !rdr.is_eof() {
-        rdr.bump();
-    }
-}
-
-fn push_blank_line_comment(rdr: reader, &comments: [cmnt]) {
-    #debug(">>> blank-line comment");
-    let v: [str] = [];
-    comments += [{style: blank_line, lines: v, pos: rdr.chpos}];
-}
-
-fn consume_whitespace_counting_blank_lines(rdr: reader, &comments: [cmnt]) {
-    while is_whitespace(rdr.curr) && !rdr.is_eof() {
-        if rdr.col == 0u && rdr.curr == '\n' {
-            push_blank_line_comment(rdr, comments);
-        }
-        rdr.bump();
-    }
-}
-
-fn read_line_comments(rdr: reader, code_to_the_left: bool) -> cmnt {
-    #debug(">>> line comments");
-    let p = rdr.chpos;
-    let lines: [str] = [];
-    while rdr.curr == '/' && rdr.next() == '/' {
-        let line = read_one_line_comment(rdr);
-        log(debug, line);
-        lines += [line];
-        consume_non_eol_whitespace(rdr);
-    }
-    #debug("<<< line comments");
-    ret {style: if code_to_the_left { trailing } else { isolated },
-         lines: lines,
-         pos: p};
-}
-
-fn all_whitespace(s: str, begin: uint, end: uint) -> bool {
-    let i: uint = begin;
-    while i != end { if !is_whitespace(s[i] as char) { ret false; } i += 1u; }
-    ret true;
-}
-
-fn trim_whitespace_prefix_and_push_line(&lines: [str],
-                                        s: str, col: uint) unsafe {
-    let s1;
-    if all_whitespace(s, 0u, col) {
-        if col < str::len(s) {
-            s1 = str::slice(s, col, str::len(s));
-        } else { s1 = ""; }
-    } else { s1 = s; }
-    log(debug, "pushing line: " + s1);
-    lines += [s1];
-}
-
-fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
-    #debug(">>> block comment");
-    let p = rdr.chpos;
-    let lines: [str] = [];
-    let col: uint = rdr.col;
-    rdr.bump();
-    rdr.bump();
-    let curr_line = "/*";
-    let level: int = 1;
-    while level > 0 {
-        #debug("=== block comment level %d", level);
-        if rdr.is_eof() { rdr.fatal("unterminated block comment"); }
-        if rdr.curr == '\n' {
-            trim_whitespace_prefix_and_push_line(lines, curr_line, col);
-            curr_line = "";
-            rdr.bump();
-        } else {
-            str::push_char(curr_line, rdr.curr);
-            if rdr.curr == '/' && rdr.next() == '*' {
-                rdr.bump();
-                rdr.bump();
-                curr_line += "*";
-                level += 1;
-            } else {
-                if rdr.curr == '*' && rdr.next() == '/' {
-                    rdr.bump();
-                    rdr.bump();
-                    curr_line += "/";
-                    level -= 1;
-                } else { rdr.bump(); }
-            }
-        }
-    }
-    if str::len(curr_line) != 0u {
-        trim_whitespace_prefix_and_push_line(lines, curr_line, col);
-    }
-    let style = if code_to_the_left { trailing } else { isolated };
-    consume_non_eol_whitespace(rdr);
-    if !rdr.is_eof() && rdr.curr != '\n' && vec::len(lines) == 1u {
-        style = mixed;
-    }
-    #debug("<<< block comment");
-    ret {style: style, lines: lines, pos: p};
-}
-
-fn peeking_at_comment(rdr: reader) -> bool {
-    ret rdr.curr == '/' && rdr.next() == '/' ||
-            rdr.curr == '/' && rdr.next() == '*';
-}
-
-fn consume_comment(rdr: reader, code_to_the_left: bool, &comments: [cmnt]) {
-    #debug(">>> consume comment");
-    if rdr.curr == '/' && rdr.next() == '/' {
-        comments += [read_line_comments(rdr, code_to_the_left)];
-    } else if rdr.curr == '/' && rdr.next() == '*' {
-        comments += [read_block_comment(rdr, code_to_the_left)];
-    } else { fail; }
-    #debug("<<< consume comment");
-}
-
-fn is_lit(t: token::token) -> bool {
-    ret alt t {
-          token::LIT_INT(_, _) { true }
-          token::LIT_UINT(_, _) { true }
-          token::LIT_FLOAT(_, _) { true }
-          token::LIT_STR(_) { true }
-          token::LIT_BOOL(_) { true }
-          _ { false }
-        }
-}
-
-type lit = {lit: str, pos: uint};
-
-fn gather_comments_and_literals(cm: codemap::codemap,
-                                span_diagnostic: diagnostic::span_handler,
-                                path: str,
-                                srdr: io::reader) ->
-   {cmnts: [cmnt], lits: [lit]} {
-    let src = @str::from_bytes(srdr.read_whole_stream());
-    let itr = @interner::mk::<str>(str::hash, str::eq);
-    let rdr = new_reader(cm, span_diagnostic,
-                         codemap::new_filemap(path, src, 0u, 0u), itr);
-    let comments: [cmnt] = [];
-    let literals: [lit] = [];
-    let first_read: bool = true;
-    while !rdr.is_eof() {
-        while true {
-            let code_to_the_left = !first_read;
-            consume_non_eol_whitespace(rdr);
-            if rdr.curr == '\n' {
-                code_to_the_left = false;
-                consume_whitespace_counting_blank_lines(rdr, comments);
-            }
-            while peeking_at_comment(rdr) {
-                consume_comment(rdr, code_to_the_left, comments);
-                consume_whitespace_counting_blank_lines(rdr, comments);
-            }
-            break;
-        }
-        let tok = next_token(rdr);
-        if is_lit(tok.tok) {
-            let s = rdr.get_str_from(tok.bpos);
-            literals += [{lit: s, pos: tok.chpos}];
-            log(debug, "tok lit: " + s);
-        } else {
-            log(debug, "tok: " + token::to_str(rdr, tok.tok));
-        }
-        first_read = false;
-    }
-    ret {cmnts: comments, lits: literals};
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
deleted file mode 100644
index 5837baf1ff9..00000000000
--- a/src/comp/syntax/parse/parser.rs
+++ /dev/null
@@ -1,2747 +0,0 @@
-import std::{io, fs};
-import either::{left, right};
-import std::map::{hashmap, new_str_hash};
-import token::can_begin_expr;
-import codemap::{span,fss_none};
-import util::interner;
-import ast::{node_id, spanned};
-import ast_util::{mk_sp, ident_to_path};
-import front::attr;
-import lexer::reader;
-import driver::diagnostic;
-
-enum restriction {
-    UNRESTRICTED,
-    RESTRICT_STMT_EXPR,
-    RESTRICT_NO_CALL_EXPRS,
-    RESTRICT_NO_BAR_OP,
-}
-
-enum file_type { CRATE_FILE, SOURCE_FILE, }
-
-type parse_sess = @{
-    cm: codemap::codemap,
-    mutable next_id: node_id,
-    span_diagnostic: diagnostic::span_handler,
-    // these two must be kept up to date
-    mutable chpos: uint,
-    mutable byte_pos: uint
-};
-
-fn next_node_id(sess: parse_sess) -> node_id {
-    let rv = sess.next_id;
-    sess.next_id += 1;
-    // ID 0 is reserved for the crate and doesn't actually exist in the AST
-    assert rv != 0;
-    ret rv;
-}
-
-type parser = @{
-    sess: parse_sess,
-    cfg: ast::crate_cfg,
-    file_type: file_type,
-    mutable token: token::token,
-    mutable span: span,
-    mutable last_span: span,
-    mutable buffer: [{tok: token::token, span: span}],
-    mutable restriction: restriction,
-    reader: reader,
-    precs: @[op_spec],
-    bad_expr_words: hashmap<str, ()>
-};
-
-impl parser for parser {
-    fn bump() {
-        self.last_span = self.span;
-        if vec::len(self.buffer) == 0u {
-            let next = lexer::next_token(self.reader);
-            self.token = next.tok;
-            self.span = ast_util::mk_sp(next.chpos, self.reader.chpos);
-        } else {
-            let next = vec::pop(self.buffer);
-            self.token = next.tok;
-            self.span = next.span;
-        }
-    }
-    fn swap(next: token::token, lo: uint, hi: uint) {
-        self.token = next;
-        self.span = ast_util::mk_sp(lo, hi);
-    }
-    fn look_ahead(distance: uint) -> token::token {
-        while vec::len(self.buffer) < distance {
-            let next = lexer::next_token(self.reader);
-            let sp = ast_util::mk_sp(next.chpos, self.reader.chpos);
-            self.buffer = [{tok: next.tok, span: sp}] + self.buffer;
-        }
-        ret self.buffer[distance - 1u].tok;
-    }
-    fn fatal(m: str) -> ! {
-        self.sess.span_diagnostic.span_fatal(self.span, m)
-    }
-    fn span_fatal(sp: span, m: str) -> ! {
-        self.sess.span_diagnostic.span_fatal(sp, m)
-    }
-    fn warn(m: str) {
-        self.sess.span_diagnostic.span_warn(self.span, m)
-    }
-    fn get_str(i: token::str_num) -> str {
-        interner::get(*self.reader.interner, i)
-    }
-    fn get_id() -> node_id { next_node_id(self.sess) }
-}
-
-fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: str,
-                        ftype: file_type) ->
-   parser {
-    let src = alt io::read_whole_file_str(path) {
-      result::ok(src) {
-        // FIXME: This copy is unfortunate
-        @src
-      }
-      result::err(e) {
-        sess.span_diagnostic.handler().fatal(e)
-      }
-    };
-    let filemap = codemap::new_filemap(path, src,
-                                       sess.chpos, sess.byte_pos);
-    sess.cm.files += [filemap];
-    let itr = @interner::mk(str::hash, str::eq);
-    let rdr = lexer::new_reader(sess.cm, sess.span_diagnostic, filemap, itr);
-    ret new_parser(sess, cfg, rdr, ftype);
-}
-
-fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg,
-                              name: str, ss: codemap::file_substr,
-                              source: @str) -> parser {
-    let ftype = SOURCE_FILE;
-    let filemap = codemap::new_filemap_w_substr
-        (name, ss, source, sess.chpos, sess.byte_pos);
-    sess.cm.files += [filemap];
-    let itr = @interner::mk(str::hash, str::eq);
-    let rdr = lexer::new_reader(sess.cm, sess.span_diagnostic,
-                                filemap, itr);
-    ret new_parser(sess, cfg, rdr, ftype);
-}
-
-fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
-              ftype: file_type) -> parser {
-    let tok0 = lexer::next_token(rdr);
-    let span0 = ast_util::mk_sp(tok0.chpos, rdr.chpos);
-    @{sess: sess,
-      cfg: cfg,
-      file_type: ftype,
-      mutable token: tok0.tok,
-      mutable span: span0,
-      mutable last_span: span0,
-      mutable buffer: [],
-      mutable restriction: UNRESTRICTED,
-      reader: rdr,
-      precs: prec_table(),
-      bad_expr_words: bad_expr_word_table()}
-}
-
-// These are the words that shouldn't be allowed as value identifiers,
-// because, if used at the start of a line, they will cause the line to be
-// interpreted as a specific kind of statement, which would be confusing.
-fn bad_expr_word_table() -> hashmap<str, ()> {
-    let words = new_str_hash();
-    for word in ["alt", "assert", "be", "break", "check", "claim",
-                 "class", "const", "cont", "copy", "do", "else", "enum",
-                 "export", "fail", "fn", "for", "if",  "iface", "impl",
-                 "import", "let", "log", "mod", "mutable", "native", "pure",
-                 "resource", "ret", "trait", "type", "unchecked", "unsafe",
-                 "while", "crust", "mut"] {
-        words.insert(word, ());
-    }
-    words
-}
-
-fn unexpected(p: parser, t: token::token) -> ! {
-    let s: str = "unexpected token: '" + token::to_str(p.reader, t) +
-        "'";
-    p.fatal(s);
-}
-
-fn expect(p: parser, t: token::token) {
-    if p.token == t {
-        p.bump();
-    } else {
-        let s: str = "expecting '";
-        s += token::to_str(p.reader, t);
-        s += "' but found '";
-        s += token::to_str(p.reader, p.token);
-        p.fatal(s + "'");
-    }
-}
-
-fn expect_gt(p: parser) {
-    if p.token == token::GT {
-        p.bump();
-    } else if p.token == token::BINOP(token::LSR) {
-        p.swap(token::GT, p.span.lo + 1u, p.span.hi);
-    } else if p.token == token::BINOP(token::ASR) {
-        p.swap(token::BINOP(token::LSR), p.span.lo + 1u, p.span.hi);
-    } else {
-        let s: str = "expecting ";
-        s += token::to_str(p.reader, token::GT);
-        s += ", found ";
-        s += token::to_str(p.reader, p.token);
-        p.fatal(s);
-    }
-}
-
-fn spanned<T: copy>(lo: uint, hi: uint, node: T) -> spanned<T> {
-    ret {node: node, span: ast_util::mk_sp(lo, hi)};
-}
-
-fn parse_ident(p: parser) -> ast::ident {
-    alt p.token {
-      token::IDENT(i, _) { p.bump(); ret p.get_str(i); }
-      _ { p.fatal("expecting ident, found "
-                  + token::to_str(p.reader, p.token)); }
-    }
-}
-
-fn parse_path_list_ident(p: parser) -> ast::path_list_ident {
-    let lo = p.span.lo;
-    let ident = parse_ident(p);
-    let hi = p.span.hi;
-    ret spanned(lo, hi, {name: ident, id: p.get_id()});
-}
-
-fn parse_value_ident(p: parser) -> ast::ident {
-    check_bad_word(p);
-    ret parse_ident(p);
-}
-
-fn eat(p: parser, tok: token::token) -> bool {
-    ret if p.token == tok { p.bump(); true } else { false };
-}
-
-fn is_word(p: parser, word: str) -> bool {
-    ret alt p.token {
-          token::IDENT(sid, false) { str::eq(word, p.get_str(sid)) }
-          _ { false }
-        };
-}
-
-fn eat_word(p: parser, word: str) -> bool {
-    alt p.token {
-      token::IDENT(sid, false) {
-        if str::eq(word, p.get_str(sid)) {
-            p.bump();
-            ret true;
-        } else { ret false; }
-      }
-      _ { ret false; }
-    }
-}
-
-fn expect_word(p: parser, word: str) {
-    if !eat_word(p, word) {
-        p.fatal("expecting " + word + ", found " +
-                    token::to_str(p.reader, p.token));
-    }
-}
-
-fn check_bad_word(p: parser) {
-    alt p.token {
-      token::IDENT(sid, false) {
-        let w = p.get_str(sid);
-        if p.bad_expr_words.contains_key(w) {
-            p.fatal("found " + w + " in expression position");
-        }
-      }
-      _ { }
-    }
-}
-
-fn parse_ty_fn(p: parser) -> ast::fn_decl {
-    fn parse_fn_input_ty(p: parser) -> ast::arg {
-        let mode = parse_arg_mode(p);
-        let name = if is_plain_ident(p) && p.look_ahead(1u) == token::COLON {
-            let name = parse_value_ident(p);
-            p.bump();
-            name
-        } else { "" };
-        ret {mode: mode, ty: parse_ty(p, false), ident: name, id: p.get_id()};
-    }
-    let inputs =
-        parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                  parse_fn_input_ty, p);
-    // FIXME: there's no syntax for this right now anyway
-    //  auto constrs = parse_constrs(~[], p);
-    let constrs: [@ast::constr] = [];
-    let (ret_style, ret_ty) = parse_ret_ty(p);
-    ret {inputs: inputs.node, output: ret_ty,
-         purity: ast::impure_fn, cf: ret_style,
-         constraints: constrs};
-}
-
-fn parse_ty_methods(p: parser) -> [ast::ty_method] {
-    parse_seq(token::LBRACE, token::RBRACE, seq_sep_none(), {|p|
-        let attrs = parse_outer_attributes(p);
-        let flo = p.span.lo;
-        let pur = parse_fn_purity(p);
-        let ident = parse_method_name(p);
-        let tps = parse_ty_params(p);
-        let d = parse_ty_fn(p), fhi = p.last_span.hi;
-        expect(p, token::SEMI);
-        {ident: ident, attrs: attrs, decl: {purity: pur with d}, tps: tps,
-         span: ast_util::mk_sp(flo, fhi)}
-    }, p).node
-}
-
-fn parse_mt(p: parser) -> ast::mt {
-    let mutbl = parse_mutability(p);
-    let t = parse_ty(p, false);
-    ret {ty: t, mutbl: mutbl};
-}
-
-fn parse_ty_field(p: parser) -> ast::ty_field {
-    let lo = p.span.lo;
-    let mutbl = parse_mutability(p);
-    let id = parse_ident(p);
-    expect(p, token::COLON);
-    let ty = parse_ty(p, false);
-    ret spanned(lo, ty.span.hi, {ident: id, mt: {ty: ty, mutbl: mutbl}});
-}
-
-// if i is the jth ident in args, return j
-// otherwise, fail
-fn ident_index(p: parser, args: [ast::arg], i: ast::ident) -> uint {
-    let j = 0u;
-    for a: ast::arg in args { if a.ident == i { ret j; } j += 1u; }
-    p.fatal("Unbound variable " + i + " in constraint arg");
-}
-
-fn parse_type_constr_arg(p: parser) -> @ast::ty_constr_arg {
-    let sp = p.span;
-    let carg = ast::carg_base;
-    expect(p, token::BINOP(token::STAR));
-    if p.token == token::DOT {
-        // "*..." notation for record fields
-        p.bump();
-        let pth = parse_path(p);
-        carg = ast::carg_ident(pth);
-    }
-    // No literals yet, I guess?
-    ret @{node: carg, span: sp};
-}
-
-fn parse_constr_arg(args: [ast::arg], p: parser) -> @ast::constr_arg {
-    let sp = p.span;
-    let carg = ast::carg_base;
-    if p.token == token::BINOP(token::STAR) {
-        p.bump();
-    } else {
-        let i: ast::ident = parse_value_ident(p);
-        carg = ast::carg_ident(ident_index(p, args, i));
-    }
-    ret @{node: carg, span: sp};
-}
-
-fn parse_ty_constr(fn_args: [ast::arg], p: parser) -> @ast::constr {
-    let lo = p.span.lo;
-    let path = parse_path(p);
-    let args: {node: [@ast::constr_arg], span: span} =
-        parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                  {|p| parse_constr_arg(fn_args, p)}, p);
-    ret @spanned(lo, args.span.hi,
-                 {path: path, args: args.node, id: p.get_id()});
-}
-
-fn parse_constr_in_type(p: parser) -> @ast::ty_constr {
-    let lo = p.span.lo;
-    let path = parse_path(p);
-    let args: [@ast::ty_constr_arg] =
-        parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                  parse_type_constr_arg, p).node;
-    let hi = p.span.lo;
-    let tc: ast::ty_constr_ = {path: path, args: args, id: p.get_id()};
-    ret @spanned(lo, hi, tc);
-}
-
-
-fn parse_constrs<T: copy>(pser: fn(parser) -> @ast::constr_general<T>,
-                         p: parser) ->
-   [@ast::constr_general<T>] {
-    let constrs: [@ast::constr_general<T>] = [];
-    while true {
-        let constr = pser(p);
-        constrs += [constr];
-        if p.token == token::COMMA { p.bump(); } else { break; }
-    }
-    constrs
-}
-
-fn parse_type_constraints(p: parser) -> [@ast::ty_constr] {
-    ret parse_constrs(parse_constr_in_type, p);
-}
-
-fn parse_ty_postfix(orig_t: ast::ty_, p: parser, colons_before_params: bool,
-                    lo: uint) -> @ast::ty {
-    if colons_before_params && p.token == token::MOD_SEP {
-        p.bump();
-        expect(p, token::LT);
-    } else if !colons_before_params && p.token == token::LT {
-        p.bump();
-    } else { ret @spanned(lo, p.last_span.hi, orig_t); }
-
-    // If we're here, we have explicit type parameter instantiation.
-    let seq = parse_seq_to_gt(some(token::COMMA), {|p| parse_ty(p, false)},
-                              p);
-
-    alt orig_t {
-      ast::ty_path(pth, ann) {
-        ret @spanned(lo, p.last_span.hi,
-                     ast::ty_path(@spanned(lo, p.last_span.hi,
-                                           {global: pth.node.global,
-                                            idents: pth.node.idents,
-                                            types: seq}), ann));
-      }
-      _ { p.fatal("type parameter instantiation only allowed for paths"); }
-    }
-}
-
-fn parse_ret_ty(p: parser) -> (ast::ret_style, @ast::ty) {
-    ret if eat(p, token::RARROW) {
-        let lo = p.span.lo;
-        if eat(p, token::NOT) {
-            (ast::noreturn, @spanned(lo, p.last_span.hi, ast::ty_bot))
-        } else { (ast::return_val, parse_ty(p, false)) }
-    } else {
-        let pos = p.span.lo;
-        (ast::return_val, @spanned(pos, pos, ast::ty_nil))
-    }
-}
-
-fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
-    let lo = p.span.lo;
-
-    alt have_dollar(p) {
-      some(e) {ret @spanned(lo, p.span.hi,
-                            ast::ty_mac(spanned(lo, p.span.hi, e)))}
-      none {}
-    }
-
-    let t = if p.token == token::LPAREN {
-        p.bump();
-        if p.token == token::RPAREN {
-            p.bump();
-            ast::ty_nil
-        } else {
-            let ts = [parse_ty(p, false)];
-            while p.token == token::COMMA {
-                p.bump();
-                ts += [parse_ty(p, false)];
-            }
-            let t = if vec::len(ts) == 1u { ts[0].node }
-                    else { ast::ty_tup(ts) };
-            expect(p, token::RPAREN);
-            t
-        }
-    } else if p.token == token::AT {
-        p.bump();
-        ast::ty_box(parse_mt(p))
-    } else if p.token == token::TILDE {
-        p.bump();
-        ast::ty_uniq(parse_mt(p))
-    } else if p.token == token::BINOP(token::STAR) {
-        p.bump();
-        ast::ty_ptr(parse_mt(p))
-    } else if p.token == token::LBRACE {
-        let elems =
-            parse_seq(token::LBRACE, token::RBRACE, seq_sep_opt(token::COMMA),
-                      parse_ty_field, p);
-        if vec::len(elems.node) == 0u { unexpected(p, token::RBRACE); }
-        let hi = elems.span.hi;
-
-        let t = ast::ty_rec(elems.node);
-        if p.token == token::COLON {
-            p.bump();
-            ast::ty_constr(@spanned(lo, hi, t), parse_type_constraints(p))
-        } else { t }
-    } else if p.token == token::LBRACKET {
-        expect(p, token::LBRACKET);
-        let t = ast::ty_vec(parse_mt(p));
-        expect(p, token::RBRACKET);
-        t
-    } else if eat_word(p, "fn") {
-        let proto = parse_fn_ty_proto(p);
-        alt proto {
-          ast::proto_bare { p.warn("fn is deprecated, use native fn"); }
-          _ { /* fallthrough */ }
-        }
-        ast::ty_fn(proto, parse_ty_fn(p))
-    } else if eat_word(p, "native") {
-        expect_word(p, "fn");
-        ast::ty_fn(ast::proto_bare, parse_ty_fn(p))
-    } else if p.token == token::MOD_SEP || is_ident(p.token) {
-        let path = parse_path(p);
-        ast::ty_path(path, p.get_id())
-    } else { p.fatal("expecting type"); };
-    ret parse_ty_postfix(t, p, colons_before_params, lo);
-}
-
-fn parse_arg_mode(p: parser) -> ast::mode {
-    if eat(p, token::BINOP(token::AND)) {
-        ast::expl(ast::by_mutbl_ref)
-    } else if eat(p, token::BINOP(token::MINUS)) {
-        ast::expl(ast::by_move)
-    } else if eat(p, token::ANDAND) {
-        ast::expl(ast::by_ref)
-    } else if eat(p, token::BINOP(token::PLUS)) {
-        if eat(p, token::BINOP(token::PLUS)) {
-            ast::expl(ast::by_val)
-        } else {
-            ast::expl(ast::by_copy)
-        }
-    } else { ast::infer(p.get_id()) }
-}
-
-fn parse_arg(p: parser) -> ast::arg {
-    let m = parse_arg_mode(p);
-    let i = parse_value_ident(p);
-    expect(p, token::COLON);
-    let t = parse_ty(p, false);
-    ret {mode: m, ty: t, ident: i, id: p.get_id()};
-}
-
-fn parse_fn_block_arg(p: parser) -> ast::arg {
-    let m = parse_arg_mode(p);
-    let i = parse_value_ident(p);
-    let t = if eat(p, token::COLON) {
-                parse_ty(p, false)
-            } else {
-                @spanned(p.span.lo, p.span.hi, ast::ty_infer)
-            };
-    ret {mode: m, ty: t, ident: i, id: p.get_id()};
-}
-
-fn parse_seq_to_before_gt<T: copy>(sep: option<token::token>,
-                                  f: fn(parser) -> T,
-                                  p: parser) -> [T] {
-    let first = true;
-    let v = [];
-    while p.token != token::GT && p.token != token::BINOP(token::LSR) &&
-              p.token != token::BINOP(token::ASR) {
-        alt sep {
-          some(t) { if first { first = false; } else { expect(p, t); } }
-          _ { }
-        }
-        v += [f(p)];
-    }
-
-    ret v;
-}
-
-fn parse_seq_to_gt<T: copy>(sep: option<token::token>,
-                           f: fn(parser) -> T, p: parser) -> [T] {
-    let v = parse_seq_to_before_gt(sep, f, p);
-    expect_gt(p);
-
-    ret v;
-}
-
-fn parse_seq_lt_gt<T: copy>(sep: option<token::token>,
-                           f: fn(parser) -> T,
-                           p: parser) -> spanned<[T]> {
-    let lo = p.span.lo;
-    expect(p, token::LT);
-    let result = parse_seq_to_before_gt::<T>(sep, f, p);
-    let hi = p.span.hi;
-    expect_gt(p);
-    ret spanned(lo, hi, result);
-}
-
-fn parse_seq_to_end<T: copy>(ket: token::token, sep: seq_sep,
-                            f: fn(parser) -> T, p: parser) -> [T] {
-    let val = parse_seq_to_before_end(ket, sep, f, p);
-    p.bump();
-    ret val;
-}
-
-type seq_sep = {
-    sep: option<token::token>,
-    trailing_opt: bool   // is trailing separator optional?
-};
-
-fn seq_sep(t: token::token) -> seq_sep {
-    ret {sep: option::some(t), trailing_opt: false};
-}
-fn seq_sep_opt(t: token::token) -> seq_sep {
-    ret {sep: option::some(t), trailing_opt: true};
-}
-fn seq_sep_none() -> seq_sep {
-    ret {sep: option::none, trailing_opt: false};
-}
-
-fn parse_seq_to_before_end<T: copy>(ket: token::token,
-                                   sep: seq_sep,
-                                   f: fn(parser) -> T, p: parser) -> [T] {
-    let first: bool = true;
-    let v: [T] = [];
-    while p.token != ket {
-        alt sep.sep {
-          some(t) { if first { first = false; } else { expect(p, t); } }
-          _ { }
-        }
-        if sep.trailing_opt && p.token == ket { break; }
-        v += [f(p)];
-    }
-    ret v;
-}
-
-
-fn parse_seq<T: copy>(bra: token::token, ket: token::token,
-                     sep: seq_sep, f: fn(parser) -> T,
-                     p: parser) -> spanned<[T]> {
-    let lo = p.span.lo;
-    expect(p, bra);
-    let result = parse_seq_to_before_end::<T>(ket, sep, f, p);
-    let hi = p.span.hi;
-    p.bump();
-    ret spanned(lo, hi, result);
-}
-
-fn have_dollar(p: parser) -> option::t<ast::mac_> {
-    alt p.token {
-      token::DOLLAR_NUM(num) {
-        p.bump();
-        some(ast::mac_var(num))
-      }
-      token::DOLLAR_LPAREN {
-        let lo = p.span.lo;
-        p.bump();
-        let e = parse_expr(p);
-        expect(p, token::RPAREN);
-        let hi = p.last_span.hi;
-        some(ast::mac_aq(ast_util::mk_sp(lo,hi), e))
-      }
-      _ {none}
-    }
-}
-
-fn lit_from_token(p: parser, tok: token::token) -> ast::lit_ {
-    alt tok {
-      token::LIT_INT(i, it) { ast::lit_int(i, it) }
-      token::LIT_UINT(u, ut) { ast::lit_uint(u, ut) }
-      token::LIT_FLOAT(s, ft) { ast::lit_float(p.get_str(s), ft) }
-      token::LIT_STR(s) { ast::lit_str(p.get_str(s)) }
-      token::LPAREN { expect(p, token::RPAREN); ast::lit_nil }
-      _ { unexpected(p, tok); }
-    }
-}
-
-fn parse_lit(p: parser) -> ast::lit {
-    let sp = p.span;
-    let lit = if eat_word(p, "true") {
-        ast::lit_bool(true)
-    } else if eat_word(p, "false") {
-        ast::lit_bool(false)
-    } else {
-        let tok = p.token;
-        p.bump();
-        lit_from_token(p, tok)
-    };
-    ret {node: lit, span: sp};
-}
-
-fn is_ident(t: token::token) -> bool {
-    alt t { token::IDENT(_, _) { ret true; } _ { } }
-    ret false;
-}
-
-fn is_plain_ident(p: parser) -> bool {
-    ret alt p.token { token::IDENT(_, false) { true } _ { false } };
-}
-
-fn parse_path(p: parser) -> @ast::path {
-    let lo = p.span.lo;
-    let global = eat(p, token::MOD_SEP), ids = [parse_ident(p)];
-    while p.look_ahead(1u) != token::LT && eat(p, token::MOD_SEP) {
-        ids += [parse_ident(p)];
-    }
-    ret @spanned(lo, p.last_span.hi,
-                 {global: global, idents: ids, types: []});
-}
-
-fn parse_value_path(p: parser) -> @ast::path {
-    let pt = parse_path(p);
-    let last_word = pt.node.idents[vec::len(pt.node.idents)-1u];
-    if p.bad_expr_words.contains_key(last_word) {
-        p.fatal("found " + last_word + " in expression position");
-    }
-    pt
-}
-
-fn parse_path_and_ty_param_substs(p: parser, colons: bool) -> @ast::path {
-    let lo = p.span.lo;
-    let path = parse_path(p);
-    let b = if colons {
-                eat(p, token::MOD_SEP)
-            } else {
-                p.token == token::LT
-            };
-    if b {
-        let seq = parse_seq_lt_gt(some(token::COMMA),
-                                  {|p| parse_ty(p, false)}, p);
-        @spanned(lo, seq.span.hi, {types: seq.node with path.node})
-    } else { path }
-}
-
-fn parse_mutability(p: parser) -> ast::mutability {
-    if eat_word(p, "mutable") {
-        ast::m_mutbl
-    } else if eat_word(p, "mut") {
-        ast::m_mutbl
-    } else if eat_word(p, "const") {
-        ast::m_const
-    } else {
-        ast::m_imm
-    }
-}
-
-fn parse_field(p: parser, sep: token::token) -> ast::field {
-    let lo = p.span.lo;
-    let m = parse_mutability(p);
-    let i = parse_ident(p);
-    expect(p, sep);
-    let e = parse_expr(p);
-    ret spanned(lo, e.span.hi, {mutbl: m, ident: i, expr: e});
-}
-
-fn mk_expr(p: parser, lo: uint, hi: uint, node: ast::expr_) -> @ast::expr {
-    ret @{id: p.get_id(), node: node, span: ast_util::mk_sp(lo, hi)};
-}
-
-fn mk_mac_expr(p: parser, lo: uint, hi: uint, m: ast::mac_) -> @ast::expr {
-    ret @{id: p.get_id(),
-          node: ast::expr_mac({node: m, span: ast_util::mk_sp(lo, hi)}),
-          span: ast_util::mk_sp(lo, hi)};
-}
-
-fn is_bar(t: token::token) -> bool {
-    alt t { token::BINOP(token::OR) | token::OROR { true } _ { false } }
-}
-
-fn mk_lit_u32(p: parser, i: u32) -> @ast::expr {
-    let span = p.span;
-    let lv_lit = @{node: ast::lit_uint(i as u64, ast::ty_u32),
-                   span: span};
-
-    ret @{id: p.get_id(), node: ast::expr_lit(lv_lit), span: span};
-}
-
-// We don't allow single-entry tuples in the true AST; that indicates a
-// parenthesized expression.  However, we preserve them temporarily while
-// parsing because `(while{...})+3` parses differently from `while{...}+3`.
-//
-// To reflect the fact that the @ast::expr is not a true expr that should be
-// part of the AST, we wrap such expressions in the pexpr enum.  They
-// can then be converted to true expressions by a call to `to_expr()`.
-enum pexpr {
-    pexpr(@ast::expr),
-}
-
-fn mk_pexpr(p: parser, lo: uint, hi: uint, node: ast::expr_) -> pexpr {
-    ret pexpr(mk_expr(p, lo, hi, node));
-}
-
-fn to_expr(e: pexpr) -> @ast::expr {
-    alt e.node {
-      ast::expr_tup(es) if vec::len(es) == 1u { es[0u] }
-      _ { *e }
-    }
-}
-
-fn parse_bottom_expr(p: parser) -> pexpr {
-    let lo = p.span.lo;
-    let hi = p.span.hi;
-
-    let ex: ast::expr_;
-
-    alt have_dollar(p) {
-      some(x) {ret pexpr(mk_mac_expr(p, lo, p.span.hi, x));}
-      _ {}
-    }
-
-    if p.token == token::LPAREN {
-        p.bump();
-        if p.token == token::RPAREN {
-            hi = p.span.hi;
-            p.bump();
-            let lit = @spanned(lo, hi, ast::lit_nil);
-            ret mk_pexpr(p, lo, hi, ast::expr_lit(lit));
-        }
-        let es = [parse_expr(p)];
-        while p.token == token::COMMA { p.bump(); es += [parse_expr(p)]; }
-        hi = p.span.hi;
-        expect(p, token::RPAREN);
-
-        // Note: we retain the expr_tup() even for simple
-        // parenthesized expressions, but only for a "little while".
-        // This is so that wrappers around parse_bottom_expr()
-        // can tell whether the expression was parenthesized or not,
-        // which affects expr_is_complete().
-        ret mk_pexpr(p, lo, hi, ast::expr_tup(es));
-    } else if p.token == token::LBRACE {
-        p.bump();
-        if is_word(p, "mut") || is_word(p, "mutable") ||
-               is_plain_ident(p) && p.look_ahead(1u) == token::COLON {
-            let fields = [parse_field(p, token::COLON)];
-            let base = none;
-            while p.token != token::RBRACE {
-                if eat_word(p, "with") { base = some(parse_expr(p)); break; }
-                expect(p, token::COMMA);
-                if p.token == token::RBRACE {
-                    // record ends by an optional trailing comma
-                    break;
-                }
-                fields += [parse_field(p, token::COLON)];
-            }
-            hi = p.span.hi;
-            expect(p, token::RBRACE);
-            ex = ast::expr_rec(fields, base);
-        } else if is_bar(p.token) {
-            ret pexpr(parse_fn_block_expr(p));
-        } else {
-            let blk = parse_block_tail(p, lo, ast::default_blk);
-            ret mk_pexpr(p, blk.span.lo, blk.span.hi, ast::expr_block(blk));
-        }
-    } else if eat_word(p, "if") {
-        ret pexpr(parse_if_expr(p));
-    } else if eat_word(p, "for") {
-        ret pexpr(parse_for_expr(p));
-    } else if eat_word(p, "while") {
-        ret pexpr(parse_while_expr(p));
-    } else if eat_word(p, "do") {
-        ret pexpr(parse_do_while_expr(p));
-    } else if eat_word(p, "alt") {
-        ret pexpr(parse_alt_expr(p));
-    } else if eat_word(p, "fn") {
-        let proto = parse_fn_ty_proto(p);
-        alt proto {
-          ast::proto_bare { p.fatal("fn expr are deprecated, use fn@"); }
-          ast::proto_any { p.fatal("fn* cannot be used in an expression"); }
-          _ { /* fallthrough */ }
-        }
-        ret pexpr(parse_fn_expr(p, proto));
-    } else if eat_word(p, "unchecked") {
-        ret pexpr(parse_block_expr(p, lo, ast::unchecked_blk));
-    } else if eat_word(p, "unsafe") {
-        ret pexpr(parse_block_expr(p, lo, ast::unsafe_blk));
-    } else if p.token == token::LBRACKET {
-        p.bump();
-        let mutbl = parse_mutability(p);
-        let es =
-            parse_seq_to_end(token::RBRACKET, seq_sep(token::COMMA),
-                             parse_expr, p);
-        ex = ast::expr_vec(es, mutbl);
-    } else if p.token == token::POUND_LT {
-        p.bump();
-        let ty = parse_ty(p, false);
-        expect(p, token::GT);
-
-        /* hack: early return to take advantage of specialized function */
-        ret pexpr(mk_mac_expr(p, lo, p.span.hi,
-                              ast::mac_embed_type(ty)));
-    } else if p.token == token::POUND_LBRACE {
-        p.bump();
-        let blk = ast::mac_embed_block(
-            parse_block_tail(p, lo, ast::default_blk));
-        ret pexpr(mk_mac_expr(p, lo, p.span.hi, blk));
-    } else if p.token == token::ELLIPSIS {
-        p.bump();
-        ret pexpr(mk_mac_expr(p, lo, p.span.hi, ast::mac_ellipsis));
-    } else if eat_word(p, "bind") {
-        let e = parse_expr_res(p, RESTRICT_NO_CALL_EXPRS);
-        let es =
-            parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                      parse_expr_or_hole, p);
-        hi = es.span.hi;
-        ex = ast::expr_bind(e, es.node);
-    } else if p.token == token::POUND {
-        let ex_ext = parse_syntax_ext(p);
-        hi = ex_ext.span.hi;
-        ex = ex_ext.node;
-    } else if eat_word(p, "fail") {
-        if can_begin_expr(p.token) {
-            let e = parse_expr(p);
-            hi = e.span.hi;
-            ex = ast::expr_fail(some(e));
-        } else { ex = ast::expr_fail(none); }
-    } else if eat_word(p, "log") {
-        expect(p, token::LPAREN);
-        let lvl = parse_expr(p);
-        expect(p, token::COMMA);
-        let e = parse_expr(p);
-        ex = ast::expr_log(2, lvl, e);
-        hi = p.span.hi;
-        expect(p, token::RPAREN);
-    } else if eat_word(p, "assert") {
-        let e = parse_expr(p);
-        ex = ast::expr_assert(e);
-        hi = e.span.hi;
-    } else if eat_word(p, "check") {
-        /* Should be a predicate (pure boolean function) applied to
-           arguments that are all either slot variables or literals.
-           but the typechecker enforces that. */
-        let e = parse_expr(p);
-        hi = e.span.hi;
-        ex = ast::expr_check(ast::checked_expr, e);
-    } else if eat_word(p, "claim") {
-        /* Same rules as check, except that if check-claims
-         is enabled (a command-line flag), then the parser turns
-        claims into check */
-
-        let e = parse_expr(p);
-        hi = e.span.hi;
-        ex = ast::expr_check(ast::claimed_expr, e);
-    } else if eat_word(p, "ret") {
-        if can_begin_expr(p.token) {
-            let e = parse_expr(p);
-            hi = e.span.hi;
-            ex = ast::expr_ret(some(e));
-        } else { ex = ast::expr_ret(none); }
-    } else if eat_word(p, "break") {
-        ex = ast::expr_break;
-        hi = p.span.hi;
-    } else if eat_word(p, "cont") {
-        ex = ast::expr_cont;
-        hi = p.span.hi;
-    } else if eat_word(p, "be") {
-        let e = parse_expr(p);
-
-        // FIXME: Is this the right place for this check?
-        if /*check*/ast_util::is_call_expr(e) {
-            hi = e.span.hi;
-            ex = ast::expr_be(e);
-        } else { p.fatal("Non-call expression in tail call"); }
-    } else if eat_word(p, "copy") {
-        let e = parse_expr(p);
-        ex = ast::expr_copy(e);
-        hi = e.span.hi;
-    } else if p.token == token::MOD_SEP ||
-                  is_ident(p.token) && !is_word(p, "true") &&
-                      !is_word(p, "false") {
-        check_bad_word(p);
-        let pth = parse_path_and_ty_param_substs(p, true);
-        hi = pth.span.hi;
-        ex = ast::expr_path(pth);
-    } else {
-        let lit = parse_lit(p);
-        hi = lit.span.hi;
-        ex = ast::expr_lit(@lit);
-    }
-    ret mk_pexpr(p, lo, hi, ex);
-}
-
-fn parse_block_expr(p: parser,
-                    lo: uint,
-                    blk_mode: ast::blk_check_mode) -> @ast::expr {
-    expect(p, token::LBRACE);
-    let blk = parse_block_tail(p, lo, blk_mode);
-    ret mk_expr(p, blk.span.lo, blk.span.hi, ast::expr_block(blk));
-}
-
-fn parse_syntax_ext(p: parser) -> @ast::expr {
-    let lo = p.span.lo;
-    expect(p, token::POUND);
-    ret parse_syntax_ext_naked(p, lo);
-}
-
-fn parse_syntax_ext_naked(p: parser, lo: uint) -> @ast::expr {
-    alt p.token {
-      token::IDENT(_, _) {}
-      _ { p.fatal("expected a syntax expander name"); }
-    }
-    let pth = parse_path(p);
-    //temporary for a backwards-compatible cycle:
-    let sep = seq_sep(token::COMMA);
-    let e = none;
-    if (p.token == token::LPAREN || p.token == token::LBRACKET) {
-        let es =
-            if p.token == token::LPAREN {
-                parse_seq(token::LPAREN, token::RPAREN,
-                          sep, parse_expr, p)
-            } else {
-                parse_seq(token::LBRACKET, token::RBRACKET,
-                          sep, parse_expr, p)
-            };
-        let hi = es.span.hi;
-        e = some(mk_expr(p, es.span.lo, hi,
-                         ast::expr_vec(es.node, ast::m_imm)));
-    }
-    let b = none;
-    if p.token == token::LBRACE {
-        p.bump();
-        let lo = p.span.lo;
-        let depth = 1u;
-        while (depth > 0u) {
-            alt (p.token) {
-              token::LBRACE {depth += 1u;}
-              token::RBRACE {depth -= 1u;}
-              token::EOF {p.fatal("unexpected EOF in macro body");}
-              _ {}
-            }
-            p.bump();
-        }
-        let hi = p.last_span.lo;
-        b = some({span: mk_sp(lo,hi)});
-    }
-    ret mk_mac_expr(p, lo, p.span.hi, ast::mac_invoc(pth, e, b));
-}
-
-fn parse_dot_or_call_expr(p: parser) -> pexpr {
-    let b = parse_bottom_expr(p);
-    parse_dot_or_call_expr_with(p, b)
-}
-
-fn permits_call(p: parser) -> bool {
-    ret p.restriction != RESTRICT_NO_CALL_EXPRS;
-}
-
-fn parse_dot_or_call_expr_with(p: parser, e0: pexpr) -> pexpr {
-    let e = e0;
-    let lo = e.span.lo;
-    let hi = e.span.hi;
-    while true {
-        // expr.f
-        if eat(p, token::DOT) {
-            alt p.token {
-              token::IDENT(i, _) {
-                hi = p.span.hi;
-                p.bump();
-                let tys = if eat(p, token::MOD_SEP) {
-                    expect(p, token::LT);
-                    parse_seq_to_gt(some(token::COMMA),
-                                    {|p| parse_ty(p, false)}, p)
-                } else { [] };
-                e = mk_pexpr(p, lo, hi,
-                             ast::expr_field(to_expr(e),
-                                             p.get_str(i),
-                                             tys));
-              }
-              t { unexpected(p, t); }
-            }
-            cont;
-        }
-        if expr_is_complete(p, e) { break; }
-        alt p.token {
-          // expr(...)
-          token::LPAREN if permits_call(p) {
-            let es_opt =
-                parse_seq(token::LPAREN, token::RPAREN,
-                          seq_sep(token::COMMA), parse_expr_or_hole, p);
-            hi = es_opt.span.hi;
-
-            let nd =
-                if vec::any(es_opt.node, {|e| option::is_none(e) }) {
-                    ast::expr_bind(to_expr(e), es_opt.node)
-                } else {
-                    let es = vec::map(es_opt.node) {|e| option::get(e) };
-                    ast::expr_call(to_expr(e), es, false)
-                };
-            e = mk_pexpr(p, lo, hi, nd);
-          }
-
-          // expr {|| ... }
-          token::LBRACE if is_bar(p.look_ahead(1u)) && permits_call(p) {
-            p.bump();
-            let blk = parse_fn_block_expr(p);
-            alt e.node {
-              ast::expr_call(f, args, false) {
-                e = pexpr(@{node: ast::expr_call(f, args + [blk], true)
-                            with *to_expr(e)});
-              }
-              _ {
-                e = mk_pexpr(p, lo, p.last_span.hi,
-                            ast::expr_call(to_expr(e), [blk], true));
-              }
-            }
-          }
-
-          // expr[...]
-          token::LBRACKET {
-            p.bump();
-            let ix = parse_expr(p);
-            hi = ix.span.hi;
-            expect(p, token::RBRACKET);
-            p.get_id(); // see ast_util::op_expr_callee_id
-            e = mk_pexpr(p, lo, hi, ast::expr_index(to_expr(e), ix));
-          }
-
-          _ { ret e; }
-        }
-    }
-    ret e;
-}
-
-fn parse_prefix_expr(p: parser) -> pexpr {
-    let lo = p.span.lo;
-    let hi = p.span.hi;
-
-    let ex;
-    alt p.token {
-      token::NOT {
-        p.bump();
-        let e = to_expr(parse_prefix_expr(p));
-        hi = e.span.hi;
-        p.get_id(); // see ast_util::op_expr_callee_id
-        ex = ast::expr_unary(ast::not, e);
-      }
-      token::BINOP(b) {
-        alt b {
-          token::MINUS {
-            p.bump();
-            let e = to_expr(parse_prefix_expr(p));
-            hi = e.span.hi;
-            p.get_id(); // see ast_util::op_expr_callee_id
-            ex = ast::expr_unary(ast::neg, e);
-          }
-          token::STAR {
-            p.bump();
-            let e = to_expr(parse_prefix_expr(p));
-            hi = e.span.hi;
-            ex = ast::expr_unary(ast::deref, e);
-          }
-          _ { ret parse_dot_or_call_expr(p); }
-        }
-      }
-      token::AT {
-        p.bump();
-        let m = parse_mutability(p);
-        let e = to_expr(parse_prefix_expr(p));
-        hi = e.span.hi;
-        ex = ast::expr_unary(ast::box(m), e);
-      }
-      token::TILDE {
-        p.bump();
-        let m = parse_mutability(p);
-        let e = to_expr(parse_prefix_expr(p));
-        hi = e.span.hi;
-        ex = ast::expr_unary(ast::uniq(m), e);
-      }
-      _ { ret parse_dot_or_call_expr(p); }
-    }
-    ret mk_pexpr(p, lo, hi, ex);
-}
-
-type op_spec = {tok: token::token, op: ast::binop, prec: int};
-
-
-// FIXME make this a const, don't store it in parser state
-fn prec_table() -> @[op_spec] {
-    ret @[// 'as' sits between here with 12
-          {tok: token::BINOP(token::STAR), op: ast::mul, prec: 11},
-          {tok: token::BINOP(token::SLASH), op: ast::div, prec: 11},
-          {tok: token::BINOP(token::PERCENT), op: ast::rem, prec: 11},
-          {tok: token::BINOP(token::PLUS), op: ast::add, prec: 10},
-          {tok: token::BINOP(token::MINUS), op: ast::subtract, prec: 10},
-          {tok: token::BINOP(token::LSL), op: ast::lsl, prec: 9},
-          {tok: token::BINOP(token::LSR), op: ast::lsr, prec: 9},
-          {tok: token::BINOP(token::ASR), op: ast::asr, prec: 9},
-          {tok: token::BINOP(token::AND), op: ast::bitand, prec: 8},
-          {tok: token::BINOP(token::CARET), op: ast::bitxor, prec: 7},
-          {tok: token::BINOP(token::OR), op: ast::bitor, prec: 6},
-          {tok: token::LT, op: ast::lt, prec: 4},
-          {tok: token::LE, op: ast::le, prec: 4},
-          {tok: token::GE, op: ast::ge, prec: 4},
-          {tok: token::GT, op: ast::gt, prec: 4},
-          {tok: token::EQEQ, op: ast::eq, prec: 3},
-          {tok: token::NE, op: ast::ne, prec: 3},
-          {tok: token::ANDAND, op: ast::and, prec: 2},
-          {tok: token::OROR, op: ast::or, prec: 1}];
-}
-
-fn parse_binops(p: parser) -> @ast::expr {
-    ret parse_more_binops(p, parse_prefix_expr(p), 0);
-}
-
-const unop_prec: int = 100;
-
-const as_prec: int = 12;
-
-fn parse_more_binops(p: parser, plhs: pexpr, min_prec: int) ->
-   @ast::expr {
-    let lhs = to_expr(plhs);
-    if expr_is_complete(p, plhs) { ret lhs; }
-    let peeked = p.token;
-    if peeked == token::BINOP(token::OR) &&
-       p.restriction == RESTRICT_NO_BAR_OP { ret lhs; }
-    for cur: op_spec in *p.precs {
-        if cur.prec > min_prec && cur.tok == peeked {
-            p.bump();
-            let expr = parse_prefix_expr(p);
-            let rhs = parse_more_binops(p, expr, cur.prec);
-            p.get_id(); // see ast_util::op_expr_callee_id
-            let bin = mk_pexpr(p, lhs.span.lo, rhs.span.hi,
-                              ast::expr_binary(cur.op, lhs, rhs));
-            ret parse_more_binops(p, bin, min_prec);
-        }
-    }
-    if as_prec > min_prec && eat_word(p, "as") {
-        let rhs = parse_ty(p, true);
-        let _as =
-            mk_pexpr(p, lhs.span.lo, rhs.span.hi, ast::expr_cast(lhs, rhs));
-        ret parse_more_binops(p, _as, min_prec);
-    }
-    ret lhs;
-}
-
-fn parse_assign_expr(p: parser) -> @ast::expr {
-    let lo = p.span.lo;
-    let lhs = parse_binops(p);
-    alt p.token {
-      token::EQ {
-        p.bump();
-        let rhs = parse_expr(p);
-        ret mk_expr(p, lo, rhs.span.hi, ast::expr_assign(lhs, rhs));
-      }
-      token::BINOPEQ(op) {
-        p.bump();
-        let rhs = parse_expr(p);
-        let aop = ast::add;
-        alt op {
-          token::PLUS { aop = ast::add; }
-          token::MINUS { aop = ast::subtract; }
-          token::STAR { aop = ast::mul; }
-          token::SLASH { aop = ast::div; }
-          token::PERCENT { aop = ast::rem; }
-          token::CARET { aop = ast::bitxor; }
-          token::AND { aop = ast::bitand; }
-          token::OR { aop = ast::bitor; }
-          token::LSL { aop = ast::lsl; }
-          token::LSR { aop = ast::lsr; }
-          token::ASR { aop = ast::asr; }
-        }
-        p.get_id(); // see ast_util::op_expr_callee_id
-        ret mk_expr(p, lo, rhs.span.hi, ast::expr_assign_op(aop, lhs, rhs));
-      }
-      token::LARROW {
-        p.bump();
-        let rhs = parse_expr(p);
-        ret mk_expr(p, lo, rhs.span.hi, ast::expr_move(lhs, rhs));
-      }
-      token::DARROW {
-        p.bump();
-        let rhs = parse_expr(p);
-        ret mk_expr(p, lo, rhs.span.hi, ast::expr_swap(lhs, rhs));
-      }
-      _ {/* fall through */ }
-    }
-    ret lhs;
-}
-
-fn parse_if_expr_1(p: parser) ->
-   {cond: @ast::expr,
-    then: ast::blk,
-    els: option<@ast::expr>,
-    lo: uint,
-    hi: uint} {
-    let lo = p.last_span.lo;
-    let cond = parse_expr(p);
-    let thn = parse_block(p);
-    let els: option<@ast::expr> = none;
-    let hi = thn.span.hi;
-    if eat_word(p, "else") {
-        let elexpr = parse_else_expr(p);
-        els = some(elexpr);
-        hi = elexpr.span.hi;
-    }
-    ret {cond: cond, then: thn, els: els, lo: lo, hi: hi};
-}
-
-fn parse_if_expr(p: parser) -> @ast::expr {
-    if eat_word(p, "check") {
-        let q = parse_if_expr_1(p);
-        ret mk_expr(p, q.lo, q.hi, ast::expr_if_check(q.cond, q.then, q.els));
-    } else {
-        let q = parse_if_expr_1(p);
-        ret mk_expr(p, q.lo, q.hi, ast::expr_if(q.cond, q.then, q.els));
-    }
-}
-
-// Parses:
-//
-//   CC := [copy ID*; move ID*]
-//
-// where any part is optional and trailing ; is permitted.
-fn parse_capture_clause(p: parser) -> @ast::capture_clause {
-    fn expect_opt_trailing_semi(p: parser) {
-        if !eat(p, token::SEMI) {
-            if p.token != token::RBRACKET {
-                p.fatal("expecting ; or ]");
-            }
-        }
-    }
-
-    fn eat_ident_list(p: parser) -> [@ast::capture_item] {
-        let res = [];
-        while true {
-            alt p.token {
-              token::IDENT(_, _) {
-                let id = p.get_id();
-                let sp = ast_util::mk_sp(p.span.lo, p.span.hi);
-                let ident = parse_ident(p);
-                res += [@{id:id, name:ident, span:sp}];
-                if !eat(p, token::COMMA) {
-                    ret res;
-                }
-              }
-
-              _ { ret res; }
-            }
-        }
-        std::util::unreachable();
-    }
-
-    let copies = [];
-    let moves = [];
-
-    if eat(p, token::LBRACKET) {
-        while !eat(p, token::RBRACKET) {
-            if eat_word(p, "copy") {
-                copies += eat_ident_list(p);
-                expect_opt_trailing_semi(p);
-            } else if eat_word(p, "move") {
-                moves += eat_ident_list(p);
-                expect_opt_trailing_semi(p);
-            } else {
-                let s: str = "expecting send, copy, or move clause";
-                p.fatal(s);
-            }
-        }
-    }
-
-    ret @{copies: copies, moves: moves};
-}
-
-fn parse_fn_expr(p: parser, proto: ast::proto) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let capture_clause = parse_capture_clause(p);
-    let decl = parse_fn_decl(p, ast::impure_fn);
-    let body = parse_block(p);
-    ret mk_expr(p, lo, body.span.hi,
-                ast::expr_fn(proto, decl, body, capture_clause));
-}
-
-fn parse_fn_block_expr(p: parser) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let decl = parse_fn_block_decl(p);
-    let body = parse_block_tail(p, lo, ast::default_blk);
-    ret mk_expr(p, lo, body.span.hi, ast::expr_fn_block(decl, body));
-}
-
-fn parse_else_expr(p: parser) -> @ast::expr {
-    if eat_word(p, "if") {
-        ret parse_if_expr(p);
-    } else {
-        let blk = parse_block(p);
-        ret mk_expr(p, blk.span.lo, blk.span.hi, ast::expr_block(blk));
-    }
-}
-
-fn parse_for_expr(p: parser) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let decl = parse_local(p, false, false);
-    expect_word(p, "in");
-    let seq = parse_expr(p);
-    let body = parse_block_no_value(p);
-    let hi = body.span.hi;
-    ret mk_expr(p, lo, hi, ast::expr_for(decl, seq, body));
-}
-
-fn parse_while_expr(p: parser) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let cond = parse_expr(p);
-    let body = parse_block_no_value(p);
-    let hi = body.span.hi;
-    ret mk_expr(p, lo, hi, ast::expr_while(cond, body));
-}
-
-fn parse_do_while_expr(p: parser) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let body = parse_block_no_value(p);
-    expect_word(p, "while");
-    let cond = parse_expr(p);
-    let hi = cond.span.hi;
-    ret mk_expr(p, lo, hi, ast::expr_do_while(body, cond));
-}
-
-fn parse_alt_expr(p: parser) -> @ast::expr {
-    let lo = p.last_span.lo;
-    let mode = if eat_word(p, "check") { ast::alt_check }
-               else { ast::alt_exhaustive };
-    let discriminant = parse_expr(p);
-    expect(p, token::LBRACE);
-    let arms: [ast::arm] = [];
-    while p.token != token::RBRACE {
-        let pats = parse_pats(p);
-        let guard = none;
-        if eat_word(p, "if") { guard = some(parse_expr(p)); }
-        let blk = parse_block(p);
-        arms += [{pats: pats, guard: guard, body: blk}];
-    }
-    let hi = p.span.hi;
-    p.bump();
-    ret mk_expr(p, lo, hi, ast::expr_alt(discriminant, arms, mode));
-}
-
-fn parse_expr(p: parser) -> @ast::expr {
-    ret parse_expr_res(p, UNRESTRICTED);
-}
-
-fn parse_expr_or_hole(p: parser) -> option<@ast::expr> {
-    alt p.token {
-      token::UNDERSCORE { p.bump(); ret none; }
-      _ { ret some(parse_expr(p)); }
-    }
-}
-
-fn parse_expr_res(p: parser, r: restriction) -> @ast::expr {
-    let old = p.restriction;
-    p.restriction = r;
-    let e = parse_assign_expr(p);
-    p.restriction = old;
-    ret e;
-}
-
-fn parse_initializer(p: parser) -> option<ast::initializer> {
-    alt p.token {
-      token::EQ {
-        p.bump();
-        ret some({op: ast::init_assign, expr: parse_expr(p)});
-      }
-      token::LARROW {
-        p.bump();
-        ret some({op: ast::init_move, expr: parse_expr(p)});
-      }
-      // Now that the the channel is the first argument to receive,
-      // combining it with an initializer doesn't really make sense.
-      // case (token::RECV) {
-      //     p.bump();
-      //     ret some(rec(op = ast::init_recv,
-      //                  expr = parse_expr(p)));
-      // }
-      _ {
-        ret none;
-      }
-    }
-}
-
-fn parse_pats(p: parser) -> [@ast::pat] {
-    let pats = [];
-    while true {
-        pats += [parse_pat(p)];
-        if p.token == token::BINOP(token::OR) { p.bump(); } else { break; }
-    }
-    ret pats;
-}
-
-fn parse_pat(p: parser) -> @ast::pat {
-    let lo = p.span.lo;
-    let hi = p.span.hi;
-    let pat;
-    alt p.token {
-      token::UNDERSCORE { p.bump(); pat = ast::pat_wild; }
-      token::AT {
-        p.bump();
-        let sub = parse_pat(p);
-        pat = ast::pat_box(sub);
-        hi = sub.span.hi;
-      }
-      token::TILDE {
-        p.bump();
-        let sub = parse_pat(p);
-        pat = ast::pat_uniq(sub);
-        hi = sub.span.hi;
-      }
-      token::LBRACE {
-        p.bump();
-        let fields = [];
-        let etc = false;
-        let first = true;
-        while p.token != token::RBRACE {
-            if first { first = false; } else { expect(p, token::COMMA); }
-
-            if p.token == token::UNDERSCORE {
-                p.bump();
-                if p.token != token::RBRACE {
-                    p.fatal("expecting }, found " +
-                                token::to_str(p.reader, p.token));
-                }
-                etc = true;
-                break;
-            }
-
-            let lo1 = p.last_span.lo;
-            let fieldname = parse_ident(p);
-            let hi1 = p.last_span.lo;
-            let fieldpath = ast_util::ident_to_path(ast_util::mk_sp(lo1, hi1),
-                                          fieldname);
-            let subpat;
-            if p.token == token::COLON {
-                p.bump();
-                subpat = parse_pat(p);
-            } else {
-                if p.bad_expr_words.contains_key(fieldname) {
-                    p.fatal("found " + fieldname + " in binding position");
-                }
-                subpat = @{id: p.get_id(),
-                           node: ast::pat_ident(fieldpath, none),
-                           span: ast_util::mk_sp(lo, hi)};
-            }
-            fields += [{ident: fieldname, pat: subpat}];
-        }
-        hi = p.span.hi;
-        p.bump();
-        pat = ast::pat_rec(fields, etc);
-      }
-      token::LPAREN {
-        p.bump();
-        if p.token == token::RPAREN {
-            hi = p.span.hi;
-            p.bump();
-            let lit = @{node: ast::lit_nil, span: ast_util::mk_sp(lo, hi)};
-            let expr = mk_expr(p, lo, hi, ast::expr_lit(lit));
-            pat = ast::pat_lit(expr);
-        } else {
-            let fields = [parse_pat(p)];
-            while p.token == token::COMMA {
-                p.bump();
-                fields += [parse_pat(p)];
-            }
-            if vec::len(fields) == 1u { expect(p, token::COMMA); }
-            hi = p.span.hi;
-            expect(p, token::RPAREN);
-            pat = ast::pat_tup(fields);
-        }
-      }
-      tok {
-        if !is_ident(tok) || is_word(p, "true") || is_word(p, "false") {
-            let val = parse_expr_res(p, RESTRICT_NO_BAR_OP);
-            if eat_word(p, "to") {
-                let end = parse_expr_res(p, RESTRICT_NO_BAR_OP);
-                hi = end.span.hi;
-                pat = ast::pat_range(val, end);
-            } else {
-                hi = val.span.hi;
-                pat = ast::pat_lit(val);
-            }
-        } else if is_plain_ident(p) &&
-            alt p.look_ahead(1u) {
-              token::LPAREN | token::LBRACKET | token::LT { false }
-              _ { true }
-            } {
-            let name = parse_value_path(p);
-            let sub = if eat(p, token::AT) { some(parse_pat(p)) }
-                      else { none };
-            pat = ast::pat_ident(name, sub);
-        } else {
-            let enum_path = parse_path_and_ty_param_substs(p, true);
-            hi = enum_path.span.hi;
-            let args: [@ast::pat];
-            alt p.token {
-              token::LPAREN {
-                let a =
-                    parse_seq(token::LPAREN, token::RPAREN,
-                              seq_sep(token::COMMA), parse_pat, p);
-                args = a.node;
-                hi = a.span.hi;
-              }
-              _ { args = []; }
-            }
-            // at this point, we're not sure whether it's a enum or a bind
-            if vec::len(args) == 0u &&
-               vec::len(enum_path.node.idents) == 1u {
-                pat = ast::pat_ident(enum_path, none);
-            }
-            else {
-                pat = ast::pat_enum(enum_path, args);
-            }
-        }
-      }
-    }
-    ret @{id: p.get_id(), node: pat, span: ast_util::mk_sp(lo, hi)};
-}
-
-fn parse_local(p: parser, is_mutbl: bool,
-               allow_init: bool) -> @ast::local {
-    let lo = p.span.lo;
-    let pat = parse_pat(p);
-    let ty = @spanned(lo, lo, ast::ty_infer);
-    if eat(p, token::COLON) { ty = parse_ty(p, false); }
-    let init = if allow_init { parse_initializer(p) } else { none };
-    ret @spanned(lo, p.last_span.hi,
-                 {is_mutbl: is_mutbl, ty: ty, pat: pat,
-                  init: init, id: p.get_id()});
-}
-
-fn parse_let(p: parser) -> @ast::decl {
-    let is_mutbl = eat_word(p, "mut");
-    let lo = p.span.lo;
-    let locals = [parse_local(p, is_mutbl, true)];
-    while eat(p, token::COMMA) {
-        locals += [parse_local(p, is_mutbl, true)];
-    }
-    ret @spanned(lo, p.last_span.hi, ast::decl_local(locals));
-}
-
-fn parse_instance_var(p:parser) -> ast::class_member {
-    let is_mutbl = ast::class_immutable;
-    expect_word(p, "let");
-    if eat_word(p, "mut") || eat_word(p, "mutable") {
-            is_mutbl = ast::class_mutable;
-    }
-    if !is_plain_ident(p) {
-        p.fatal("expecting ident");
-    }
-    let name = parse_ident(p);
-    expect(p, token::COLON);
-    let ty = parse_ty(p, false);
-    ret ast::instance_var(name, ty, is_mutbl, p.get_id());
-}
-
-fn parse_stmt(p: parser, first_item_attrs: [ast::attribute]) -> @ast::stmt {
-    fn check_expected_item(p: parser, current_attrs: [ast::attribute]) {
-        // If we have attributes then we should have an item
-        if vec::is_not_empty(current_attrs) {
-            p.fatal("expected item");
-        }
-    }
-
-    let lo = p.span.lo;
-    if is_word(p, "let") {
-        check_expected_item(p, first_item_attrs);
-        expect_word(p, "let");
-        let decl = parse_let(p);
-        ret @spanned(lo, decl.span.hi, ast::stmt_decl(decl, p.get_id()));
-    } else {
-        let item_attrs;
-        alt parse_outer_attrs_or_ext(p, first_item_attrs) {
-          none { item_attrs = []; }
-          some(left(attrs)) { item_attrs = attrs; }
-          some(right(ext)) {
-            ret @spanned(lo, ext.span.hi, ast::stmt_expr(ext, p.get_id()));
-          }
-        }
-
-        let item_attrs = first_item_attrs + item_attrs;
-
-        alt parse_item(p, item_attrs) {
-          some(i) {
-            let hi = i.span.hi;
-            let decl = @spanned(lo, hi, ast::decl_item(i));
-            ret @spanned(lo, hi, ast::stmt_decl(decl, p.get_id()));
-          }
-          none() { /* fallthrough */ }
-        }
-
-        check_expected_item(p, item_attrs);
-
-        // Remainder are line-expr stmts.
-        let e = parse_expr_res(p, RESTRICT_STMT_EXPR);
-        ret @spanned(lo, e.span.hi, ast::stmt_expr(e, p.get_id()));
-    }
-}
-
-fn expr_is_complete(p: parser, e: pexpr) -> bool {
-    log(debug, ("expr_is_complete", p.restriction,
-                print::pprust::expr_to_str(*e),
-                expr_requires_semi_to_be_stmt(*e)));
-    ret p.restriction == RESTRICT_STMT_EXPR &&
-        !expr_requires_semi_to_be_stmt(*e);
-}
-
-fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
-    alt e.node {
-      ast::expr_if(_, _, _) | ast::expr_if_check(_, _, _)
-      | ast::expr_alt(_, _, _) | ast::expr_block(_)
-      | ast::expr_do_while(_, _) | ast::expr_while(_, _)
-      | ast::expr_for(_, _, _)
-      | ast::expr_call(_, _, true) {
-        false
-      }
-      _ { true }
-    }
-}
-
-fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
-    alt stmt.node {
-      ast::stmt_decl(d, _) {
-        ret alt d.node {
-              ast::decl_local(_) { true }
-              ast::decl_item(_) { false }
-            }
-      }
-      ast::stmt_expr(e, _) {
-        ret expr_requires_semi_to_be_stmt(e);
-      }
-      ast::stmt_semi(e, _) {
-        ret false;
-      }
-    }
-}
-
-fn parse_block(p: parser) -> ast::blk {
-    let (attrs, blk) = parse_inner_attrs_and_block(p, false);
-    assert vec::is_empty(attrs);
-    ret blk;
-}
-
-fn parse_inner_attrs_and_block(
-    p: parser, parse_attrs: bool) -> ([ast::attribute], ast::blk) {
-
-    fn maybe_parse_inner_attrs_and_next(
-        p: parser, parse_attrs: bool) ->
-        {inner: [ast::attribute], next: [ast::attribute]} {
-        if parse_attrs {
-            parse_inner_attrs_and_next(p)
-        } else {
-            {inner: [], next: []}
-        }
-    }
-
-    let lo = p.span.lo;
-    if eat_word(p, "unchecked") {
-        expect(p, token::LBRACE);
-        let {inner, next} = maybe_parse_inner_attrs_and_next(p, parse_attrs);
-        ret (inner, parse_block_tail_(p, lo, ast::unchecked_blk, next));
-    } else if eat_word(p, "unsafe") {
-        expect(p, token::LBRACE);
-        let {inner, next} = maybe_parse_inner_attrs_and_next(p, parse_attrs);
-        ret (inner, parse_block_tail_(p, lo, ast::unsafe_blk, next));
-    } else {
-        expect(p, token::LBRACE);
-        let {inner, next} = maybe_parse_inner_attrs_and_next(p, parse_attrs);
-        ret (inner, parse_block_tail_(p, lo, ast::default_blk, next));
-    }
-}
-
-fn parse_block_no_value(p: parser) -> ast::blk {
-    // We parse blocks that cannot have a value the same as any other block;
-    // the type checker will make sure that the tail expression (if any) has
-    // unit type.
-    ret parse_block(p);
-}
-
-// Precondition: already parsed the '{' or '#{'
-// I guess that also means "already parsed the 'impure'" if
-// necessary, and this should take a qualifier.
-// some blocks start with "#{"...
-fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk {
-    parse_block_tail_(p, lo, s, [])
-}
-
-fn parse_block_tail_(p: parser, lo: uint, s: ast::blk_check_mode,
-                     first_item_attrs: [ast::attribute]) -> ast::blk {
-    let stmts = [];
-    let expr = none;
-    let view_items = maybe_parse_view_import_only(p, first_item_attrs);
-    let initial_attrs = first_item_attrs;
-
-    if p.token == token::RBRACE && !vec::is_empty(initial_attrs) {
-        p.fatal("expected item");
-    }
-
-    while p.token != token::RBRACE {
-        alt p.token {
-          token::SEMI {
-            p.bump(); // empty
-          }
-          _ {
-            let stmt = parse_stmt(p, initial_attrs);
-            initial_attrs = [];
-            alt stmt.node {
-              ast::stmt_expr(e, stmt_id) { // Expression without semicolon:
-                alt p.token {
-                  token::SEMI {
-                    p.bump();
-                    stmts += [@{node: ast::stmt_semi(e, stmt_id) with *stmt}];
-                  }
-                  token::RBRACE {
-                    expr = some(e);
-                  }
-                  t {
-                    if stmt_ends_with_semi(*stmt) {
-                        p.fatal("expected ';' or '}' after expression but \
-                                 found '" + token::to_str(p.reader, t) +
-                                "'");
-                    }
-                    stmts += [stmt];
-                  }
-                }
-              }
-
-              _ { // All other kinds of statements:
-                stmts += [stmt];
-
-                if stmt_ends_with_semi(*stmt) {
-                    expect(p, token::SEMI);
-                }
-              }
-            }
-          }
-        }
-    }
-    let hi = p.span.hi;
-    p.bump();
-    let bloc = {view_items: view_items, stmts: stmts, expr: expr,
-                id: p.get_id(), rules: s};
-    ret spanned(lo, hi, bloc);
-}
-
-fn parse_ty_param(p: parser) -> ast::ty_param {
-    let bounds = [];
-    let ident = parse_ident(p);
-    if eat(p, token::COLON) {
-        while p.token != token::COMMA && p.token != token::GT {
-            if eat_word(p, "send") { bounds += [ast::bound_send]; }
-            else if eat_word(p, "copy") { bounds += [ast::bound_copy]; }
-            else { bounds += [ast::bound_iface(parse_ty(p, false))]; }
-        }
-    }
-    ret {ident: ident, id: p.get_id(), bounds: @bounds};
-}
-
-fn parse_ty_params(p: parser) -> [ast::ty_param] {
-    if eat(p, token::LT) {
-        parse_seq_to_gt(some(token::COMMA), parse_ty_param, p)
-    } else { [] }
-}
-
-fn parse_fn_decl(p: parser, purity: ast::purity)
-    -> ast::fn_decl {
-    let inputs: ast::spanned<[ast::arg]> =
-        parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                  parse_arg, p);
-    // Use the args list to translate each bound variable
-    // mentioned in a constraint to an arg index.
-    // Seems weird to do this in the parser, but I'm not sure how else to.
-    let constrs = [];
-    if p.token == token::COLON {
-        p.bump();
-        constrs = parse_constrs({|x| parse_ty_constr(inputs.node, x) }, p);
-    }
-    let (ret_style, ret_ty) = parse_ret_ty(p);
-    ret {inputs: inputs.node,
-         output: ret_ty,
-         purity: purity,
-         cf: ret_style,
-         constraints: constrs};
-}
-
-fn parse_fn_block_decl(p: parser) -> ast::fn_decl {
-    let inputs = if eat(p, token::OROR) {
-                     []
-                 } else {
-                     parse_seq(token::BINOP(token::OR),
-                               token::BINOP(token::OR),
-                               seq_sep(token::COMMA),
-                               parse_fn_block_arg, p).node
-                 };
-    let output = if eat(p, token::RARROW) {
-                     parse_ty(p, false)
-                 } else {
-                     @spanned(p.span.lo, p.span.hi, ast::ty_infer)
-                 };
-    ret {inputs: inputs,
-         output: output,
-         purity: ast::impure_fn,
-         cf: ast::return_val,
-         constraints: []};
-}
-
-fn parse_fn_header(p: parser) -> {ident: ast::ident, tps: [ast::ty_param]} {
-    let id = parse_value_ident(p);
-    let ty_params = parse_ty_params(p);
-    ret {ident: id, tps: ty_params};
-}
-
-fn mk_item(p: parser, lo: uint, hi: uint, ident: ast::ident, node: ast::item_,
-           attrs: [ast::attribute]) -> @ast::item {
-    ret @{ident: ident,
-          attrs: attrs,
-          id: p.get_id(),
-          node: node,
-          span: ast_util::mk_sp(lo, hi)};
-}
-
-fn parse_item_fn(p: parser, purity: ast::purity,
-                 attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let t = parse_fn_header(p);
-    let decl = parse_fn_decl(p, purity);
-    let (inner_attrs, body) = parse_inner_attrs_and_block(p, true);
-    let attrs = attrs + inner_attrs;
-    ret mk_item(p, lo, body.span.hi, t.ident,
-                ast::item_fn(decl, t.tps, body), attrs);
-}
-
-fn parse_method_name(p: parser) -> ast::ident {
-    alt p.token {
-      token::BINOP(op) { p.bump(); token::binop_to_str(op) }
-      token::NOT { p.bump(); "!" }
-      token::LBRACKET { p.bump(); expect(p, token::RBRACKET); "[]" }
-      _ {
-          let id = parse_value_ident(p);
-          if id == "unary" && eat(p, token::BINOP(token::MINUS)) { "unary-" }
-          else { id }
-      }
-    }
-}
-
-fn parse_method(p: parser) -> @ast::method {
-    let attrs = parse_outer_attributes(p);
-    let lo = p.span.lo, pur = parse_fn_purity(p);
-    let ident = parse_method_name(p);
-    let tps = parse_ty_params(p);
-    let decl = parse_fn_decl(p, pur);
-    let (inner_attrs, body) = parse_inner_attrs_and_block(p, true);
-    let attrs = attrs + inner_attrs;
-    @{ident: ident, attrs: attrs, tps: tps, decl: decl, body: body,
-      id: p.get_id(), span: ast_util::mk_sp(lo, body.span.hi)}
-}
-
-fn parse_item_iface(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo, ident = parse_ident(p),
-        tps = parse_ty_params(p), meths = parse_ty_methods(p);
-    ret mk_item(p, lo, p.last_span.hi, ident,
-                ast::item_iface(tps, meths), attrs);
-}
-
-// Parses three variants (with the initial params always optional):
-//    impl <T: copy> of to_str for [T] { ... }
-//    impl name<T> of to_str for [T] { ... }
-//    impl name<T> for [T] { ... }
-fn parse_item_impl(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    fn wrap_path(p: parser, pt: @ast::path) -> @ast::ty {
-        @{node: ast::ty_path(pt, p.get_id()), span: pt.span}
-    }
-    let (ident, tps) = if !is_word(p, "of") {
-        if p.token == token::LT { (none, parse_ty_params(p)) }
-        else { (some(parse_ident(p)), parse_ty_params(p)) }
-    } else { (none, []) };
-    let ifce = if eat_word(p, "of") {
-        let path = parse_path_and_ty_param_substs(p, false);
-        if option::is_none(ident) {
-            ident = some(path.node.idents[vec::len(path.node.idents) - 1u]);
-        }
-        some(wrap_path(p, path))
-    } else { none };
-    let ident = alt ident {
-        some(name) { name }
-        none { expect_word(p, "of"); fail; }
-    };
-    expect_word(p, "for");
-    let ty = parse_ty(p, false), meths = [];
-    expect(p, token::LBRACE);
-    while !eat(p, token::RBRACE) { meths += [parse_method(p)]; }
-    ret mk_item(p, lo, p.last_span.hi, ident,
-                ast::item_impl(tps, ifce, ty, meths), attrs);
-}
-
-fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let ident = parse_value_ident(p);
-    let ty_params = parse_ty_params(p);
-    expect(p, token::LPAREN);
-    let arg_ident = parse_value_ident(p);
-    expect(p, token::COLON);
-    let t = parse_ty(p, false);
-    expect(p, token::RPAREN);
-    let dtor = parse_block_no_value(p);
-    let decl =
-        {inputs:
-             [{mode: ast::expl(ast::by_ref), ty: t,
-               ident: arg_ident, id: p.get_id()}],
-         output: @spanned(lo, lo, ast::ty_nil),
-         purity: ast::impure_fn,
-         cf: ast::return_val,
-         constraints: []};
-    ret mk_item(p, lo, dtor.span.hi, ident,
-                ast::item_res(decl, ty_params, dtor, p.get_id(), p.get_id()),
-                attrs);
-}
-
-fn parse_item_class(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let class_name = parse_value_ident(p);
-    let class_path = ident_to_path(p.last_span, class_name);
-    let ty_params = parse_ty_params(p);
-    expect(p, token::LBRACE);
-    let items: [@ast::class_item] = [];
-    let ctor_id = p.get_id();
-    let the_ctor : option<(ast::fn_decl, ast::blk)> = none;
-    while p.token != token::RBRACE {
-        alt parse_class_item(p, class_path) {
-            ctor_decl(a_fn_decl, blk) {
-                the_ctor = some((a_fn_decl, blk));
-            }
-            plain_decl(a_decl) {
-                items += [@{node: {privacy: ast::pub, decl: a_decl},
-                            span: p.last_span}];
-            }
-            priv_decls(some_decls) {
-                items += vec::map(some_decls, {|d|
-                            @{node: {privacy: ast::priv, decl: d},
-                                span: p.last_span}});
-            }
-       }
-    }
-    p.bump();
-    alt the_ctor {
-       some((ct_d, ct_b)) { ret mk_item(p, lo, p.last_span.hi, class_name,
-         ast::item_class(ty_params, items, ctor_id, ct_d, ct_b), attrs); }
-       /*
-         Is it strange for the parser to check this?
-       */
-       none { /* parse error */ fail "Class with no ctor"; }
-    }
-}
-
-// lets us identify the constructor declaration at
-// parse time
-// we don't really want just the fn_decl...
-enum class_contents { ctor_decl(ast::fn_decl, ast::blk),
-                      // assumed to be public
-                      plain_decl(ast::class_member),
-                      // contents of a priv section --
-                      // parse_class_item ensures that
-                      // none of these are a ctor decl
-                      priv_decls([ast::class_member])}
-
-    fn parse_class_item(p:parser, class_name:@ast::path) -> class_contents {
-    if eat_word(p, "new") {
-        // Can ctors have attrs?
-            // result type is always the type of the class
-        let decl_ = parse_fn_decl(p, ast::impure_fn);
-        let decl = {output: @{node: ast::ty_path(class_name, p.get_id()),
-                                  span: decl_.output.span}
-                    with decl_};
-        let body = parse_block(p);
-        ret ctor_decl(decl, body);
-    }
-    // FIXME: refactor
-    else if eat_word(p, "priv") {
-            expect(p, token::LBRACE);
-            let results = [];
-            while p.token != token::RBRACE {
-               alt parse_item(p, []) {
-                 some(i) {
-                     results += [ast::class_method(i)];
-                 }
-                 _ {
-                     let a_var = parse_instance_var(p);
-                     expect(p, token::SEMI);
-                     results += [a_var];
-                 }
-               }
-            }
-            p.bump();
-            ret priv_decls(results);
-    }
-    else {
-        // Probably need to parse attrs
-        alt parse_item(p, []) {
-         some(i) {
-             ret plain_decl(ast::class_method(i));
-         }
-         _ {
-             let a_var = parse_instance_var(p);
-             expect(p, token::SEMI);
-             ret plain_decl(a_var);
-         }
-        }
-    }
-}
-
-fn parse_mod_items(p: parser, term: token::token,
-                   first_item_attrs: [ast::attribute]) -> ast::_mod {
-    // Shouldn't be any view items since we've already parsed an item attr
-    let view_items = maybe_parse_view(p, first_item_attrs);
-    let items: [@ast::item] = [];
-    let initial_attrs = first_item_attrs;
-    while p.token != term {
-        let attrs = initial_attrs + parse_outer_attributes(p);
-        #debug["parse_mod_items: parse_item(attrs=%?)", attrs];
-        alt parse_item(p, attrs) {
-          some(i) { items += [i]; }
-          _ {
-            p.fatal("expected item but found '" +
-                    token::to_str(p.reader, p.token) + "'");
-          }
-        }
-        #debug["parse_mod_items: attrs=%?", attrs];
-        initial_attrs = [];
-    }
-
-    if vec::is_not_empty(initial_attrs) {
-        // We parsed attributes for the first item but didn't find the item
-        p.fatal("expected item");
-    }
-
-    ret {view_items: view_items, items: items};
-}
-
-fn parse_item_const(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let id = parse_value_ident(p);
-    expect(p, token::COLON);
-    let ty = parse_ty(p, false);
-    expect(p, token::EQ);
-    let e = parse_expr(p);
-    let hi = p.span.hi;
-    expect(p, token::SEMI);
-    ret mk_item(p, lo, hi, id, ast::item_const(ty, e), attrs);
-}
-
-fn parse_item_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let id = parse_ident(p);
-    expect(p, token::LBRACE);
-    let inner_attrs = parse_inner_attrs_and_next(p);
-    let first_item_outer_attrs = inner_attrs.next;
-    let m = parse_mod_items(p, token::RBRACE, first_item_outer_attrs);
-    let hi = p.span.hi;
-    expect(p, token::RBRACE);
-    ret mk_item(p, lo, hi, id, ast::item_mod(m), attrs + inner_attrs.inner);
-}
-
-fn parse_item_native_fn(p: parser, attrs: [ast::attribute],
-                        purity: ast::purity) -> @ast::native_item {
-    let lo = p.last_span.lo;
-    let t = parse_fn_header(p);
-    let decl = parse_fn_decl(p, purity);
-    let hi = p.span.hi;
-    expect(p, token::SEMI);
-    ret @{ident: t.ident,
-          attrs: attrs,
-          node: ast::native_item_fn(decl, t.tps),
-          id: p.get_id(),
-          span: ast_util::mk_sp(lo, hi)};
-}
-
-fn parse_fn_purity(p: parser) -> ast::purity {
-    if eat_word(p, "fn") { ast::impure_fn }
-    else if eat_word(p, "pure") { expect_word(p, "fn"); ast::pure_fn }
-    else if eat_word(p, "unsafe") { expect_word(p, "fn"); ast::unsafe_fn }
-    else { unexpected(p, p.token); }
-}
-
-fn parse_native_item(p: parser, attrs: [ast::attribute]) ->
-   @ast::native_item {
-    parse_item_native_fn(p, attrs, parse_fn_purity(p))
-}
-
-fn parse_native_mod_items(p: parser, first_item_attrs: [ast::attribute]) ->
-   ast::native_mod {
-    // Shouldn't be any view items since we've already parsed an item attr
-    let view_items =
-        if vec::len(first_item_attrs) == 0u {
-            parse_native_view(p)
-        } else { [] };
-    let items: [@ast::native_item] = [];
-    let initial_attrs = first_item_attrs;
-    while p.token != token::RBRACE {
-        let attrs = initial_attrs + parse_outer_attributes(p);
-        initial_attrs = [];
-        items += [parse_native_item(p, attrs)];
-    }
-    ret {view_items: view_items,
-         items: items};
-}
-
-fn parse_item_native_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    expect_word(p, "mod");
-    let id = parse_ident(p);
-    expect(p, token::LBRACE);
-    let more_attrs = parse_inner_attrs_and_next(p);
-    let inner_attrs = more_attrs.inner;
-    let first_item_outer_attrs = more_attrs.next;
-    let m = parse_native_mod_items(p, first_item_outer_attrs);
-    let hi = p.span.hi;
-    expect(p, token::RBRACE);
-    ret mk_item(p, lo, hi, id, ast::item_native_mod(m), attrs + inner_attrs);
-}
-
-fn parse_type_decl(p: parser) -> {lo: uint, ident: ast::ident} {
-    let lo = p.last_span.lo;
-    let id = parse_ident(p);
-    ret {lo: lo, ident: id};
-}
-
-fn parse_item_type(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let t = parse_type_decl(p);
-    let tps = parse_ty_params(p);
-    expect(p, token::EQ);
-    let ty = parse_ty(p, false);
-    let hi = p.span.hi;
-    expect(p, token::SEMI);
-    ret mk_item(p, t.lo, hi, t.ident, ast::item_ty(ty, tps), attrs);
-}
-
-fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item {
-    let lo = p.last_span.lo;
-    let id = parse_ident(p);
-    let ty_params = parse_ty_params(p);
-    let variants: [ast::variant] = [];
-    // Newtype syntax
-    if p.token == token::EQ {
-        if p.bad_expr_words.contains_key(id) {
-            p.fatal("found " + id + " in enum constructor position");
-        }
-        p.bump();
-        let ty = parse_ty(p, false);
-        expect(p, token::SEMI);
-        let variant =
-            spanned(ty.span.lo, ty.span.hi,
-                    {name: id,
-                     attrs: [],
-                     args: [{ty: ty, id: p.get_id()}],
-                     id: p.get_id(),
-                     disr_expr: none});
-        ret mk_item(p, lo, ty.span.hi, id,
-                    ast::item_enum([variant], ty_params), attrs);
-    }
-    expect(p, token::LBRACE);
-
-    let all_nullary = true, have_disr = false;
-
-    while p.token != token::RBRACE {
-        let variant_attrs = parse_outer_attributes(p);
-        let vlo = p.span.lo;
-        let ident = parse_value_ident(p);
-        let args = [], disr_expr = none;
-        if p.token == token::LPAREN {
-            all_nullary = false;
-            let arg_tys = parse_seq(token::LPAREN, token::RPAREN,
-                                    seq_sep(token::COMMA),
-                                    {|p| parse_ty(p, false)}, p);
-            for ty in arg_tys.node {
-                args += [{ty: ty, id: p.get_id()}];
-            }
-        } else if eat(p, token::EQ) {
-            have_disr = true;
-            disr_expr = some(parse_expr(p));
-        }
-
-        let vr = {name: ident, attrs: variant_attrs,
-                  args: args, id: p.get_id(),
-                  disr_expr: disr_expr};
-        variants += [spanned(vlo, p.last_span.hi, vr)];
-
-        if !eat(p, token::COMMA) { break; }
-    }
-    expect(p, token::RBRACE);
-    if (have_disr && !all_nullary) {
-        p.fatal("discriminator values can only be used with a c-like enum");
-    }
-    ret mk_item(p, lo, p.last_span.hi, id,
-                ast::item_enum(variants, ty_params), attrs);
-}
-
-fn parse_fn_ty_proto(p: parser) -> ast::proto {
-    alt p.token {
-      token::AT {
-        p.bump();
-        ast::proto_box
-      }
-      token::TILDE {
-        p.bump();
-        ast::proto_uniq
-      }
-      token::BINOP(token::AND) {
-        p.bump();
-        ast::proto_block
-      }
-      _ {
-        ast::proto_any
-      }
-    }
-}
-
-fn fn_expr_lookahead(tok: token::token) -> bool {
-    alt tok {
-      token::LPAREN | token::AT | token::TILDE | token::BINOP(_) {
-        true
-      }
-      _ {
-        false
-      }
-    }
-}
-
-fn parse_item(p: parser, attrs: [ast::attribute]) -> option<@ast::item> {
-    if eat_word(p, "const") {
-        ret some(parse_item_const(p, attrs));
-    } else if is_word(p, "fn") && !fn_expr_lookahead(p.look_ahead(1u)) {
-        p.bump();
-        ret some(parse_item_fn(p, ast::impure_fn, attrs));
-    } else if eat_word(p, "pure") {
-        expect_word(p, "fn");
-        ret some(parse_item_fn(p, ast::pure_fn, attrs));
-    } else if is_word(p, "unsafe") && p.look_ahead(1u) != token::LBRACE {
-        p.bump();
-        expect_word(p, "fn");
-        ret some(parse_item_fn(p, ast::unsafe_fn, attrs));
-    } else if eat_word(p, "crust") {
-        expect_word(p, "fn");
-        ret some(parse_item_fn(p, ast::crust_fn, attrs));
-    } else if eat_word(p, "mod") {
-        ret some(parse_item_mod(p, attrs));
-    } else if eat_word(p, "native") {
-        ret some(parse_item_native_mod(p, attrs));
-    } if eat_word(p, "type") {
-        ret some(parse_item_type(p, attrs));
-    } else if eat_word(p, "enum") {
-        ret some(parse_item_enum(p, attrs));
-    } else if eat_word(p, "iface") {
-        ret some(parse_item_iface(p, attrs));
-    } else if eat_word(p, "impl") {
-        ret some(parse_item_impl(p, attrs));
-    } else if eat_word(p, "resource") {
-        ret some(parse_item_res(p, attrs));
-    } else if eat_word(p, "class") {
-        ret some(parse_item_class(p, attrs));
-    }
-else { ret none; }
-}
-
-// A type to distingush between the parsing of item attributes or syntax
-// extensions, which both begin with token.POUND
-type attr_or_ext = option<either::t<[ast::attribute], @ast::expr>>;
-
-fn parse_outer_attrs_or_ext(
-    p: parser,
-    first_item_attrs: [ast::attribute]) -> attr_or_ext {
-    let expect_item_next = vec::is_not_empty(first_item_attrs);
-    if p.token == token::POUND {
-        let lo = p.span.lo;
-        if p.look_ahead(1u) == token::LBRACKET {
-            p.bump();
-            let first_attr = parse_attribute_naked(p, ast::attr_outer, lo);
-            ret some(left([first_attr] + parse_outer_attributes(p)));
-        } else if !(p.look_ahead(1u) == token::LT
-                    || p.look_ahead(1u) == token::LBRACKET
-                    || expect_item_next) {
-            p.bump();
-            ret some(right(parse_syntax_ext_naked(p, lo)));
-        } else { ret none; }
-    } else { ret none; }
-}
-
-// Parse attributes that appear before an item
-fn parse_outer_attributes(p: parser) -> [ast::attribute] {
-    let attrs: [ast::attribute] = [];
-    while p.token == token::POUND {
-        attrs += [parse_attribute(p, ast::attr_outer)];
-    }
-    ret attrs;
-}
-
-fn parse_attribute(p: parser, style: ast::attr_style) -> ast::attribute {
-    let lo = p.span.lo;
-    expect(p, token::POUND);
-    ret parse_attribute_naked(p, style, lo);
-}
-
-fn parse_attribute_naked(p: parser, style: ast::attr_style, lo: uint) ->
-   ast::attribute {
-    expect(p, token::LBRACKET);
-    let meta_item = parse_meta_item(p);
-    expect(p, token::RBRACKET);
-    let hi = p.span.hi;
-    ret spanned(lo, hi, {style: style, value: *meta_item});
-}
-
-// Parse attributes that appear after the opening of an item, each terminated
-// by a semicolon. In addition to a vector of inner attributes, this function
-// also returns a vector that may contain the first outer attribute of the
-// next item (since we can't know whether the attribute is an inner attribute
-// of the containing item or an outer attribute of the first contained item
-// until we see the semi).
-fn parse_inner_attrs_and_next(p: parser) ->
-   {inner: [ast::attribute], next: [ast::attribute]} {
-    let inner_attrs: [ast::attribute] = [];
-    let next_outer_attrs: [ast::attribute] = [];
-    while p.token == token::POUND {
-        if p.look_ahead(1u) != token::LBRACKET {
-            // This is an extension
-            break;
-        }
-        let attr = parse_attribute(p, ast::attr_inner);
-        if p.token == token::SEMI {
-            p.bump();
-            inner_attrs += [attr];
-        } else {
-            // It's not really an inner attribute
-            let outer_attr =
-                spanned(attr.span.lo, attr.span.hi,
-                        {style: ast::attr_outer, value: attr.node.value});
-            next_outer_attrs += [outer_attr];
-            break;
-        }
-    }
-    ret {inner: inner_attrs, next: next_outer_attrs};
-}
-
-fn parse_meta_item(p: parser) -> @ast::meta_item {
-    let lo = p.span.lo;
-    let ident = parse_ident(p);
-    alt p.token {
-      token::EQ {
-        p.bump();
-        let lit = parse_lit(p);
-        let hi = p.span.hi;
-        ret @spanned(lo, hi, ast::meta_name_value(ident, lit));
-      }
-      token::LPAREN {
-        let inner_items = parse_meta_seq(p);
-        let hi = p.span.hi;
-        ret @spanned(lo, hi, ast::meta_list(ident, inner_items));
-      }
-      _ {
-        let hi = p.span.hi;
-        ret @spanned(lo, hi, ast::meta_word(ident));
-      }
-    }
-}
-
-fn parse_meta_seq(p: parser) -> [@ast::meta_item] {
-    ret parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
-                  parse_meta_item, p).node;
-}
-
-fn parse_optional_meta(p: parser) -> [@ast::meta_item] {
-    alt p.token { token::LPAREN { ret parse_meta_seq(p); } _ { ret []; } }
-}
-
-fn parse_use(p: parser) -> ast::view_item_ {
-    let ident = parse_ident(p);
-    let metadata = parse_optional_meta(p);
-    ret ast::view_item_use(ident, metadata, p.get_id());
-}
-
-fn parse_view_path(p: parser) -> @ast::view_path {
-    let lo = p.span.lo;
-    let first_ident = parse_ident(p);
-    let path = [first_ident];
-    #debug("parsed view_path: %s", first_ident);
-    alt p.token {
-      token::EQ {
-        // x = foo::bar
-        p.bump();
-        path = [parse_ident(p)];
-        while p.token == token::MOD_SEP {
-            p.bump();
-            let id = parse_ident(p);
-            path += [id];
-        }
-        let hi = p.span.hi;
-        ret @spanned(lo, hi,
-                     ast::view_path_simple(first_ident,
-                                           @path, p.get_id()));
-      }
-
-      token::MOD_SEP {
-        // foo::bar or foo::{a,b,c} or foo::*
-        while p.token == token::MOD_SEP {
-            p.bump();
-
-            alt p.token {
-
-              token::IDENT(i, _) {
-                p.bump();
-                path += [p.get_str(i)];
-              }
-
-              // foo::bar::{a,b,c}
-              token::LBRACE {
-                let idents =
-                    parse_seq(token::LBRACE, token::RBRACE,
-                              seq_sep(token::COMMA),
-                              parse_path_list_ident, p).node;
-                let hi = p.span.hi;
-                ret @spanned(lo, hi,
-                             ast::view_path_list(@path, idents,
-                                                 p.get_id()));
-              }
-
-              // foo::bar::*
-              token::BINOP(token::STAR) {
-                p.bump();
-                let hi = p.span.hi;
-                ret @spanned(lo, hi,
-                             ast::view_path_glob(@path,
-                                                 p.get_id()));
-              }
-
-              _ { break; }
-            }
-        }
-      }
-      _ { }
-    }
-    let hi = p.span.hi;
-    let last = path[vec::len(path) - 1u];
-    ret @spanned(lo, hi,
-                 ast::view_path_simple(last, @path,
-                                       p.get_id()));
-}
-
-fn parse_view_paths(p: parser) -> [@ast::view_path] {
-    let vp = [parse_view_path(p)];
-    while p.token == token::COMMA {
-        p.bump();
-        vp += [parse_view_path(p)];
-    }
-    ret vp;
-}
-
-fn parse_view_item(p: parser) -> @ast::view_item {
-    let lo = p.span.lo;
-    let the_item =
-        if eat_word(p, "use") {
-            parse_use(p)
-        } else if eat_word(p, "import") {
-            ast::view_item_import(parse_view_paths(p))
-        } else if eat_word(p, "export") {
-            ast::view_item_export(parse_view_paths(p))
-        } else {
-            fail
-    };
-    let hi = p.span.lo;
-    expect(p, token::SEMI);
-    ret @spanned(lo, hi, the_item);
-}
-
-fn is_view_item(p: parser) -> bool {
-    alt p.token {
-      token::IDENT(sid, false) {
-        let st = p.get_str(sid);
-        ret str::eq(st, "use") || str::eq(st, "import") ||
-                str::eq(st, "export");
-      }
-      _ { ret false; }
-    }
-}
-
-fn maybe_parse_view(
-    p: parser,
-    first_item_attrs: [ast::attribute]) -> [@ast::view_item] {
-
-    maybe_parse_view_while(p, first_item_attrs, is_view_item)
-}
-
-fn maybe_parse_view_import_only(
-    p: parser,
-    first_item_attrs: [ast::attribute]) -> [@ast::view_item] {
-
-    maybe_parse_view_while(p, first_item_attrs, bind is_word(_, "import"))
-}
-
-fn maybe_parse_view_while(
-    p: parser,
-    first_item_attrs: [ast::attribute],
-    f: fn@(parser) -> bool) -> [@ast::view_item] {
-
-    if vec::len(first_item_attrs) == 0u {
-        let items = [];
-        while f(p) { items += [parse_view_item(p)]; }
-        ret items;
-    } else {
-        // Shouldn't be any view items since we've already parsed an item attr
-        ret [];
-    }
-}
-
-fn parse_native_view(p: parser) -> [@ast::view_item] {
-    maybe_parse_view_while(p, [], is_view_item)
-}
-
-fn parse_crate_from_source_file(input: str, cfg: ast::crate_cfg,
-                                sess: parse_sess) -> @ast::crate {
-    let p = new_parser_from_file(sess, cfg, input, SOURCE_FILE);
-    let r = parse_crate_mod(p, cfg);
-    sess.chpos = p.reader.chpos;
-    sess.byte_pos = sess.byte_pos + p.reader.pos;
-    ret r;
-}
-
-
-fn parse_expr_from_source_str(name: str, source: @str, cfg: ast::crate_cfg,
-                              sess: parse_sess) -> @ast::expr {
-    let p = new_parser_from_source_str(sess, cfg, name, fss_none, source);
-    let r = parse_expr(p);
-    sess.chpos = p.reader.chpos;
-    sess.byte_pos = sess.byte_pos + p.reader.pos;
-    ret r;
-}
-
-fn parse_from_source_str<T>(f: fn (p: parser) -> T,
-                            name: str, ss: codemap::file_substr,
-                            source: @str, cfg: ast::crate_cfg,
-                            sess: parse_sess)
-    -> T
-{
-    let p = new_parser_from_source_str(sess, cfg, name, ss, source);
-    let r = f(p);
-    if !p.reader.is_eof() {
-        p.reader.fatal("expected end-of-string");
-    }
-    sess.chpos = p.reader.chpos;
-    sess.byte_pos = sess.byte_pos + p.reader.pos;
-    ret r;
-}
-
-fn parse_crate_from_source_str(name: str, source: @str, cfg: ast::crate_cfg,
-                               sess: parse_sess) -> @ast::crate {
-    let p = new_parser_from_source_str(sess, cfg, name, fss_none, source);
-    let r = parse_crate_mod(p, cfg);
-    sess.chpos = p.reader.chpos;
-    sess.byte_pos = sess.byte_pos + p.reader.pos;
-    ret r;
-}
-
-// Parses a source module as a crate
-fn parse_crate_mod(p: parser, _cfg: ast::crate_cfg) -> @ast::crate {
-    let lo = p.span.lo;
-    let crate_attrs = parse_inner_attrs_and_next(p);
-    let first_item_outer_attrs = crate_attrs.next;
-    let m = parse_mod_items(p, token::EOF, first_item_outer_attrs);
-    ret @spanned(lo, p.span.lo,
-                 {directives: [],
-                  module: m,
-                  attrs: crate_attrs.inner,
-                  config: p.cfg});
-}
-
-fn parse_str(p: parser) -> str {
-    alt p.token {
-      token::LIT_STR(s) { p.bump(); p.get_str(s) }
-      _ {
-        p.fatal("expected string literal")
-      }
-    }
-}
-
-// Logic for parsing crate files (.rc)
-//
-// Each crate file is a sequence of directives.
-//
-// Each directive imperatively extends its environment with 0 or more items.
-fn parse_crate_directive(p: parser, first_outer_attr: [ast::attribute]) ->
-   ast::crate_directive {
-
-    // Collect the next attributes
-    let outer_attrs = first_outer_attr + parse_outer_attributes(p);
-    // In a crate file outer attributes are only going to apply to mods
-    let expect_mod = vec::len(outer_attrs) > 0u;
-
-    let lo = p.span.lo;
-    if expect_mod || is_word(p, "mod") {
-        expect_word(p, "mod");
-        let id = parse_ident(p);
-        alt p.token {
-          // mod x = "foo.rs";
-          token::SEMI {
-            let hi = p.span.hi;
-            p.bump();
-            ret spanned(lo, hi, ast::cdir_src_mod(id, outer_attrs));
-          }
-          // mod x = "foo_dir" { ...directives... }
-          token::LBRACE {
-            p.bump();
-            let inner_attrs = parse_inner_attrs_and_next(p);
-            let mod_attrs = outer_attrs + inner_attrs.inner;
-            let next_outer_attr = inner_attrs.next;
-            let cdirs =
-                parse_crate_directives(p, token::RBRACE, next_outer_attr);
-            let hi = p.span.hi;
-            expect(p, token::RBRACE);
-            ret spanned(lo, hi,
-                        ast::cdir_dir_mod(id, cdirs, mod_attrs));
-          }
-          t { unexpected(p, t); }
-        }
-    } else if is_view_item(p) {
-        let vi = parse_view_item(p);
-        ret spanned(lo, vi.span.hi, ast::cdir_view_item(vi));
-    } else { ret p.fatal("expected crate directive"); }
-}
-
-fn parse_crate_directives(p: parser, term: token::token,
-                          first_outer_attr: [ast::attribute]) ->
-   [@ast::crate_directive] {
-
-    // This is pretty ugly. If we have an outer attribute then we can't accept
-    // seeing the terminator next, so if we do see it then fail the same way
-    // parse_crate_directive would
-    if vec::len(first_outer_attr) > 0u && p.token == term {
-        expect_word(p, "mod");
-    }
-
-    let cdirs: [@ast::crate_directive] = [];
-    let first_outer_attr = first_outer_attr;
-    while p.token != term {
-        let cdir = @parse_crate_directive(p, first_outer_attr);
-        cdirs += [cdir];
-        first_outer_attr = [];
-    }
-    ret cdirs;
-}
-
-fn parse_crate_from_crate_file(input: str, cfg: ast::crate_cfg,
-                               sess: parse_sess) -> @ast::crate {
-    let p = new_parser_from_file(sess, cfg, input, CRATE_FILE);
-    let lo = p.span.lo;
-    let prefix = std::fs::dirname(p.reader.filemap.name);
-    let leading_attrs = parse_inner_attrs_and_next(p);
-    let crate_attrs = leading_attrs.inner;
-    let first_cdir_attr = leading_attrs.next;
-    let cdirs = parse_crate_directives(p, token::EOF, first_cdir_attr);
-    sess.chpos = p.reader.chpos;
-    sess.byte_pos = sess.byte_pos + p.reader.pos;
-    let cx =
-        @{p: p,
-          sess: sess,
-          cfg: p.cfg};
-    let (companionmod, _) = fs::splitext(fs::basename(input));
-    let (m, attrs) = eval::eval_crate_directives_to_mod(
-        cx, cdirs, prefix, option::some(companionmod));
-    let hi = p.span.hi;
-    expect(p, token::EOF);
-    ret @spanned(lo, hi,
-                 {directives: cdirs,
-                  module: m,
-                  attrs: crate_attrs + attrs,
-                  config: p.cfg});
-}
-
-fn parse_crate_from_file(input: str, cfg: ast::crate_cfg, sess: parse_sess) ->
-   @ast::crate {
-    if str::ends_with(input, ".rc") {
-        parse_crate_from_crate_file(input, cfg, sess)
-    } else if str::ends_with(input, ".rs") {
-        parse_crate_from_source_file(input, cfg, sess)
-    } else {
-        sess.span_diagnostic.handler().fatal("unknown input file type: " +
-                                             input)
-    }
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs
deleted file mode 100644
index 60949f7793c..00000000000
--- a/src/comp/syntax/parse/token.rs
+++ /dev/null
@@ -1,199 +0,0 @@
-
-import util::interner;
-import lexer::reader;
-
-type str_num = uint;
-
-enum binop {
-    PLUS,
-    MINUS,
-    STAR,
-    SLASH,
-    PERCENT,
-    CARET,
-    AND,
-    OR,
-    LSL,
-    LSR,
-    ASR,
-}
-
-enum token {
-    /* Expression-operator symbols. */
-    EQ,
-    LT,
-    LE,
-    EQEQ,
-    NE,
-    GE,
-    GT,
-    ANDAND,
-    OROR,
-    NOT,
-    TILDE,
-    BINOP(binop),
-    BINOPEQ(binop),
-
-    /* Structural symbols */
-    AT,
-    DOT,
-    ELLIPSIS,
-    COMMA,
-    SEMI,
-    COLON,
-    MOD_SEP,
-    RARROW,
-    LARROW,
-    DARROW,
-    LPAREN,
-    RPAREN,
-    LBRACKET,
-    RBRACKET,
-    LBRACE,
-    RBRACE,
-    POUND,
-    POUND_LBRACE,
-    POUND_LT,
-
-    DOLLAR_LPAREN,
-    DOLLAR_NUM(uint),
-
-    /* Literals */
-    LIT_INT(i64, ast::int_ty),
-    LIT_UINT(u64, ast::uint_ty),
-    LIT_FLOAT(str_num, ast::float_ty),
-    LIT_STR(str_num),
-    LIT_BOOL(bool),
-
-    /* Name components */
-    IDENT(str_num, bool),
-    IDX(int),
-    UNDERSCORE,
-    BRACEQUOTE(str_num),
-    EOF,
-
-}
-
-fn binop_to_str(o: binop) -> str {
-    alt o {
-      PLUS { ret "+"; }
-      MINUS { ret "-"; }
-      STAR { ret "*"; }
-      SLASH { ret "/"; }
-      PERCENT { ret "%"; }
-      CARET { ret "^"; }
-      AND { ret "&"; }
-      OR { ret "|"; }
-      LSL { ret "<<"; }
-      LSR { ret ">>"; }
-      ASR { ret ">>>"; }
-    }
-}
-
-fn to_str(r: reader, t: token) -> str {
-    alt t {
-      EQ { ret "="; }
-      LT { ret "<"; }
-      LE { ret "<="; }
-      EQEQ { ret "=="; }
-      NE { ret "!="; }
-      GE { ret ">="; }
-      GT { ret ">"; }
-      NOT { ret "!"; }
-      TILDE { ret "~"; }
-      OROR { ret "||"; }
-      ANDAND { ret "&&"; }
-      BINOP(op) { ret binop_to_str(op); }
-      BINOPEQ(op) { ret binop_to_str(op) + "="; }
-
-      /* Structural symbols */
-      AT {
-        ret "@";
-      }
-      DOT { ret "."; }
-      ELLIPSIS { ret "..."; }
-      COMMA { ret ","; }
-      SEMI { ret ";"; }
-      COLON { ret ":"; }
-      MOD_SEP { ret "::"; }
-      RARROW { ret "->"; }
-      LARROW { ret "<-"; }
-      DARROW { ret "<->"; }
-      LPAREN { ret "("; }
-      RPAREN { ret ")"; }
-      LBRACKET { ret "["; }
-      RBRACKET { ret "]"; }
-      LBRACE { ret "{"; }
-      RBRACE { ret "}"; }
-      POUND { ret "#"; }
-      POUND_LBRACE { ret "#{"; }
-      POUND_LT { ret "#<"; }
-
-      DOLLAR_LPAREN { ret "$("; }
-      DOLLAR_NUM(u) {
-        ret "$" + uint::to_str(u as uint, 10u);
-      }
-
-      /* Literals */
-      LIT_INT(c, ast::ty_char) {
-        // FIXME: escape.
-        let tmp = "'";
-        str::push_char(tmp, c as char);
-        str::push_char(tmp, '\'');
-        ret tmp;
-      }
-      LIT_INT(i, t) {
-        ret int::to_str(i as int, 10u) + ast_util::int_ty_to_str(t);
-      }
-      LIT_UINT(u, t) {
-        ret uint::to_str(u as uint, 10u) + ast_util::uint_ty_to_str(t);
-      }
-      LIT_FLOAT(s, t) {
-        ret interner::get::<str>(*r.interner, s) +
-            ast_util::float_ty_to_str(t);
-      }
-      LIT_STR(s) { // FIXME: escape.
-        ret "\"" + interner::get::<str>(*r.interner, s) + "\"";
-      }
-      LIT_BOOL(b) { if b { ret "true"; } else { ret "false"; } }
-
-      /* Name components */
-      IDENT(s, _) {
-        ret interner::get::<str>(*r.interner, s);
-      }
-      IDX(i) { ret "_" + int::to_str(i, 10u); }
-      UNDERSCORE { ret "_"; }
-      BRACEQUOTE(_) { ret "<bracequote>"; }
-      EOF { ret "<eof>"; }
-    }
-}
-
-
-pure fn can_begin_expr(t: token) -> bool {
-    alt t {
-      LPAREN { true }
-      LBRACE { true }
-      LBRACKET { true }
-      IDENT(_, _) { true }
-      UNDERSCORE { true }
-      TILDE { true }
-      LIT_INT(_, _) { true }
-      LIT_UINT(_, _) { true }
-      LIT_FLOAT(_, _) { true }
-      LIT_STR(_) { true }
-      POUND { true }
-      AT { true }
-      NOT { true }
-      BINOP(MINUS) { true }
-      BINOP(STAR) { true }
-      MOD_SEP { true }
-      _ { false }
-    }
-}
-
-// Local Variables:
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs
deleted file mode 100644
index 0b55bb8c356..00000000000
--- a/src/comp/syntax/print/pp.rs
+++ /dev/null
@@ -1,526 +0,0 @@
-
-import std::io;
-import io::writer_util;
-
-/*
- * This pretty-printer is a direct reimplementation of Philip Karlton's
- * Mesa pretty-printer, as described in appendix A of
- *
- *     STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen.
- *     Stanford Department of Computer Science, 1979.
- *
- * The algorithm's aim is to break a stream into as few lines as possible
- * while respecting the indentation-consistency requirements of the enclosing
- * block, and avoiding breaking at silly places on block boundaries, for
- * example, between "x" and ")" in "x)".
- *
- * I am implementing this algorithm because it comes with 20 pages of
- * documentation explaining its theory, and because it addresses the set of
- * concerns I've seen other pretty-printers fall down on. Weirdly. Even though
- * it's 32 years old and not written in Haskell. What can I say?
- *
- * Despite some redundancies and quirks in the way it's implemented in that
- * paper, I've opted to keep the implementation here as similar as I can,
- * changing only what was blatantly wrong, a typo, or sufficiently
- * non-idiomatic rust that it really stuck out.
- *
- * In particular you'll see a certain amount of churn related to INTEGER vs.
- * CARDINAL in the Mesa implementation. Mesa apparently interconverts the two
- * somewhat readily? In any case, I've used uint for indices-in-buffers and
- * ints for character-sizes-and-indentation-offsets. This respects the need
- * for ints to "go negative" while carrying a pending-calculation balance, and
- * helps differentiate all the numbers flying around internally (slightly).
- *
- * I also inverted the indentation arithmetic used in the print stack, since
- * the Mesa implementation (somewhat randomly) stores the offset on the print
- * stack in terms of margin-col rather than col itself. I store col.
- *
- * I also implemented a small change in the STRING token, in that I store an
- * explicit length for the string. For most tokens this is just the length of
- * the accompanying string. But it's necessary to permit it to differ, for
- * encoding things that are supposed to "go on their own line" -- certain
- * classes of comment and blank-line -- where relying on adjacent
- * hardbreak-like BREAK tokens with long blankness indication doesn't actually
- * work. To see why, consider when there is a "thing that should be on its own
- * line" between two long blocks, say functions. If you put a hardbreak after
- * each function (or before each) and the breaking algorithm decides to break
- * there anyways (because the functions themselves are long) you wind up with
- * extra blank lines. If you don't put hardbreaks you can wind up with the
- * "thing which should be on its own line" not getting its own line in the
- * rare case of "really small functions" or such. This re-occurs with comments
- * and explicit blank lines. So in those cases we use a string with a payload
- * we want isolated to a line and an explicit length that's huge, surrounded
- * by two zero-length breaks. The algorithm will try its best to fit it on a
- * line (which it can't) and so naturally place the content on its own line to
- * avoid combining it with other lines and making matters even worse.
- */
-enum breaks { consistent, inconsistent, }
-
-type break_t = {offset: int, blank_space: int};
-
-type begin_t = {offset: int, breaks: breaks};
-
-enum token { STRING(str, int), BREAK(break_t), BEGIN(begin_t), END, EOF, }
-
-fn tok_str(t: token) -> str {
-    alt t {
-      STRING(s, len) { ret #fmt["STR(%s,%d)", s, len]; }
-      BREAK(_) { ret "BREAK"; }
-      BEGIN(_) { ret "BEGIN"; }
-      END { ret "END"; }
-      EOF { ret "EOF"; }
-    }
-}
-
-fn buf_str(toks: [mutable token], szs: [mutable int], left: uint, right: uint,
-           lim: uint) -> str {
-    let n = vec::len(toks);
-    assert (n == vec::len(szs));
-    let i = left;
-    let L = lim;
-    let s = "[";
-    while i != right && L != 0u {
-        L -= 1u;
-        if i != left { s += ", "; }
-        s += #fmt["%d=%s", szs[i], tok_str(toks[i])];
-        i += 1u;
-        i %= n;
-    }
-    s += "]";
-    ret s;
-}
-
-enum print_stack_break { fits, broken(breaks), }
-
-type print_stack_elt = {offset: int, pbreak: print_stack_break};
-
-const size_infinity: int = 0xffff;
-
-fn mk_printer(out: io::writer, linewidth: uint) -> printer {
-    // Yes 3, it makes the ring buffers big enough to never
-    // fall behind.
-    let n: uint = 3u * linewidth;
-    #debug("mk_printer %u", linewidth);
-    let token: [mutable token] = vec::to_mut(vec::init_elt(n, EOF));
-    let size: [mutable int] = vec::to_mut(vec::init_elt(n, 0));
-    let scan_stack: [mutable uint] = vec::to_mut(vec::init_elt(n, 0u));
-    let print_stack: [print_stack_elt] = [];
-    @{out: out,
-      buf_len: n,
-      mutable margin: linewidth as int,
-      mutable space: linewidth as int,
-      mutable left: 0u,
-      mutable right: 0u,
-      mutable token: token,
-      mutable size: size,
-      mutable left_total: 0,
-      mutable right_total: 0,
-      mutable scan_stack: scan_stack,
-      mutable scan_stack_empty: true,
-      mutable top: 0u,
-      mutable bottom: 0u,
-      mutable print_stack: print_stack,
-      mutable pending_indentation: 0}
-}
-
-
-/*
- * In case you do not have the paper, here is an explanation of what's going
- * on.
- *
- * There is a stream of input tokens flowing through this printer.
- *
- * The printer buffers up to 3N tokens inside itself, where N is linewidth.
- * Yes, linewidth is chars and tokens are multi-char, but in the worst
- * case every token worth buffering is 1 char long, so it's ok.
- *
- * Tokens are STRING, BREAK, and BEGIN/END to delimit blocks.
- *
- * BEGIN tokens can carry an offset, saying "how far to indent when you break
- * inside here", as well as a flag indicating "consistent" or "inconsistent"
- * breaking. Consistent breaking means that after the first break, no attempt
- * will be made to flow subsequent breaks together onto lines. Inconsistent
- * is the opposite. Inconsistent breaking example would be, say:
- *
- *  foo(hello, there, good, friends)
- *
- * breaking inconsistently to become
- *
- *  foo(hello, there
- *      good, friends);
- *
- * whereas a consistent breaking would yield:
- *
- *  foo(hello,
- *      there
- *      good,
- *      friends);
- *
- * That is, in the consistent-break blocks we value vertical alignment
- * more than the ability to cram stuff onto a line. But in all cases if it
- * can make a block a one-liner, it'll do so.
- *
- * Carrying on with high-level logic:
- *
- * The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and
- * 'right' indices denote the active portion of the ring buffer as well as
- * describing hypothetical points-in-the-infinite-stream at most 3N tokens
- * apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch
- * between using 'left' and 'right' terms to denote the wrapepd-to-ring-buffer
- * and point-in-infinite-stream senses freely.
- *
- * There is a parallel ring buffer, 'size', that holds the calculated size of
- * each token. Why calculated? Because for BEGIN/END pairs, the "size"
- * includes everything betwen the pair. That is, the "size" of BEGIN is
- * actually the sum of the sizes of everything between BEGIN and the paired
- * END that follows. Since that is arbitrarily far in the future, 'size' is
- * being rewritten regularly while the printer runs; in fact most of the
- * machinery is here to work out 'size' entries on the fly (and give up when
- * they're so obviously over-long that "infinity" is a good enough
- * approximation for purposes of line breaking).
- *
- * The "input side" of the printer is managed as an abstract process called
- * SCAN, which uses 'scan_stack', 'scan_stack_empty', 'top' and 'bottom', to
- * manage calculating 'size'. SCAN is, in other words, the process of
- * calculating 'size' entries.
- *
- * The "output side" of the printer is managed by an abstract process called
- * PRINT, which uses 'print_stack', 'margin' and 'space' to figure out what to
- * do with each token/size pair it consumes as it goes. It's trying to consume
- * the entire buffered window, but can't output anything until the size is >=
- * 0 (sizes are set to negative while they're pending calculation).
- *
- * So SCAN takeks input and buffers tokens and pending calculations, while
- * PRINT gobbles up completed calculations and tokens from the buffer. The
- * theory is that the two can never get more than 3N tokens apart, because
- * once there's "obviously" too much data to fit on a line, in a size
- * calculation, SCAN will write "infinity" to the size and let PRINT consume
- * it.
- *
- * In this implementation (following the paper, again) the SCAN process is
- * the method called 'pretty_print', and the 'PRINT' process is the method
- * called 'print'.
- */
-type printer = @{
-    out: io::writer,
-    buf_len: uint,
-    mutable margin: int, // width of lines we're constrained to
-    mutable space: int, // number of spaces left on line
-    mutable left: uint, // index of left side of input stream
-    mutable right: uint, // index of right side of input stream
-    mutable token: [mutable token], // ring-buffr stream goes through
-    mutable size: [mutable int], // ring-buffer of calculated sizes
-    mutable left_total: int, // running size of stream "...left"
-    mutable right_total: int, // running size of stream "...right"
-    // pseudo-stack, really a ring too. Holds the
-    // primary-ring-buffers index of the BEGIN that started the
-    // current block, possibly with the most recent BREAK after that
-    // BEGIN (if there is any) on top of it. Stuff is flushed off the
-    // bottom as it becomes irrelevant due to the primary ring-buffer
-    // advancing.
-    mutable scan_stack: [mutable uint],
-    mutable scan_stack_empty: bool, // top==bottom disambiguator
-    mutable top: uint, // index of top of scan_stack
-    mutable bottom: uint, // index of bottom of scan_stack
-    // stack of blocks-in-progress being flushed by print
-    mutable print_stack: [print_stack_elt],
-    // buffered indentation to avoid writing trailing whitespace
-    mutable pending_indentation: int
-};
-
-impl printer for printer {
-    fn last_token() -> token { self.token[self.right] }
-    // be very careful with this!
-    fn replace_last_token(t: token) { self.token[self.right] = t; }
-    fn pretty_print(t: token) {
-        #debug("pp [%u,%u]", self.left, self.right);
-        alt t {
-          EOF {
-            if !self.scan_stack_empty {
-                self.check_stack(0);
-                self.advance_left(self.token[self.left],
-                                  self.size[self.left]);
-            }
-            self.indent(0);
-          }
-          BEGIN(b) {
-            if self.scan_stack_empty {
-                self.left_total = 1;
-                self.right_total = 1;
-                self.left = 0u;
-                self.right = 0u;
-            } else { self.advance_right(); }
-            #debug("pp BEGIN/buffer [%u,%u]", self.left, self.right);
-            self.token[self.right] = t;
-            self.size[self.right] = -self.right_total;
-            self.scan_push(self.right);
-          }
-          END {
-            if self.scan_stack_empty {
-                #debug("pp END/print [%u,%u]", self.left, self.right);
-                self.print(t, 0);
-            } else {
-                #debug("pp END/buffer [%u,%u]", self.left, self.right);
-                self.advance_right();
-                self.token[self.right] = t;
-                self.size[self.right] = -1;
-                self.scan_push(self.right);
-            }
-          }
-          BREAK(b) {
-            if self.scan_stack_empty {
-                self.left_total = 1;
-                self.right_total = 1;
-                self.left = 0u;
-                self.right = 0u;
-            } else { self.advance_right(); }
-            #debug("pp BREAK/buffer [%u,%u]", self.left, self.right);
-            self.check_stack(0);
-            self.scan_push(self.right);
-            self.token[self.right] = t;
-            self.size[self.right] = -self.right_total;
-            self.right_total += b.blank_space;
-          }
-          STRING(s, len) {
-            if self.scan_stack_empty {
-                #debug("pp STRING/print [%u,%u]", self.left, self.right);
-                self.print(t, len);
-            } else {
-                #debug("pp STRING/buffer [%u,%u]", self.left, self.right);
-                self.advance_right();
-                self.token[self.right] = t;
-                self.size[self.right] = len;
-                self.right_total += len;
-                self.check_stream();
-            }
-          }
-        }
-    }
-    fn check_stream() {
-        #debug("check_stream [%u, %u] with left_total=%d, right_total=%d",
-               self.left, self.right, self.left_total, self.right_total);
-        if self.right_total - self.left_total > self.space {
-            #debug("scan window is %d, longer than space on line (%d)",
-                   self.right_total - self.left_total, self.space);
-            if !self.scan_stack_empty {
-                if self.left == self.scan_stack[self.bottom] {
-                    #debug("setting %u to infinity and popping", self.left);
-                    self.size[self.scan_pop_bottom()] = size_infinity;
-                }
-            }
-            self.advance_left(self.token[self.left], self.size[self.left]);
-            if self.left != self.right { self.check_stream(); }
-        }
-    }
-    fn scan_push(x: uint) {
-        #debug("scan_push %u", x);
-        if self.scan_stack_empty {
-            self.scan_stack_empty = false;
-        } else {
-            self.top += 1u;
-            self.top %= self.buf_len;
-            assert (self.top != self.bottom);
-        }
-        self.scan_stack[self.top] = x;
-    }
-    fn scan_pop() -> uint {
-        assert (!self.scan_stack_empty);
-        let x = self.scan_stack[self.top];
-        if self.top == self.bottom {
-            self.scan_stack_empty = true;
-        } else { self.top += self.buf_len - 1u; self.top %= self.buf_len; }
-        ret x;
-    }
-    fn scan_top() -> uint {
-        assert (!self.scan_stack_empty);
-        ret self.scan_stack[self.top];
-    }
-    fn scan_pop_bottom() -> uint {
-        assert (!self.scan_stack_empty);
-        let x = self.scan_stack[self.bottom];
-        if self.top == self.bottom {
-            self.scan_stack_empty = true;
-        } else { self.bottom += 1u; self.bottom %= self.buf_len; }
-        ret x;
-    }
-    fn advance_right() {
-        self.right += 1u;
-        self.right %= self.buf_len;
-        assert (self.right != self.left);
-    }
-    fn advance_left(x: token, L: int) {
-        #debug("advnce_left [%u,%u], sizeof(%u)=%d", self.left, self.right,
-               self.left, L);
-        if L >= 0 {
-            self.print(x, L);
-            alt x {
-              BREAK(b) { self.left_total += b.blank_space; }
-              STRING(_, len) { assert (len == L); self.left_total += len; }
-              _ { }
-            }
-            if self.left != self.right {
-                self.left += 1u;
-                self.left %= self.buf_len;
-                self.advance_left(self.token[self.left],
-                                  self.size[self.left]);
-            }
-        }
-    }
-    fn check_stack(k: int) {
-        if !self.scan_stack_empty {
-            let x = self.scan_top();
-            alt self.token[x] {
-              BEGIN(b) {
-                if k > 0 {
-                    self.size[self.scan_pop()] = self.size[x] +
-                        self.right_total;
-                    self.check_stack(k - 1);
-                }
-              }
-              END {
-                // paper says + not =, but that makes no sense.
-                self.size[self.scan_pop()] = 1;
-                self.check_stack(k + 1);
-              }
-              _ {
-                self.size[self.scan_pop()] = self.size[x] + self.right_total;
-                if k > 0 { self.check_stack(k); }
-              }
-            }
-        }
-    }
-    fn print_newline(amount: int) {
-        #debug("NEWLINE %d", amount);
-        self.out.write_str("\n");
-        self.pending_indentation = 0;
-        self.indent(amount);
-    }
-    fn indent(amount: int) {
-        #debug("INDENT %d", amount);
-        self.pending_indentation += amount;
-    }
-    fn get_top() -> print_stack_elt {
-        let n = vec::len(self.print_stack);
-        let top: print_stack_elt = {offset: 0, pbreak: broken(inconsistent)};
-        if n != 0u { top = self.print_stack[n - 1u]; }
-        ret top;
-    }
-    fn write_str(s: str) {
-        while self.pending_indentation > 0 {
-            self.out.write_str(" ");
-            self.pending_indentation -= 1;
-        }
-        self.out.write_str(s);
-    }
-    fn print(x: token, L: int) {
-        #debug("print %s %d (remaining line space=%d)", tok_str(x), L,
-               self.space);
-        log(debug, buf_str(self.token, self.size, self.left, self.right, 6u));
-        alt x {
-          BEGIN(b) {
-            if L > self.space {
-                let col = self.margin - self.space + b.offset;
-                #debug("print BEGIN -> push broken block at col %d", col);
-                self.print_stack += [{offset: col, pbreak: broken(b.breaks)}];
-            } else {
-                #debug("print BEGIN -> push fitting block");
-                self.print_stack += [{offset: 0, pbreak: fits}];
-            }
-          }
-          END {
-            #debug("print END -> pop END");
-            assert (vec::len(self.print_stack) != 0u);
-            vec::pop(self.print_stack);
-          }
-          BREAK(b) {
-            let top = self.get_top();
-            alt top.pbreak {
-              fits {
-                #debug("print BREAK in fitting block");
-                self.space -= b.blank_space;
-                self.indent(b.blank_space);
-              }
-              broken(consistent) {
-                #debug("print BREAK in consistent block");
-                self.print_newline(top.offset + b.offset);
-                self.space = self.margin - (top.offset + b.offset);
-              }
-              broken(inconsistent) {
-                if L > self.space {
-                    #debug("print BREAK w/ newline in inconsistent");
-                    self.print_newline(top.offset + b.offset);
-                    self.space = self.margin - (top.offset + b.offset);
-                } else {
-                    #debug("print BREAK w/o newline in inconsistent");
-                    self.indent(b.blank_space);
-                    self.space -= b.blank_space;
-                }
-              }
-            }
-          }
-          STRING(s, len) {
-            #debug("print STRING");
-            assert (L == len);
-            // assert L <= space;
-            self.space -= len;
-            self.write_str(s);
-          }
-          EOF {
-            // EOF should never get here.
-            fail;
-          }
-        }
-    }
-}
-
-// Convenience functions to talk to the printer.
-fn box(p: printer, indent: uint, b: breaks) {
-    p.pretty_print(BEGIN({offset: indent as int, breaks: b}));
-}
-
-fn ibox(p: printer, indent: uint) { box(p, indent, inconsistent); }
-
-fn cbox(p: printer, indent: uint) { box(p, indent, consistent); }
-
-fn break_offset(p: printer, n: uint, off: int) {
-    p.pretty_print(BREAK({offset: off, blank_space: n as int}));
-}
-
-fn end(p: printer) { p.pretty_print(END); }
-
-fn eof(p: printer) { p.pretty_print(EOF); }
-
-fn word(p: printer, wrd: str) {
-    p.pretty_print(STRING(wrd, str::len(wrd) as int));
-}
-
-fn huge_word(p: printer, wrd: str) {
-    p.pretty_print(STRING(wrd, size_infinity));
-}
-
-fn zero_word(p: printer, wrd: str) { p.pretty_print(STRING(wrd, 0)); }
-
-fn spaces(p: printer, n: uint) { break_offset(p, n, 0); }
-
-fn zerobreak(p: printer) { spaces(p, 0u); }
-
-fn space(p: printer) { spaces(p, 1u); }
-
-fn hardbreak(p: printer) { spaces(p, size_infinity as uint); }
-
-fn hardbreak_tok_offset(off: int) -> token {
-    ret BREAK({offset: off, blank_space: size_infinity});
-}
-
-fn hardbreak_tok() -> token { ret hardbreak_tok_offset(0); }
-
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
deleted file mode 100644
index 5f92b5d5beb..00000000000
--- a/src/comp/syntax/print/pprust.rs
+++ /dev/null
@@ -1,1793 +0,0 @@
-
-import std::io;
-import parse::lexer;
-import syntax::codemap::codemap;
-import pp::{break_offset, word, printer,
-            space, zerobreak, hardbreak, breaks, consistent,
-            inconsistent, eof};
-import driver::diagnostic;
-
-// The ps is stored here to prevent recursive type.
-enum ann_node {
-    node_block(ps, ast::blk),
-    node_item(ps, @ast::item),
-    node_expr(ps, @ast::expr),
-    node_pat(ps, @ast::pat),
-}
-type pp_ann = {pre: fn@(ann_node), post: fn@(ann_node)};
-
-fn no_ann() -> pp_ann {
-    fn ignore(_node: ann_node) { }
-    ret {pre: ignore, post: ignore};
-}
-
-type ps =
-    @{s: pp::printer,
-      cm: option<codemap>,
-      comments: option<[lexer::cmnt]>,
-      literals: option<[lexer::lit]>,
-      mutable cur_cmnt: uint,
-      mutable cur_lit: uint,
-      mutable boxes: [pp::breaks],
-      ann: pp_ann};
-
-fn ibox(s: ps, u: uint) { s.boxes += [pp::inconsistent]; pp::ibox(s.s, u); }
-
-fn end(s: ps) { vec::pop(s.boxes); pp::end(s.s); }
-
-fn rust_printer(writer: io::writer) -> ps {
-    let boxes: [pp::breaks] = [];
-    ret @{s: pp::mk_printer(writer, default_columns),
-          cm: none::<codemap>,
-          comments: none::<[lexer::cmnt]>,
-          literals: none::<[lexer::lit]>,
-          mutable cur_cmnt: 0u,
-          mutable cur_lit: 0u,
-          mutable boxes: boxes,
-          ann: no_ann()};
-}
-
-const indent_unit: uint = 4u;
-const alt_indent_unit: uint = 2u;
-
-const default_columns: uint = 78u;
-
-// Requires you to pass an input filename and reader so that
-// it can scan the input text for comments and literals to
-// copy forward.
-fn print_crate(cm: codemap, span_diagnostic: diagnostic::span_handler,
-               crate: @ast::crate, filename: str, in: io::reader,
-               out: io::writer, ann: pp_ann) {
-    let boxes: [pp::breaks] = [];
-    let r = lexer::gather_comments_and_literals(cm, span_diagnostic, filename,
-                                                in);
-    let s =
-        @{s: pp::mk_printer(out, default_columns),
-          cm: some(cm),
-          comments: some(r.cmnts),
-          literals: some(r.lits),
-          mutable cur_cmnt: 0u,
-          mutable cur_lit: 0u,
-          mutable boxes: boxes,
-          ann: ann};
-    print_crate_(s, crate);
-}
-
-fn print_crate_(s: ps, &&crate: @ast::crate) {
-    print_mod(s, crate.node.module, crate.node.attrs);
-    print_remaining_comments(s);
-    eof(s.s);
-}
-
-fn ty_to_str(ty: @ast::ty) -> str { be to_str(ty, print_type); }
-
-fn pat_to_str(pat: @ast::pat) -> str { be to_str(pat, print_pat); }
-
-fn expr_to_str(e: @ast::expr) -> str { be to_str(e, print_expr); }
-
-fn stmt_to_str(s: ast::stmt) -> str { be to_str(s, print_stmt); }
-
-fn item_to_str(i: @ast::item) -> str { be to_str(i, print_item); }
-
-fn attr_to_str(i: ast::attribute) -> str { be to_str(i, print_attribute); }
-
-fn typarams_to_str(tps: [ast::ty_param]) -> str {
-    be to_str(tps, print_type_params)
-}
-
-fn path_to_str(&&p: @ast::path) -> str {
-    be to_str(p, bind print_path(_, _, false));
-}
-
-fn fun_to_str(decl: ast::fn_decl, name: ast::ident,
-              params: [ast::ty_param]) -> str {
-    let buffer = io::mk_mem_buffer();
-    let s = rust_printer(io::mem_buffer_writer(buffer));
-    print_fn(s, decl, name, params);
-    end(s); // Close the head box
-    end(s); // Close the outer box
-    eof(s.s);
-    io::mem_buffer_str(buffer)
-}
-
-#[test]
-fn test_fun_to_str() {
-    let decl: ast::fn_decl = {
-        inputs: [],
-        output: @ast_util::respan(ast_util::dummy_sp(), ast::ty_nil),
-        purity: ast::impure_fn,
-        cf: ast::return_val,
-        constraints: []
-    };
-    assert fun_to_str(decl, "a", []) == "fn a()";
-}
-
-fn res_to_str(decl: ast::fn_decl, name: ast::ident,
-              params: [ast::ty_param]) -> str {
-    let buffer = io::mk_mem_buffer();
-    let s = rust_printer(io::mem_buffer_writer(buffer));
-    print_res(s, decl, name, params);
-    end(s); // Close the head box
-    end(s); // Close the outer box
-    eof(s.s);
-    io::mem_buffer_str(buffer)
-}
-
-#[test]
-fn test_res_to_str() {
-    let decl: ast::fn_decl = {
-        inputs: [{
-            mode: ast::expl(ast::by_val),
-            ty: @ast_util::respan(ast_util::dummy_sp(), ast::ty_nil),
-            ident: "b",
-            id: 0
-        }],
-        output: @ast_util::respan(ast_util::dummy_sp(), ast::ty_nil),
-        purity: ast::impure_fn,
-        cf: ast::return_val,
-        constraints: []
-    };
-    assert res_to_str(decl, "a", []) == "resource a(b: ())";
-}
-
-fn block_to_str(blk: ast::blk) -> str {
-    let buffer = io::mk_mem_buffer();
-    let s = rust_printer(io::mem_buffer_writer(buffer));
-    // containing cbox, will be closed by print-block at }
-    cbox(s, indent_unit);
-    // head-ibox, will be closed by print-block after {
-    ibox(s, 0u);
-    print_block(s, blk);
-    eof(s.s);
-    io::mem_buffer_str(buffer)
-}
-
-fn meta_item_to_str(mi: ast::meta_item) -> str {
-    ret to_str(@mi, print_meta_item);
-}
-
-fn attribute_to_str(attr: ast::attribute) -> str {
-    be to_str(attr, print_attribute);
-}
-
-fn variant_to_str(var: ast::variant) -> str {
-    be to_str(var, print_variant);
-}
-
-#[test]
-fn test_variant_to_str() {
-    let var = ast_util::respan(ast_util::dummy_sp(), {
-        name: "principle_skinner",
-        attrs: [],
-        args: [],
-        id: 0,
-        disr_expr: none
-    });
-
-    let varstr = variant_to_str(var);
-    assert varstr == "principle_skinner";
-}
-
-fn cbox(s: ps, u: uint) { s.boxes += [pp::consistent]; pp::cbox(s.s, u); }
-
-fn box(s: ps, u: uint, b: pp::breaks) { s.boxes += [b]; pp::box(s.s, u, b); }
-
-fn nbsp(s: ps) { word(s.s, " "); }
-
-fn word_nbsp(s: ps, w: str) { word(s.s, w); nbsp(s); }
-
-fn word_space(s: ps, w: str) { word(s.s, w); space(s.s); }
-
-fn popen(s: ps) { word(s.s, "("); }
-
-fn pclose(s: ps) { word(s.s, ")"); }
-
-fn head(s: ps, w: str) {
-    // outer-box is consistent
-    cbox(s, indent_unit);
-    // head-box is inconsistent
-    ibox(s, str::len(w) + 1u);
-    // keyword that starts the head
-    word_nbsp(s, w);
-}
-
-fn bopen(s: ps) {
-    word(s.s, "{");
-    end(s); // close the head-box
-}
-
-fn bclose_(s: ps, span: codemap::span, indented: uint) {
-    maybe_print_comment(s, span.hi);
-    break_offset_if_not_bol(s, 1u, -(indented as int));
-    word(s.s, "}");
-    end(s); // close the outer-box
-}
-fn bclose(s: ps, span: codemap::span) { bclose_(s, span, indent_unit); }
-
-fn is_begin(s: ps) -> bool {
-    alt s.s.last_token() { pp::BEGIN(_) { true } _ { false } }
-}
-
-fn is_end(s: ps) -> bool {
-    alt s.s.last_token() { pp::END { true } _ { false } }
-}
-
-fn is_bol(s: ps) -> bool {
-    ret s.s.last_token() == pp::EOF ||
-            s.s.last_token() == pp::hardbreak_tok();
-}
-
-fn hardbreak_if_not_bol(s: ps) { if !is_bol(s) { hardbreak(s.s); } }
-fn space_if_not_bol(s: ps) { if !is_bol(s) { space(s.s); } }
-fn break_offset_if_not_bol(s: ps, n: uint, off: int) {
-    if !is_bol(s) {
-        break_offset(s.s, n, off);
-    } else {
-        if off != 0 && s.s.last_token() == pp::hardbreak_tok() {
-            // We do something pretty sketchy here: tuck the nonzero
-            // offset-adjustment we were going to deposit along with the
-            // break into the previous hardbreak.
-            s.s.replace_last_token(pp::hardbreak_tok_offset(off));
-        }
-    }
-}
-
-// Synthesizes a comment that was not textually present in the original source
-// file.
-fn synth_comment(s: ps, text: str) {
-    word(s.s, "/*");
-    space(s.s);
-    word(s.s, text);
-    space(s.s);
-    word(s.s, "*/");
-}
-
-fn commasep<IN>(s: ps, b: breaks, elts: [IN], op: fn(ps, IN)) {
-    box(s, 0u, b);
-    let first = true;
-    for elt: IN in elts {
-        if first { first = false; } else { word_space(s, ","); }
-        op(s, elt);
-    }
-    end(s);
-}
-
-
-fn commasep_cmnt<IN>(s: ps, b: breaks, elts: [IN], op: fn(ps, IN),
-                     get_span: fn(IN) -> codemap::span) {
-    box(s, 0u, b);
-    let len = vec::len::<IN>(elts);
-    let i = 0u;
-    for elt: IN in elts {
-        maybe_print_comment(s, get_span(elt).hi);
-        op(s, elt);
-        i += 1u;
-        if i < len {
-            word(s.s, ",");
-            maybe_print_trailing_comment(s, get_span(elt),
-                                         some(get_span(elts[i]).hi));
-            space_if_not_bol(s);
-        }
-    }
-    end(s);
-}
-
-fn commasep_exprs(s: ps, b: breaks, exprs: [@ast::expr]) {
-    fn expr_span(&&expr: @ast::expr) -> codemap::span { ret expr.span; }
-    commasep_cmnt(s, b, exprs, print_expr, expr_span);
-}
-
-fn print_mod(s: ps, _mod: ast::_mod, attrs: [ast::attribute]) {
-    print_inner_attributes(s, attrs);
-    for vitem: @ast::view_item in _mod.view_items {
-        print_view_item(s, vitem);
-    }
-    for item: @ast::item in _mod.items { print_item(s, item); }
-}
-
-fn print_native_mod(s: ps, nmod: ast::native_mod, attrs: [ast::attribute]) {
-    print_inner_attributes(s, attrs);
-    for vitem: @ast::view_item in nmod.view_items {
-        print_view_item(s, vitem);
-    }
-    for item: @ast::native_item in nmod.items { print_native_item(s, item); }
-}
-
-fn print_type(s: ps, &&ty: @ast::ty) {
-    maybe_print_comment(s, ty.span.lo);
-    ibox(s, 0u);
-    alt ty.node {
-      ast::ty_nil { word(s.s, "()"); }
-      ast::ty_bot { word(s.s, "!"); }
-      ast::ty_box(mt) { word(s.s, "@"); print_mt(s, mt); }
-      ast::ty_uniq(mt) { word(s.s, "~"); print_mt(s, mt); }
-      ast::ty_vec(mt) {
-        word(s.s, "[");
-        alt mt.mutbl {
-          ast::m_mutbl { word_space(s, "mut"); }
-          ast::m_const { word_space(s, "const"); }
-          ast::m_imm { }
-        }
-        print_type(s, mt.ty);
-        word(s.s, "]");
-      }
-      ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); }
-      ast::ty_rec(fields) {
-        word(s.s, "{");
-        fn print_field(s: ps, f: ast::ty_field) {
-            cbox(s, indent_unit);
-            print_mutability(s, f.node.mt.mutbl);
-            word(s.s, f.node.ident);
-            word_space(s, ":");
-            print_type(s, f.node.mt.ty);
-            end(s);
-        }
-        fn get_span(f: ast::ty_field) -> codemap::span { ret f.span; }
-        commasep_cmnt(s, consistent, fields, print_field, get_span);
-        word(s.s, ",}");
-      }
-      ast::ty_tup(elts) {
-        popen(s);
-        commasep(s, inconsistent, elts, print_type);
-        pclose(s);
-      }
-      ast::ty_fn(proto, d) {
-        print_ty_fn(s, some(proto), d, none, none);
-      }
-      ast::ty_path(path, _) { print_path(s, path, false); }
-      ast::ty_constr(t, cs) {
-        print_type(s, t);
-        space(s.s);
-        word(s.s, constrs_str(cs, ty_constr_to_str));
-      }
-      ast::ty_mac(_) {
-          fail "print_type doesn't know how to print a ty_mac";
-      }
-      ast::ty_infer {
-          fail "print_type shouldn't see a ty_infer";
-      }
-
-    }
-    end(s);
-}
-
-fn print_native_item(s: ps, item: @ast::native_item) {
-    hardbreak_if_not_bol(s);
-    maybe_print_comment(s, item.span.lo);
-    print_outer_attributes(s, item.attrs);
-    alt item.node {
-      ast::native_item_fn(decl, typarams) {
-        print_fn(s, decl, item.ident, typarams);
-        end(s); // end head-ibox
-        word(s.s, ";");
-        end(s); // end the outer fn box
-      }
-    }
-}
-
-fn print_item(s: ps, &&item: @ast::item) {
-    hardbreak_if_not_bol(s);
-    maybe_print_comment(s, item.span.lo);
-    print_outer_attributes(s, item.attrs);
-    let ann_node = node_item(s, item);
-    s.ann.pre(ann_node);
-    alt item.node {
-      ast::item_const(ty, expr) {
-        head(s, "const");
-        word_space(s, item.ident + ":");
-        print_type(s, ty);
-        space(s.s);
-        end(s); // end the head-ibox
-
-        word_space(s, "=");
-        print_expr(s, expr);
-        word(s.s, ";");
-        end(s); // end the outer cbox
-
-      }
-      ast::item_fn(decl, typarams, body) {
-        print_fn(s, decl, item.ident, typarams);
-        word(s.s, " ");
-        print_block_with_attrs(s, body, item.attrs);
-      }
-      ast::item_mod(_mod) {
-        head(s, "mod");
-        word_nbsp(s, item.ident);
-        bopen(s);
-        print_mod(s, _mod, item.attrs);
-        bclose(s, item.span);
-      }
-      ast::item_native_mod(nmod) {
-        head(s, "native");
-        word_nbsp(s, "mod");
-        word_nbsp(s, item.ident);
-        bopen(s);
-        print_native_mod(s, nmod, item.attrs);
-        bclose(s, item.span);
-      }
-      ast::item_ty(ty, params) {
-        ibox(s, indent_unit);
-        ibox(s, 0u);
-        word_nbsp(s, "type");
-        word(s.s, item.ident);
-        print_type_params(s, params);
-        end(s); // end the inner ibox
-
-        space(s.s);
-        word_space(s, "=");
-        print_type(s, ty);
-        word(s.s, ";");
-        end(s); // end the outer ibox
-      }
-      ast::item_enum(variants, params) {
-        let newtype =
-            vec::len(variants) == 1u &&
-                str::eq(item.ident, variants[0].node.name) &&
-                vec::len(variants[0].node.args) == 1u;
-        if newtype {
-            ibox(s, indent_unit);
-            word_space(s, "enum");
-        } else { head(s, "enum"); }
-        word(s.s, item.ident);
-        print_type_params(s, params);
-        space(s.s);
-        if newtype {
-            word_space(s, "=");
-            print_type(s, variants[0].node.args[0].ty);
-            word(s.s, ";");
-            end(s);
-        } else {
-            bopen(s);
-            for v: ast::variant in variants {
-                space_if_not_bol(s);
-                maybe_print_comment(s, v.span.lo);
-                print_outer_attributes(s, v.node.attrs);
-                ibox(s, indent_unit);
-                print_variant(s, v);
-                word(s.s, ",");
-                end(s);
-                maybe_print_trailing_comment(s, v.span, none::<uint>);
-            }
-            bclose(s, item.span);
-        }
-      }
-      ast::item_class(tps,items,_,ctor_decl,ctor_body) {
-          head(s, "class");
-          word_nbsp(s, item.ident);
-          print_type_params(s, tps);
-          bopen(s);
-          hardbreak_if_not_bol(s);
-          head(s, "new");
-          print_fn_args_and_ret(s, ctor_decl);
-          space(s.s);
-          print_block(s, ctor_body);
-          for ci in items {
-                  /*
-                     FIXME: collect all private items and print them
-                     in a single "priv" section
-                   */
-             hardbreak_if_not_bol(s);
-             alt ci.node.privacy {
-                ast::priv {
-                    head(s, "priv");
-                    bopen(s);
-                    hardbreak_if_not_bol(s);
-                }
-                _ {}
-             }
-             alt ci.node.decl {
-                 ast::instance_var(nm, t, mt, _) {
-                    word_nbsp(s, "let");
-                    alt mt {
-                      ast::class_mutable { word_nbsp(s, "mutable"); }
-                      _ {}
-                    }
-                    word(s.s, nm);
-                    word_nbsp(s, ":");
-                    print_type(s, t);
-                    word(s.s, ";");
-                }
-                ast::class_method(i) {
-                    print_item(s, i);
-                }
-             }
-             alt ci.node.privacy {
-                 ast::priv { bclose(s, ci.span); }
-                 _ {}
-             }
-          }
-       }
-      ast::item_impl(tps, ifce, ty, methods) {
-        head(s, "impl");
-        word(s.s, item.ident);
-        print_type_params(s, tps);
-        space(s.s);
-        alt ifce {
-          some(ty) {
-            word_nbsp(s, "of");
-            print_type(s, ty);
-            space(s.s);
-          }
-          _ {}
-        }
-        word_nbsp(s, "for");
-        print_type(s, ty);
-        space(s.s);
-        bopen(s);
-        for meth in methods {
-            hardbreak_if_not_bol(s);
-            maybe_print_comment(s, meth.span.lo);
-            print_outer_attributes(s, meth.attrs);
-            print_fn(s, meth.decl, meth.ident, meth.tps);
-            word(s.s, " ");
-            print_block_with_attrs(s, meth.body, meth.attrs);
-        }
-        bclose(s, item.span);
-      }
-      ast::item_iface(tps, methods) {
-        head(s, "iface");
-        word(s.s, item.ident);
-        print_type_params(s, tps);
-        word(s.s, " ");
-        bopen(s);
-        for meth in methods { print_ty_method(s, meth); }
-        bclose(s, item.span);
-      }
-      ast::item_res(decl, tps, body, dt_id, ct_id) {
-        print_res(s, decl, item.ident, tps);
-        print_block(s, body);
-      }
-    }
-    s.ann.post(ann_node);
-}
-
-fn print_res(s: ps, decl: ast::fn_decl, name: ast::ident,
-             typarams: [ast::ty_param]) {
-    head(s, "resource");
-    word(s.s, name);
-    print_type_params(s, typarams);
-    popen(s);
-    word_space(s, decl.inputs[0].ident + ":");
-    print_type(s, decl.inputs[0].ty);
-    pclose(s);
-    space(s.s);
-}
-
-fn print_variant(s: ps, v: ast::variant) {
-    word(s.s, v.node.name);
-    if vec::len(v.node.args) > 0u {
-        popen(s);
-        fn print_variant_arg(s: ps, arg: ast::variant_arg) {
-            print_type(s, arg.ty);
-        }
-        commasep(s, consistent, v.node.args, print_variant_arg);
-        pclose(s);
-    }
-    alt v.node.disr_expr {
-      some(d) {
-        space(s.s);
-        word_space(s, "=");
-        print_expr(s, d);
-      }
-      _ {}
-    }
-}
-
-fn print_ty_method(s: ps, m: ast::ty_method) {
-    hardbreak_if_not_bol(s);
-    maybe_print_comment(s, m.span.lo);
-    print_outer_attributes(s, m.attrs);
-    print_ty_fn(s, none, m.decl, some(m.ident), some(m.tps));
-    word(s.s, ";");
-}
-
-fn print_outer_attributes(s: ps, attrs: [ast::attribute]) {
-    let count = 0;
-    for attr: ast::attribute in attrs {
-        alt attr.node.style {
-          ast::attr_outer { print_attribute(s, attr); count += 1; }
-          _ {/* fallthrough */ }
-        }
-    }
-    if count > 0 { hardbreak_if_not_bol(s); }
-}
-
-fn print_inner_attributes(s: ps, attrs: [ast::attribute]) {
-    let count = 0;
-    for attr: ast::attribute in attrs {
-        alt attr.node.style {
-          ast::attr_inner {
-            print_attribute(s, attr);
-            word(s.s, ";");
-            count += 1;
-          }
-          _ {/* fallthrough */ }
-        }
-    }
-    if count > 0 { hardbreak_if_not_bol(s); }
-}
-
-fn print_attribute(s: ps, attr: ast::attribute) {
-    hardbreak_if_not_bol(s);
-    maybe_print_comment(s, attr.span.lo);
-    word(s.s, "#[");
-    print_meta_item(s, @attr.node.value);
-    word(s.s, "]");
-}
-
-
-fn print_stmt(s: ps, st: ast::stmt) {
-    maybe_print_comment(s, st.span.lo);
-    alt st.node {
-      ast::stmt_decl(decl, _) {
-        print_decl(s, decl);
-      }
-      ast::stmt_expr(expr, _) {
-        space_if_not_bol(s);
-        print_expr(s, expr);
-      }
-      ast::stmt_semi(expr, _) {
-        space_if_not_bol(s);
-        print_expr(s, expr);
-        word(s.s, ";");
-      }
-    }
-    if parse::parser::stmt_ends_with_semi(st) { word(s.s, ";"); }
-    maybe_print_trailing_comment(s, st.span, none::<uint>);
-}
-
-fn print_block(s: ps, blk: ast::blk) {
-    print_possibly_embedded_block(s, blk, block_normal, indent_unit);
-}
-
-fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: [ast::attribute]) {
-    print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs);
-}
-
-enum embed_type { block_macro, block_block_fn, block_normal, }
-
-fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
-                                 indented: uint) {
-    print_possibly_embedded_block_(
-        s, blk, embedded, indented, []);
-}
-
-fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
-                                  indented: uint, attrs: [ast::attribute]) {
-    alt blk.node.rules {
-      ast::unchecked_blk { word(s.s, "unchecked"); }
-      ast::unsafe_blk { word(s.s, "unsafe"); }
-      ast::default_blk { }
-    }
-    maybe_print_comment(s, blk.span.lo);
-    let ann_node = node_block(s, blk);
-    s.ann.pre(ann_node);
-    alt embedded {
-      block_macro { word(s.s, "#{"); end(s); }
-      block_block_fn { end(s); }
-      block_normal { bopen(s); }
-    }
-
-    print_inner_attributes(s, attrs);
-
-    for vi in blk.node.view_items { print_view_item(s, vi); }
-    for st: @ast::stmt in blk.node.stmts {
-        print_stmt(s, *st);
-    }
-    alt blk.node.expr {
-      some(expr) {
-        space_if_not_bol(s);
-        print_expr(s, expr);
-        maybe_print_trailing_comment(s, expr.span, some(blk.span.hi));
-      }
-      _ { }
-    }
-    bclose_(s, blk.span, indented);
-    s.ann.post(ann_node);
-}
-
-// ret and fail, without arguments cannot appear is the discriminant of if,
-// alt, do, & while unambiguously without being parenthesized
-fn print_maybe_parens_discrim(s: ps, e: @ast::expr) {
-    let disambig = alt e.node {
-      ast::expr_ret(none) | ast::expr_fail(none) { true }
-      _ { false }
-    };
-    if disambig { popen(s); }
-    print_expr(s, e);
-    if disambig { pclose(s); }
-}
-
-fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
-            elseopt: option<@ast::expr>, chk: bool) {
-    head(s, "if");
-    if chk { word_nbsp(s, "check"); }
-    print_maybe_parens_discrim(s, test);
-    space(s.s);
-    print_block(s, blk);
-    fn do_else(s: ps, els: option<@ast::expr>) {
-        alt els {
-          some(_else) {
-            alt _else.node {
-              // "another else-if"
-              ast::expr_if(i, t, e) {
-                cbox(s, indent_unit - 1u);
-                ibox(s, 0u);
-                word(s.s, " else if ");
-                print_maybe_parens_discrim(s, i);
-                space(s.s);
-                print_block(s, t);
-                do_else(s, e);
-              }
-              // "final else"
-              ast::expr_block(b) {
-                cbox(s, indent_unit - 1u);
-                ibox(s, 0u);
-                word(s.s, " else ");
-                print_block(s, b);
-              }
-              // BLEAH, constraints would be great here
-              _ {
-                  fail "print_if saw if with weird alternative";
-              }
-            }
-          }
-          _ {/* fall through */ }
-        }
-    }
-    do_else(s, elseopt);
-}
-
-fn print_mac(s: ps, m: ast::mac) {
-    alt m.node {
-      ast::mac_invoc(path, arg, body) {
-        word(s.s, "#");
-        print_path(s, path, false);
-        alt arg {
-          some(@{node: ast::expr_vec(_, _), _}) { }
-          _ { word(s.s, " "); }
-        }
-        option::may(arg, bind print_expr(s, _));
-        // FIXME: extension 'body'
-      }
-      ast::mac_embed_type(ty) {
-        word(s.s, "#<");
-        print_type(s, ty);
-        word(s.s, ">");
-      }
-      ast::mac_embed_block(blk) {
-        print_possibly_embedded_block(s, blk, block_normal, indent_unit);
-      }
-      ast::mac_ellipsis { word(s.s, "..."); }
-      ast::mac_var(v) { word(s.s, #fmt("$%u", v)); }
-      _ { /* fixme */ }
-    }
-}
-
-fn print_expr(s: ps, &&expr: @ast::expr) {
-    maybe_print_comment(s, expr.span.lo);
-    ibox(s, indent_unit);
-    let ann_node = node_expr(s, expr);
-    s.ann.pre(ann_node);
-    alt expr.node {
-      ast::expr_vec(exprs, mutbl) {
-        ibox(s, indent_unit);
-        word(s.s, "[");
-        if mutbl == ast::m_mutbl {
-            word(s.s, "mutable");
-            if vec::len(exprs) > 0u { nbsp(s); }
-        }
-        commasep_exprs(s, inconsistent, exprs);
-        word(s.s, "]");
-        end(s);
-      }
-      ast::expr_rec(fields, wth) {
-        fn print_field(s: ps, field: ast::field) {
-            ibox(s, indent_unit);
-            if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mutable"); }
-            word(s.s, field.node.ident);
-            word_space(s, ":");
-            print_expr(s, field.node.expr);
-            end(s);
-        }
-        fn get_span(field: ast::field) -> codemap::span { ret field.span; }
-        word(s.s, "{");
-        commasep_cmnt(s, consistent, fields, print_field, get_span);
-        alt wth {
-          some(expr) {
-            if vec::len(fields) > 0u { space(s.s); }
-            ibox(s, indent_unit);
-            word_space(s, "with");
-            print_expr(s, expr);
-            end(s);
-          }
-          _ { word(s.s, ","); }
-        }
-        word(s.s, "}");
-      }
-      ast::expr_tup(exprs) {
-        popen(s);
-        commasep_exprs(s, inconsistent, exprs);
-        pclose(s);
-      }
-      ast::expr_call(func, args, has_block) {
-        print_expr_parens_if_not_bot(s, func);
-        let base_args = args, blk = none;
-        if has_block { blk = some(vec::pop(base_args)); }
-        if !has_block || vec::len(base_args) > 0u {
-            popen(s);
-            commasep_exprs(s, inconsistent, base_args);
-            pclose(s);
-        }
-        if has_block {
-            nbsp(s);
-            print_expr(s, option::get(blk));
-        }
-      }
-      ast::expr_bind(func, args) {
-        fn print_opt(s: ps, expr: option<@ast::expr>) {
-            alt expr {
-              some(expr) { print_expr(s, expr); }
-              _ { word(s.s, "_"); }
-            }
-        }
-
-        // "bind" keyword is only needed if there are no "_" arguments.
-        if !vec::any(args) {|arg| option::is_none(arg) } {
-            word_nbsp(s, "bind");
-        }
-
-        print_expr(s, func);
-        popen(s);
-        commasep(s, inconsistent, args, print_opt);
-        pclose(s);
-      }
-      ast::expr_binary(op, lhs, rhs) {
-        let prec = operator_prec(op);
-        print_op_maybe_parens(s, lhs, prec);
-        space(s.s);
-        word_space(s, ast_util::binop_to_str(op));
-        print_op_maybe_parens(s, rhs, prec + 1);
-      }
-      ast::expr_unary(op, expr) {
-        word(s.s, ast_util::unop_to_str(op));
-        print_op_maybe_parens(s, expr, parse::parser::unop_prec);
-      }
-      ast::expr_lit(lit) { print_literal(s, lit); }
-      ast::expr_cast(expr, ty) {
-        print_op_maybe_parens(s, expr, parse::parser::as_prec);
-        space(s.s);
-        word_space(s, "as");
-        print_type(s, ty);
-      }
-      ast::expr_if(test, blk, elseopt) {
-        print_if(s, test, blk, elseopt, false);
-      }
-      ast::expr_if_check(test, blk, elseopt) {
-        print_if(s, test, blk, elseopt, true);
-      }
-      ast::expr_while(test, blk) {
-        head(s, "while");
-        print_maybe_parens_discrim(s, test);
-        space(s.s);
-        print_block(s, blk);
-      }
-      ast::expr_for(decl, expr, blk) {
-        head(s, "for");
-        print_for_decl(s, decl, expr);
-        space(s.s);
-        print_block(s, blk);
-      }
-      ast::expr_do_while(blk, expr) {
-        head(s, "do");
-        space(s.s);
-        print_block(s, blk);
-        space(s.s);
-        word_space(s, "while");
-        print_expr(s, expr);
-      }
-      ast::expr_alt(expr, arms, mode) {
-        cbox(s, alt_indent_unit);
-        ibox(s, 4u);
-        word_nbsp(s, "alt");
-        if mode == ast::alt_check { word_nbsp(s, "check"); }
-        print_maybe_parens_discrim(s, expr);
-        space(s.s);
-        bopen(s);
-        for arm: ast::arm in arms {
-            space(s.s);
-            cbox(s, alt_indent_unit);
-            ibox(s, 0u);
-            let first = true;
-            for p: @ast::pat in arm.pats {
-                if first {
-                    first = false;
-                } else { space(s.s); word_space(s, "|"); }
-                print_pat(s, p);
-            }
-            space(s.s);
-            alt arm.guard {
-              some(e) { word_space(s, "if"); print_expr(s, e); space(s.s); }
-              none { }
-            }
-            print_possibly_embedded_block(s, arm.body, block_normal,
-                                          alt_indent_unit);
-        }
-        bclose_(s, expr.span, alt_indent_unit);
-      }
-      ast::expr_fn(proto, decl, body, cap_clause) {
-        // containing cbox, will be closed by print-block at }
-        cbox(s, indent_unit);
-        // head-box, will be closed by print-block at start
-        ibox(s, 0u);
-        word(s.s, proto_to_str(proto));
-        print_cap_clause(s, *cap_clause);
-        print_fn_args_and_ret(s, decl);
-        space(s.s);
-        print_block(s, body);
-      }
-      ast::expr_fn_block(decl, body) {
-        // containing cbox, will be closed by print-block at }
-        cbox(s, indent_unit);
-        // head-box, will be closed by print-block at start
-        ibox(s, 0u);
-        word(s.s, "{");
-        print_fn_block_args(s, decl);
-        print_possibly_embedded_block(s, body, block_block_fn, indent_unit);
-      }
-      ast::expr_block(blk) {
-        // containing cbox, will be closed by print-block at }
-        cbox(s, indent_unit);
-        // head-box, will be closed by print-block after {
-        ibox(s, 0u);
-        print_block(s, blk);
-      }
-      ast::expr_copy(e) { word_space(s, "copy"); print_expr(s, e); }
-      ast::expr_move(lhs, rhs) {
-        print_expr(s, lhs);
-        space(s.s);
-        word_space(s, "<-");
-        print_expr(s, rhs);
-      }
-      ast::expr_assign(lhs, rhs) {
-        print_expr(s, lhs);
-        space(s.s);
-        word_space(s, "=");
-        print_expr(s, rhs);
-      }
-      ast::expr_swap(lhs, rhs) {
-        print_expr(s, lhs);
-        space(s.s);
-        word_space(s, "<->");
-        print_expr(s, rhs);
-      }
-      ast::expr_assign_op(op, lhs, rhs) {
-        print_expr(s, lhs);
-        space(s.s);
-        word(s.s, ast_util::binop_to_str(op));
-        word_space(s, "=");
-        print_expr(s, rhs);
-      }
-      ast::expr_field(expr, id, tys) {
-        // Deal with '10.x'
-        if ends_in_lit_int(expr) {
-            popen(s); print_expr(s, expr); pclose(s);
-        } else {
-            print_expr_parens_if_not_bot(s, expr);
-        }
-        word(s.s, ".");
-        word(s.s, id);
-        if vec::len(tys) > 0u {
-            word(s.s, "::<");
-            commasep(s, inconsistent, tys, print_type);
-            word(s.s, ">");
-        }
-      }
-      ast::expr_index(expr, index) {
-        print_expr_parens_if_not_bot(s, expr);
-        word(s.s, "[");
-        print_expr(s, index);
-        word(s.s, "]");
-      }
-      ast::expr_path(path) { print_path(s, path, true); }
-      ast::expr_fail(maybe_fail_val) {
-        word(s.s, "fail");
-        alt maybe_fail_val {
-          some(expr) { word(s.s, " "); print_expr(s, expr); }
-          _ { }
-        }
-      }
-      ast::expr_break { word(s.s, "break"); }
-      ast::expr_cont { word(s.s, "cont"); }
-      ast::expr_ret(result) {
-        word(s.s, "ret");
-        alt result {
-          some(expr) { word(s.s, " "); print_expr(s, expr); }
-          _ { }
-        }
-      }
-      ast::expr_be(result) { word_nbsp(s, "be"); print_expr(s, result); }
-      ast::expr_log(lvl, lexp, expr) {
-        alt check lvl {
-          1 { word_nbsp(s, "log"); print_expr(s, expr); }
-          0 { word_nbsp(s, "log_err"); print_expr(s, expr); }
-          2 {
-            word_nbsp(s, "log");
-            popen(s);
-            print_expr(s, lexp);
-            word(s.s, ",");
-            space_if_not_bol(s);
-            print_expr(s, expr);
-            pclose(s);
-          }
-        }
-      }
-      ast::expr_check(m, expr) {
-        alt m {
-          ast::claimed_expr { word_nbsp(s, "claim"); }
-          ast::checked_expr { word_nbsp(s, "check"); }
-        }
-        popen(s);
-        print_expr(s, expr);
-        pclose(s);
-      }
-      ast::expr_assert(expr) {
-        word_nbsp(s, "assert");
-        print_expr(s, expr);
-      }
-      ast::expr_mac(m) { print_mac(s, m); }
-    }
-    s.ann.post(ann_node);
-    end(s);
-}
-
-fn print_expr_parens_if_not_bot(s: ps, ex: @ast::expr) {
-    let parens = alt ex.node {
-      ast::expr_fail(_) | ast::expr_ret(_) |
-      ast::expr_binary(_, _, _) | ast::expr_unary(_, _) |
-      ast::expr_move(_, _) | ast::expr_copy(_) |
-      ast::expr_assign(_, _) | ast::expr_be(_) |
-      ast::expr_assign_op(_, _, _) | ast::expr_swap(_, _) |
-      ast::expr_log(_, _, _) | ast::expr_assert(_) |
-      ast::expr_call(_, _, true) |
-      ast::expr_check(_, _) { true }
-      _ { false }
-    };
-    if parens { popen(s); }
-    print_expr(s, ex);
-    if parens { pclose(s); }
-}
-
-fn print_local_decl(s: ps, loc: @ast::local) {
-    print_pat(s, loc.node.pat);
-    alt loc.node.ty.node {
-      ast::ty_infer { }
-      _ { word_space(s, ":"); print_type(s, loc.node.ty); }
-    }
-}
-
-fn print_decl(s: ps, decl: @ast::decl) {
-    maybe_print_comment(s, decl.span.lo);
-    alt decl.node {
-      ast::decl_local(locs) {
-        space_if_not_bol(s);
-        ibox(s, indent_unit);
-        word_nbsp(s, "let");
-        fn print_local(s: ps, &&loc: @ast::local) {
-            ibox(s, indent_unit);
-            print_local_decl(s, loc);
-            end(s);
-            alt loc.node.init {
-              some(init) {
-                nbsp(s);
-                alt init.op {
-                  ast::init_assign { word_space(s, "="); }
-                  ast::init_move { word_space(s, "<-"); }
-                }
-                print_expr(s, init.expr);
-              }
-              _ { }
-            }
-        }
-        commasep(s, consistent, locs, print_local);
-        end(s);
-      }
-      ast::decl_item(item) { print_item(s, item); }
-    }
-}
-
-fn print_ident(s: ps, ident: ast::ident) { word(s.s, ident); }
-
-fn print_for_decl(s: ps, loc: @ast::local, coll: @ast::expr) {
-    print_local_decl(s, loc);
-    space(s.s);
-    word_space(s, "in");
-    print_expr(s, coll);
-}
-
-fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) {
-    maybe_print_comment(s, path.span.lo);
-    if path.node.global { word(s.s, "::"); }
-    let first = true;
-    for id: ast::ident in path.node.idents {
-        if first { first = false; } else { word(s.s, "::"); }
-        word(s.s, id);
-    }
-    if vec::len(path.node.types) > 0u {
-        if colons_before_params { word(s.s, "::"); }
-        word(s.s, "<");
-        commasep(s, inconsistent, path.node.types, print_type);
-        word(s.s, ">");
-    }
-}
-
-fn print_pat(s: ps, &&pat: @ast::pat) {
-    maybe_print_comment(s, pat.span.lo);
-    let ann_node = node_pat(s, pat);
-    s.ann.pre(ann_node);
-    /* Pat isn't normalized, but the beauty of it
-     is that it doesn't matter */
-    alt pat.node {
-      ast::pat_wild { word(s.s, "_"); }
-      ast::pat_ident(path, sub) {
-        print_path(s, path, true);
-        alt sub {
-          some(p) { word(s.s, "@"); print_pat(s, p); }
-          _ {}
-        }
-      }
-      ast::pat_enum(path, args) {
-        print_path(s, path, true);
-        if vec::len(args) > 0u {
-            popen(s);
-            commasep(s, inconsistent, args, print_pat);
-            pclose(s);
-        } else { }
-      }
-      ast::pat_rec(fields, etc) {
-        word(s.s, "{");
-        fn print_field(s: ps, f: ast::field_pat) {
-            cbox(s, indent_unit);
-            word(s.s, f.ident);
-            word_space(s, ":");
-            print_pat(s, f.pat);
-            end(s);
-        }
-        fn get_span(f: ast::field_pat) -> codemap::span { ret f.pat.span; }
-        commasep_cmnt(s, consistent, fields, print_field, get_span);
-        if etc {
-            if vec::len(fields) != 0u { word_space(s, ","); }
-            word(s.s, "_");
-        }
-        word(s.s, "}");
-      }
-      ast::pat_tup(elts) {
-        popen(s);
-        commasep(s, inconsistent, elts, print_pat);
-        pclose(s);
-      }
-      ast::pat_box(inner) { word(s.s, "@"); print_pat(s, inner); }
-      ast::pat_uniq(inner) { word(s.s, "~"); print_pat(s, inner); }
-      ast::pat_lit(e) { print_expr(s, e); }
-      ast::pat_range(begin, end) {
-        print_expr(s, begin);
-        space(s.s);
-        word_space(s, "to");
-        print_expr(s, end);
-      }
-    }
-    s.ann.post(ann_node);
-}
-
-fn print_fn(s: ps, decl: ast::fn_decl, name: ast::ident,
-            typarams: [ast::ty_param]) {
-    alt decl.purity {
-      ast::impure_fn { head(s, "fn"); }
-      ast::unsafe_fn { head(s, "unsafe fn"); }
-      ast::pure_fn { head(s, "pure fn"); }
-      ast::crust_fn { head(s, "crust fn"); }
-    }
-    word(s.s, name);
-    print_type_params(s, typarams);
-    print_fn_args_and_ret(s, decl);
-}
-
-fn print_cap_clause(s: ps, cap_clause: ast::capture_clause) {
-    fn print_cap_item(s: ps, &&cap_item: @ast::capture_item) {
-        word(s.s, cap_item.name);
-    }
-
-    let has_copies = vec::is_not_empty(cap_clause.copies);
-    let has_moves = vec::is_not_empty(cap_clause.moves);
-    if !has_copies && !has_moves { ret; }
-
-    word(s.s, "[");
-
-    if has_copies {
-        word_nbsp(s, "copy");
-        commasep(s, inconsistent, cap_clause.copies, print_cap_item);
-        if has_moves {
-            word_space(s, ";");
-        }
-    }
-
-    if has_moves {
-        word_nbsp(s, "move");
-        commasep(s, inconsistent, cap_clause.moves, print_cap_item);
-    }
-
-    word(s.s, "]");
-}
-
-fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl) {
-    popen(s);
-    fn print_arg(s: ps, x: ast::arg) {
-        ibox(s, indent_unit);
-        print_arg_mode(s, x.mode);
-        word_space(s, x.ident + ":");
-        print_type(s, x.ty);
-        end(s);
-    }
-    commasep(s, inconsistent, decl.inputs, print_arg);
-    pclose(s);
-    word(s.s, constrs_str(decl.constraints, {|c|
-        ast_fn_constr_to_str(decl, c)
-    }));
-
-    maybe_print_comment(s, decl.output.span.lo);
-    if decl.output.node != ast::ty_nil {
-        space_if_not_bol(s);
-        word_space(s, "->");
-        print_type(s, decl.output);
-    }
-}
-
-fn print_fn_block_args(s: ps, decl: ast::fn_decl) {
-    word(s.s, "|");
-    fn print_arg(s: ps, x: ast::arg) {
-        ibox(s, indent_unit);
-        print_arg_mode(s, x.mode);
-        word(s.s, x.ident);
-        end(s);
-    }
-    commasep(s, inconsistent, decl.inputs, print_arg);
-    word(s.s, "|");
-    if decl.output.node != ast::ty_infer {
-        space_if_not_bol(s);
-        word_space(s, "->");
-        print_type(s, decl.output);
-    }
-    maybe_print_comment(s, decl.output.span.lo);
-}
-
-fn mode_to_str(m: ast::mode) -> str {
-    alt m {
-      ast::expl(ast::by_mutbl_ref) { "&" }
-      ast::expl(ast::by_move) { "-" }
-      ast::expl(ast::by_ref) { "&&" }
-      ast::expl(ast::by_val) { "++" }
-      ast::expl(ast::by_copy) { "+" }
-      ast::infer(_) { "" }
-    }
-}
-
-fn print_arg_mode(s: ps, m: ast::mode) {
-    let ms = mode_to_str(m);
-    if ms != "" { word(s.s, ms); }
-}
-
-fn print_bounds(s: ps, bounds: @[ast::ty_param_bound]) {
-    if vec::len(*bounds) > 0u {
-        word(s.s, ":");
-        for bound in *bounds {
-            nbsp(s);
-            alt bound {
-              ast::bound_copy { word(s.s, "copy"); }
-              ast::bound_send { word(s.s, "send"); }
-              ast::bound_iface(t) { print_type(s, t); }
-            }
-        }
-    }
-}
-
-fn print_type_params(s: ps, &&params: [ast::ty_param]) {
-    if vec::len(params) > 0u {
-        word(s.s, "<");
-        fn printParam(s: ps, param: ast::ty_param) {
-            word(s.s, param.ident);
-            print_bounds(s, param.bounds);
-        }
-        commasep(s, inconsistent, params, printParam);
-        word(s.s, ">");
-    }
-}
-
-fn print_meta_item(s: ps, &&item: @ast::meta_item) {
-    ibox(s, indent_unit);
-    alt item.node {
-      ast::meta_word(name) { word(s.s, name); }
-      ast::meta_name_value(name, value) {
-        word_space(s, name);
-        word_space(s, "=");
-        print_literal(s, @value);
-      }
-      ast::meta_list(name, items) {
-        word(s.s, name);
-        popen(s);
-        commasep(s, consistent, items, print_meta_item);
-        pclose(s);
-      }
-    }
-    end(s);
-}
-
-fn print_simple_path(s: ps, path: ast::simple_path) {
-    let first = true;
-    for id in path {
-        if first { first = false; } else { word(s.s, "::"); }
-        word(s.s, id);
-    }
-}
-
-fn print_view_path(s: ps, &&vp: @ast::view_path) {
-    alt vp.node {
-      ast::view_path_simple(ident, path, _) {
-        if path[vec::len(*path)-1u] != ident {
-            word_space(s, ident);
-            word_space(s, "=");
-        }
-        print_simple_path(s, *path);
-      }
-
-      ast::view_path_glob(path, _) {
-        print_simple_path(s, *path);
-        word(s.s, "::*");
-      }
-
-      ast::view_path_list(path, idents, _) {
-        print_simple_path(s, *path);
-        word(s.s, "::{");
-        commasep(s, inconsistent, idents) {|s, w|
-            word(s.s, w.node.name)
-        }
-        word(s.s, "}");
-      }
-    }
-}
-
-fn print_view_paths(s: ps, vps: [@ast::view_path]) {
-    commasep(s, inconsistent, vps, print_view_path);
-}
-
-fn print_view_item(s: ps, item: @ast::view_item) {
-    hardbreak_if_not_bol(s);
-    maybe_print_comment(s, item.span.lo);
-    alt item.node {
-      ast::view_item_use(id, mta, _) {
-        head(s, "use");
-        word(s.s, id);
-        if vec::len(mta) > 0u {
-            popen(s);
-            commasep(s, consistent, mta, print_meta_item);
-            pclose(s);
-        }
-      }
-
-      ast::view_item_import(vps) {
-        head(s, "import");
-        print_view_paths(s, vps);
-      }
-
-      ast::view_item_export(vps) {
-        head(s, "export");
-        print_view_paths(s, vps);
-      }
-    }
-    word(s.s, ";");
-    end(s); // end inner head-block
-    end(s); // end outer head-block
-}
-
-
-// FIXME: The fact that this builds up the table anew for every call is
-// not good. Eventually, table should be a const.
-fn operator_prec(op: ast::binop) -> int {
-    for spec: parse::parser::op_spec in *parse::parser::prec_table() {
-        if spec.op == op { ret spec.prec; }
-    }
-    fail;
-}
-
-fn need_parens(expr: @ast::expr, outer_prec: int) -> bool {
-    alt expr.node {
-      ast::expr_binary(op, _, _) { operator_prec(op) < outer_prec }
-      ast::expr_cast(_, _) { parse::parser::as_prec < outer_prec }
-      // This may be too conservative in some cases
-      ast::expr_assign(_, _) { true }
-      ast::expr_move(_, _) { true }
-      ast::expr_swap(_, _) { true }
-      ast::expr_assign_op(_, _, _) { true }
-      ast::expr_ret(_) { true }
-      ast::expr_be(_) { true }
-      ast::expr_assert(_) { true }
-      ast::expr_check(_, _) { true }
-      ast::expr_log(_, _, _) { true }
-      _ { !parse::parser::expr_requires_semi_to_be_stmt(expr) }
-    }
-}
-
-fn print_op_maybe_parens(s: ps, expr: @ast::expr, outer_prec: int) {
-    let add_them = need_parens(expr, outer_prec);
-    if add_them { popen(s); }
-    print_expr(s, expr);
-    if add_them { pclose(s); }
-}
-
-fn print_mutability(s: ps, mutbl: ast::mutability) {
-    alt mutbl {
-      ast::m_mutbl { word_nbsp(s, "mutable"); }
-      ast::m_const { word_nbsp(s, "const"); }
-      ast::m_imm {/* nothing */ }
-    }
-}
-
-fn print_mt(s: ps, mt: ast::mt) {
-    print_mutability(s, mt.mutbl);
-    print_type(s, mt.ty);
-}
-
-fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
-               decl: ast::fn_decl, id: option<ast::ident>,
-               tps: option<[ast::ty_param]>) {
-    ibox(s, indent_unit);
-    word(s.s, opt_proto_to_str(opt_proto));
-    alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } }
-    alt tps { some(tps) { print_type_params(s, tps); } _ { } }
-    zerobreak(s.s);
-    popen(s);
-    fn print_arg(s: ps, input: ast::arg) {
-        print_arg_mode(s, input.mode);
-        if str::len(input.ident) > 0u {
-            word_space(s, input.ident + ":");
-        }
-        print_type(s, input.ty);
-    }
-    commasep(s, inconsistent, decl.inputs, print_arg);
-    pclose(s);
-    maybe_print_comment(s, decl.output.span.lo);
-    if decl.output.node != ast::ty_nil {
-        space_if_not_bol(s);
-        ibox(s, indent_unit);
-        word_space(s, "->");
-        if decl.cf == ast::noreturn { word_nbsp(s, "!"); }
-        else { print_type(s, decl.output); }
-        end(s);
-    }
-    word(s.s, constrs_str(decl.constraints, ast_ty_fn_constr_to_str));
-    end(s);
-}
-
-fn maybe_print_trailing_comment(s: ps, span: codemap::span,
-                                next_pos: option<uint>) {
-    let cm;
-    alt s.cm { some(ccm) { cm = ccm; } _ { ret; } }
-    alt next_comment(s) {
-      some(cmnt) {
-        if cmnt.style != lexer::trailing { ret; }
-        let span_line = codemap::lookup_char_pos(cm, span.hi);
-        let comment_line = codemap::lookup_char_pos(cm, cmnt.pos);
-        let next = cmnt.pos + 1u;
-        alt next_pos { none { } some(p) { next = p; } }
-        if span.hi < cmnt.pos && cmnt.pos < next &&
-               span_line.line == comment_line.line {
-            print_comment(s, cmnt);
-            s.cur_cmnt += 1u;
-        }
-      }
-      _ { }
-    }
-}
-
-fn print_remaining_comments(s: ps) {
-    // If there aren't any remaining comments, then we need to manually
-    // make sure there is a line break at the end.
-    if option::is_none(next_comment(s)) { hardbreak(s.s); }
-    while true {
-        alt next_comment(s) {
-          some(cmnt) { print_comment(s, cmnt); s.cur_cmnt += 1u; }
-          _ { break; }
-        }
-    }
-}
-
-fn in_cbox(s: ps) -> bool {
-    let len = vec::len(s.boxes);
-    if len == 0u { ret false; }
-    ret s.boxes[len - 1u] == pp::consistent;
-}
-
-fn print_literal(s: ps, &&lit: @ast::lit) {
-    maybe_print_comment(s, lit.span.lo);
-    alt next_lit(s, lit.span.lo) {
-      some(lt) {
-        word(s.s, lt.lit);
-        ret;
-      }
-      _ {}
-    }
-    alt lit.node {
-      ast::lit_str(st) { print_string(s, st); }
-      ast::lit_int(ch, ast::ty_char) {
-        word(s.s, "'" + escape_str(str::from_char(ch as char), '\'') + "'");
-      }
-      ast::lit_int(i, t) {
-        if i < 0_i64 {
-            word(s.s,
-                 "-" + u64::to_str(-i as u64, 10u)
-                 + ast_util::int_ty_to_str(t));
-        } else {
-            word(s.s,
-                 u64::to_str(i as u64, 10u)
-                 + ast_util::int_ty_to_str(t));
-        }
-      }
-      ast::lit_uint(u, t) {
-        word(s.s,
-             u64::to_str(u, 10u)
-             + ast_util::uint_ty_to_str(t));
-      }
-      ast::lit_float(f, t) {
-        word(s.s, f + ast_util::float_ty_to_str(t));
-      }
-      ast::lit_nil { word(s.s, "()"); }
-      ast::lit_bool(val) {
-        if val { word(s.s, "true"); } else { word(s.s, "false"); }
-      }
-    }
-}
-
-fn lit_to_str(l: @ast::lit) -> str { be to_str(l, print_literal); }
-
-fn next_lit(s: ps, pos: uint) -> option<lexer::lit> {
-    alt s.literals {
-      some(lits) {
-        while s.cur_lit < vec::len(lits) {
-            let lt = lits[s.cur_lit];
-            if lt.pos > pos { ret none; }
-            s.cur_lit += 1u;
-            if lt.pos == pos { ret some(lt); }
-        }
-        ret none;
-      }
-      _ { ret none; }
-    }
-}
-
-fn maybe_print_comment(s: ps, pos: uint) {
-    while true {
-        alt next_comment(s) {
-          some(cmnt) {
-            if cmnt.pos < pos {
-                print_comment(s, cmnt);
-                s.cur_cmnt += 1u;
-            } else { break; }
-          }
-          _ { break; }
-        }
-    }
-}
-
-fn print_comment(s: ps, cmnt: lexer::cmnt) {
-    alt cmnt.style {
-      lexer::mixed {
-        assert (vec::len(cmnt.lines) == 1u);
-        zerobreak(s.s);
-        word(s.s, cmnt.lines[0]);
-        zerobreak(s.s);
-      }
-      lexer::isolated {
-        pprust::hardbreak_if_not_bol(s);
-        for line: str in cmnt.lines {
-            // Don't print empty lines because they will end up as trailing
-            // whitespace
-            if str::is_not_empty(line) { word(s.s, line); }
-            hardbreak(s.s);
-        }
-      }
-      lexer::trailing {
-        word(s.s, " ");
-        if vec::len(cmnt.lines) == 1u {
-            word(s.s, cmnt.lines[0]);
-            hardbreak(s.s);
-        } else {
-            ibox(s, 0u);
-            for line: str in cmnt.lines {
-                if str::is_not_empty(line) { word(s.s, line); }
-                hardbreak(s.s);
-            }
-            end(s);
-        }
-      }
-      lexer::blank_line {
-        // We need to do at least one, possibly two hardbreaks.
-        let is_semi =
-            alt s.s.last_token() {
-              pp::STRING(s, _) { s == ";" }
-              _ { false }
-            };
-        if is_semi || is_begin(s) || is_end(s) { hardbreak(s.s); }
-        hardbreak(s.s);
-      }
-    }
-}
-
-fn print_string(s: ps, st: str) {
-    word(s.s, "\"");
-    word(s.s, escape_str(st, '"'));
-    word(s.s, "\"");
-}
-
-fn escape_str(st: str, to_escape: char) -> str {
-    let out: str = "";
-    let len = str::len(st);
-    let i = 0u;
-    while i < len {
-        alt st[i] as char {
-          '\n' { out += "\\n"; }
-          '\t' { out += "\\t"; }
-          '\r' { out += "\\r"; }
-          '\\' { out += "\\\\"; }
-          cur {
-            if cur == to_escape { out += "\\"; }
-            // FIXME some (or all?) non-ascii things should be escaped
-
-            str::push_char(out, cur);
-          }
-        }
-        i += 1u;
-    }
-    ret out;
-}
-
-fn to_str<T>(t: T, f: fn@(ps, T)) -> str {
-    let buffer = io::mk_mem_buffer();
-    let s = rust_printer(io::mem_buffer_writer(buffer));
-    f(s, t);
-    eof(s.s);
-    io::mem_buffer_str(buffer)
-}
-
-fn next_comment(s: ps) -> option<lexer::cmnt> {
-    alt s.comments {
-      some(cmnts) {
-        if s.cur_cmnt < vec::len(cmnts) {
-            ret some(cmnts[s.cur_cmnt]);
-        } else { ret none::<lexer::cmnt>; }
-      }
-      _ { ret none::<lexer::cmnt>; }
-    }
-}
-
-fn constr_args_to_str<T>(f: fn@(T) -> str, args: [@ast::sp_constr_arg<T>]) ->
-   str {
-    let comma = false;
-    let s = "(";
-    for a: @ast::sp_constr_arg<T> in args {
-        if comma { s += ", "; } else { comma = true; }
-        s += constr_arg_to_str::<T>(f, a.node);
-    }
-    s += ")";
-    ret s;
-}
-
-fn constr_arg_to_str<T>(f: fn@(T) -> str, c: ast::constr_arg_general_<T>) ->
-   str {
-    alt c {
-      ast::carg_base { ret "*"; }
-      ast::carg_ident(i) { ret f(i); }
-      ast::carg_lit(l) { ret lit_to_str(l); }
-    }
-}
-
-// needed b/c constr_args_to_str needs
-// something that takes an alias
-// (argh)
-fn uint_to_str(&&i: uint) -> str { ret uint::str(i); }
-
-fn ast_ty_fn_constr_to_str(&&c: @ast::constr) -> str {
-    ret path_to_str(c.node.path) +
-            constr_args_to_str(uint_to_str, c.node.args);
-}
-
-fn ast_fn_constr_to_str(decl: ast::fn_decl, &&c: @ast::constr) -> str {
-    let arg_to_str = bind fn_arg_idx_to_str(decl, _);
-    ret path_to_str(c.node.path) +
-            constr_args_to_str(arg_to_str, c.node.args);
-}
-
-fn ty_constr_to_str(&&c: @ast::ty_constr) -> str {
-    fn ty_constr_path_to_str(&&p: @ast::path) -> str { "*." + path_to_str(p) }
-
-    ret path_to_str(c.node.path) +
-            constr_args_to_str::<@ast::path>(ty_constr_path_to_str,
-                                             c.node.args);
-}
-
-fn constrs_str<T>(constrs: [T], elt: fn(T) -> str) -> str {
-    let s = "", colon = true;
-    for c in constrs {
-        if colon { s += " : "; colon = false; } else { s += ", "; }
-        s += elt(c);
-    }
-    ret s;
-}
-
-fn fn_arg_idx_to_str(decl: ast::fn_decl, &&idx: uint) -> str {
-    decl.inputs[idx].ident
-}
-
-fn opt_proto_to_str(opt_p: option<ast::proto>) -> str {
-    alt opt_p {
-      none { "fn" }
-      some(p) { proto_to_str(p) }
-    }
-}
-
-fn proto_to_str(p: ast::proto) -> str {
-    ret alt p {
-      ast::proto_bare { "native fn" }
-      ast::proto_any { "fn" }
-      ast::proto_block { "fn&" }
-      ast::proto_uniq { "fn~" }
-      ast::proto_box { "fn@" }
-    };
-}
-
-fn ends_in_lit_int(ex: @ast::expr) -> bool {
-    alt ex.node {
-      ast::expr_lit(@{node: ast::lit_int(_, ast::ty_i), _}) { true }
-      ast::expr_binary(_, _, sub) | ast::expr_unary(_, sub) |
-      ast::expr_move(_, sub) | ast::expr_copy(sub) |
-      ast::expr_assign(_, sub) | ast::expr_be(sub) |
-      ast::expr_assign_op(_, _, sub) | ast::expr_swap(_, sub) |
-      ast::expr_log(_, _, sub) | ast::expr_assert(sub) |
-      ast::expr_check(_, sub) { ends_in_lit_int(sub) }
-      ast::expr_fail(osub) | ast::expr_ret(osub) {
-        alt osub {
-          some(ex) { ends_in_lit_int(ex) }
-          _ { false }
-        }
-      }
-      _ { false }
-    }
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs
deleted file mode 100644
index c7f0d7ecb99..00000000000
--- a/src/comp/syntax/util/interner.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// An "interner" is a data structure that associates values with uint tags and
-// allows bidirectional lookup; i.e. given a value, one can easily find the
-// type, and vice versa.
-import std::map;
-import std::map::{hashmap, hashfn, eqfn};
-
-type interner<T> =
-    {map: hashmap<T, uint>,
-     mutable vect: [T],
-     hasher: hashfn<T>,
-     eqer: eqfn<T>};
-
-fn mk<T: copy>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> {
-    let m = map::mk_hashmap::<T, uint>(hasher, eqer);
-    ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer};
-}
-
-fn intern<T: copy>(itr: interner<T>, val: T) -> uint {
-    alt itr.map.find(val) {
-      some(idx) { ret idx; }
-      none {
-        let new_idx = vec::len::<T>(itr.vect);
-        itr.map.insert(val, new_idx);
-        itr.vect += [val];
-        ret new_idx;
-      }
-    }
-}
-
-// |get| isn't "pure" in the traditional sense, because it can go from
-// failing to returning a value as items are interned. But for typestate,
-// where we first check a pred and then rely on it, ceasing to fail is ok.
-pure fn get<T: copy>(itr: interner<T>, idx: uint) -> T {
-    unchecked {
-        itr.vect[idx]
-    }
-}
-
-fn len<T>(itr: interner<T>) -> uint { ret vec::len(itr.vect); }
diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs
deleted file mode 100644
index 55958abd7af..00000000000
--- a/src/comp/syntax/visit.rs
+++ /dev/null
@@ -1,546 +0,0 @@
-
-import ast::*;
-import codemap::span;
-
-// Context-passing AST walker. Each overridden visit method has full control
-// over what happens with its node, it can do its own traversal of the node's
-// children (potentially passing in different contexts to each), call
-// visit::visit_* to apply the default traversal algorithm (again, it can
-// override the context), or prevent deeper traversal by doing nothing.
-
-// Our typesystem doesn't do circular types, so the visitor record can not
-// hold functions that take visitors. A vt enum is used to break the cycle.
-enum vt<E> { mk_vt(visitor<E>), }
-
-enum fn_kind {
-    fk_item_fn(ident, [ty_param]), //< an item declared with fn()
-    fk_method(ident, [ty_param]),
-    fk_res(ident, [ty_param]),
-    fk_anon(proto),  //< an anonymous function like fn@(...)
-    fk_fn_block,     //< a block {||...}
-}
-
-fn name_of_fn(fk: fn_kind) -> ident {
-    alt fk {
-      fk_item_fn(name, _) | fk_method(name, _) | fk_res(name, _) { name }
-      fk_anon(_) | fk_fn_block { "anon" }
-    }
-}
-
-fn tps_of_fn(fk: fn_kind) -> [ty_param] {
-    alt fk {
-      fk_item_fn(_, tps) | fk_method(_, tps) | fk_res(_, tps) { tps }
-      fk_anon(_) | fk_fn_block { [] }
-    }
-}
-
-type visitor<E> =
-    // takes the components so that one function can be
-    // generic over constr and ty_constr
-    @{visit_mod: fn@(_mod, span, node_id, E, vt<E>),
-      visit_view_item: fn@(@view_item, E, vt<E>),
-      visit_native_item: fn@(@native_item, E, vt<E>),
-      visit_item: fn@(@item, E, vt<E>),
-      visit_local: fn@(@local, E, vt<E>),
-      visit_block: fn@(ast::blk, E, vt<E>),
-      visit_stmt: fn@(@stmt, E, vt<E>),
-      visit_arm: fn@(arm, E, vt<E>),
-      visit_pat: fn@(@pat, E, vt<E>),
-      visit_decl: fn@(@decl, E, vt<E>),
-      visit_expr: fn@(@expr, E, vt<E>),
-      visit_ty: fn@(@ty, E, vt<E>),
-      visit_ty_params: fn@([ty_param], E, vt<E>),
-      visit_constr: fn@(@path, span, node_id, E, vt<E>),
-      visit_fn: fn@(fn_kind, fn_decl, blk, span, node_id, E, vt<E>),
-      visit_class_item: fn@(span, privacy, class_member, E, vt<E>)};
-
-fn default_visitor<E>() -> visitor<E> {
-    ret @{visit_mod: bind visit_mod::<E>(_, _, _, _, _),
-          visit_view_item: bind visit_view_item::<E>(_, _, _),
-          visit_native_item: bind visit_native_item::<E>(_, _, _),
-          visit_item: bind visit_item::<E>(_, _, _),
-          visit_local: bind visit_local::<E>(_, _, _),
-          visit_block: bind visit_block::<E>(_, _, _),
-          visit_stmt: bind visit_stmt::<E>(_, _, _),
-          visit_arm: bind visit_arm::<E>(_, _, _),
-          visit_pat: bind visit_pat::<E>(_, _, _),
-          visit_decl: bind visit_decl::<E>(_, _, _),
-          visit_expr: bind visit_expr::<E>(_, _, _),
-          visit_ty: bind skip_ty::<E>(_, _, _),
-          visit_ty_params: bind visit_ty_params::<E>(_, _, _),
-          visit_constr: bind visit_constr::<E>(_, _, _, _, _),
-          visit_fn: bind visit_fn::<E>(_, _, _, _, _, _, _),
-          visit_class_item: bind visit_class_item::<E>(_,_,_,_,_)};
-}
-
-fn visit_crate<E>(c: crate, e: E, v: vt<E>) {
-    v.visit_mod(c.node.module, c.span, crate_node_id, e, v);
-}
-
-fn visit_crate_directive<E>(cd: @crate_directive, e: E, v: vt<E>) {
-    alt cd.node {
-      cdir_src_mod(_, _) { }
-      cdir_dir_mod(_, cdirs, _) {
-        for cdir: @crate_directive in cdirs {
-            visit_crate_directive(cdir, e, v);
-        }
-      }
-      cdir_view_item(vi) { v.visit_view_item(vi, e, v); }
-      cdir_syntax(_) { }
-    }
-}
-
-fn visit_mod<E>(m: _mod, _sp: span, _id: node_id, e: E, v: vt<E>) {
-    for vi: @view_item in m.view_items { v.visit_view_item(vi, e, v); }
-    for i: @item in m.items { v.visit_item(i, e, v); }
-}
-
-fn visit_view_item<E>(_vi: @view_item, _e: E, _v: vt<E>) { }
-
-fn visit_local<E>(loc: @local, e: E, v: vt<E>) {
-    v.visit_pat(loc.node.pat, e, v);
-    v.visit_ty(loc.node.ty, e, v);
-    alt loc.node.init { none { } some(i) { v.visit_expr(i.expr, e, v); } }
-}
-
-fn visit_item<E>(i: @item, e: E, v: vt<E>) {
-    alt i.node {
-      item_const(t, ex) { v.visit_ty(t, e, v); v.visit_expr(ex, e, v); }
-      item_fn(decl, tp, body) {
-        v.visit_fn(fk_item_fn(i.ident, tp), decl, body, i.span, i.id, e, v);
-      }
-      item_mod(m) { v.visit_mod(m, i.span, i.id, e, v); }
-      item_native_mod(nm) {
-        for vi: @view_item in nm.view_items { v.visit_view_item(vi, e, v); }
-        for ni: @native_item in nm.items { v.visit_native_item(ni, e, v); }
-      }
-      item_ty(t, tps) { v.visit_ty(t, e, v); v.visit_ty_params(tps, e, v); }
-      item_res(decl, tps, body, dtor_id, _) {
-        v.visit_fn(fk_res(i.ident, tps), decl, body, i.span,
-                   dtor_id, e, v);
-      }
-      item_enum(variants, tps) {
-        v.visit_ty_params(tps, e, v);
-        for vr: variant in variants {
-            for va: variant_arg in vr.node.args { v.visit_ty(va.ty, e, v); }
-        }
-      }
-      item_impl(tps, ifce, ty, methods) {
-        v.visit_ty_params(tps, e, v);
-        alt ifce { some(ty) { v.visit_ty(ty, e, v); } _ {} }
-        v.visit_ty(ty, e, v);
-        for m in methods {
-            visit_method_helper(m, e, v)
-        }
-      }
-      item_class(tps, members, _, ctor_decl, ctor_blk) {
-          v.visit_ty_params(tps, e, v);
-          for m in members {
-             v.visit_class_item(m.span, m.node.privacy, m.node.decl, e, v);
-          }
-          visit_fn_decl(ctor_decl, e, v);
-          v.visit_block(ctor_blk, e, v);
-      }
-      item_iface(tps, methods) {
-        v.visit_ty_params(tps, e, v);
-        for m in methods {
-            for a in m.decl.inputs { v.visit_ty(a.ty, e, v); }
-            v.visit_ty(m.decl.output, e, v);
-        }
-      }
-    }
-}
-
-fn visit_class_item<E>(_s: span, _p: privacy, cm: class_member,
-                       e:E, v:vt<E>) {
-    alt cm {
-        instance_var(ident, t, mt, id) {
-            v.visit_ty(t, e, v);
-        }
-        class_method(i) {
-            v.visit_item(i, e, v);
-        }
-    }
-}
-
-fn skip_ty<E>(_t: @ty, _e: E, _v: vt<E>) {}
-
-fn visit_ty<E>(t: @ty, e: E, v: vt<E>) {
-    alt t.node {
-      ty_box(mt) { v.visit_ty(mt.ty, e, v); }
-      ty_uniq(mt) { v.visit_ty(mt.ty, e, v); }
-      ty_vec(mt) { v.visit_ty(mt.ty, e, v); }
-      ty_ptr(mt) { v.visit_ty(mt.ty, e, v); }
-      ty_rec(flds) {
-        for f: ty_field in flds { v.visit_ty(f.node.mt.ty, e, v); }
-      }
-      ty_tup(ts) { for tt in ts { v.visit_ty(tt, e, v); } }
-      ty_fn(_, decl) {
-        for a in decl.inputs { v.visit_ty(a.ty, e, v); }
-        for c: @constr in decl.constraints {
-            v.visit_constr(c.node.path, c.span, c.node.id, e, v);
-        }
-        v.visit_ty(decl.output, e, v);
-      }
-      ty_path(p, _) { visit_path(p, e, v); }
-      ty_constr(t, cs) {
-        v.visit_ty(t, e, v);
-        for tc: @spanned<constr_general_<@path, node_id>> in cs {
-            v.visit_constr(tc.node.path, tc.span, tc.node.id, e, v);
-        }
-      }
-      _ {}
-    }
-}
-
-fn visit_constr<E>(_operator: @path, _sp: span, _id: node_id, _e: E,
-                   _v: vt<E>) {
-    // default
-}
-
-fn visit_path<E>(p: @path, e: E, v: vt<E>) {
-    for tp: @ty in p.node.types { v.visit_ty(tp, e, v); }
-}
-
-fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
-    alt p.node {
-      pat_enum(path, children) {
-        visit_path(path, e, v);
-        for child: @pat in children { v.visit_pat(child, e, v); }
-      }
-      pat_rec(fields, _) {
-        for f: field_pat in fields { v.visit_pat(f.pat, e, v); }
-      }
-      pat_tup(elts) { for elt in elts { v.visit_pat(elt, e, v); } }
-      pat_box(inner) | pat_uniq(inner) {
-        v.visit_pat(inner, e, v);
-      }
-      pat_ident(path, inner) {
-          visit_path(path, e, v);
-          option::may(inner, {|subpat| v.visit_pat(subpat, e, v)});
-      }
-      _ { }
-    }
-}
-
-fn visit_native_item<E>(ni: @native_item, e: E, v: vt<E>) {
-    alt ni.node {
-      native_item_fn(fd, tps) {
-        v.visit_ty_params(tps, e, v);
-        visit_fn_decl(fd, e, v);
-      }
-    }
-}
-
-fn visit_ty_params<E>(tps: [ty_param], e: E, v: vt<E>) {
-    for tp in tps {
-        for bound in *tp.bounds {
-            alt bound {
-              bound_iface(t) { v.visit_ty(t, e, v); }
-              _ {}
-            }
-        }
-    }
-}
-
-fn visit_fn_decl<E>(fd: fn_decl, e: E, v: vt<E>) {
-    for a: arg in fd.inputs { v.visit_ty(a.ty, e, v); }
-    for c: @constr in fd.constraints {
-        v.visit_constr(c.node.path, c.span, c.node.id, e, v);
-    }
-    v.visit_ty(fd.output, e, v);
-}
-
-// Note: there is no visit_method() method in the visitor, instead override
-// visit_fn() and check for fk_method().  I named this visit_method_helper()
-// because it is not a default impl of any method, though I doubt that really
-// clarifies anything. - Niko
-fn visit_method_helper<E>(m: @method, e: E, v: vt<E>) {
-    v.visit_fn(fk_method(m.ident, m.tps), m.decl, m.body, m.span,
-               m.id, e, v);
-}
-
-fn visit_fn<E>(fk: fn_kind, decl: fn_decl, body: blk, _sp: span,
-               _id: node_id, e: E, v: vt<E>) {
-    visit_fn_decl(decl, e, v);
-    v.visit_ty_params(tps_of_fn(fk), e, v);
-    v.visit_block(body, e, v);
-}
-
-fn visit_block<E>(b: ast::blk, e: E, v: vt<E>) {
-    for vi in b.node.view_items { v.visit_view_item(vi, e, v); }
-    for s in b.node.stmts { v.visit_stmt(s, e, v); }
-    visit_expr_opt(b.node.expr, e, v);
-}
-
-fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
-    alt s.node {
-      stmt_decl(d, _) { v.visit_decl(d, e, v); }
-      stmt_expr(ex, _) { v.visit_expr(ex, e, v); }
-      stmt_semi(ex, _) { v.visit_expr(ex, e, v); }
-    }
-}
-
-fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
-    alt d.node {
-      decl_local(locs) {
-        for loc in locs { v.visit_local(loc, e, v); }
-      }
-      decl_item(it) { v.visit_item(it, e, v); }
-    }
-}
-
-fn visit_expr_opt<E>(eo: option<@expr>, e: E, v: vt<E>) {
-    alt eo { none { } some(ex) { v.visit_expr(ex, e, v); } }
-}
-
-fn visit_exprs<E>(exprs: [@expr], e: E, v: vt<E>) {
-    for ex: @expr in exprs { v.visit_expr(ex, e, v); }
-}
-
-fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
-    alt m.node {
-      ast::mac_invoc(pth, arg, body) {
-        option::map(arg) {|arg| visit_expr(arg, e, v)}; }
-      ast::mac_embed_type(ty) { v.visit_ty(ty, e, v); }
-      ast::mac_embed_block(blk) { v.visit_block(blk, e, v); }
-      ast::mac_ellipsis { }
-      ast::mac_aq(_, e) { /* FIXME: maybe visit */ }
-      ast::mac_var(_) { }
-    }
-}
-
-fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
-    alt ex.node {
-      expr_vec(es, _) { visit_exprs(es, e, v); }
-      expr_rec(flds, base) {
-        for f: field in flds { v.visit_expr(f.node.expr, e, v); }
-        visit_expr_opt(base, e, v);
-      }
-      expr_tup(elts) { for el in elts { v.visit_expr(el, e, v); } }
-      expr_call(callee, args, _) {
-        visit_exprs(args, e, v);
-        v.visit_expr(callee, e, v);
-      }
-      expr_bind(callee, args) {
-        v.visit_expr(callee, e, v);
-        for eo: option<@expr> in args { visit_expr_opt(eo, e, v); }
-      }
-      expr_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
-      expr_unary(_, a) { v.visit_expr(a, e, v); }
-      expr_lit(_) { }
-      expr_cast(x, t) { v.visit_expr(x, e, v); v.visit_ty(t, e, v); }
-      expr_if(x, b, eo) {
-        v.visit_expr(x, e, v);
-        v.visit_block(b, e, v);
-        visit_expr_opt(eo, e, v);
-      }
-      expr_if_check(x, b, eo) {
-        v.visit_expr(x, e, v);
-        v.visit_block(b, e, v);
-        visit_expr_opt(eo, e, v);
-      }
-      expr_while(x, b) { v.visit_expr(x, e, v); v.visit_block(b, e, v); }
-      expr_for(dcl, x, b) {
-        v.visit_local(dcl, e, v);
-        v.visit_expr(x, e, v);
-        v.visit_block(b, e, v);
-      }
-      expr_do_while(b, x) { v.visit_block(b, e, v); v.visit_expr(x, e, v); }
-      expr_alt(x, arms, _) {
-        v.visit_expr(x, e, v);
-        for a: arm in arms { v.visit_arm(a, e, v); }
-      }
-      expr_fn(proto, decl, body, _) {
-        v.visit_fn(fk_anon(proto), decl, body, ex.span, ex.id, e, v);
-      }
-      expr_fn_block(decl, body) {
-        v.visit_fn(fk_fn_block, decl, body, ex.span, ex.id, e, v);
-      }
-      expr_block(b) { v.visit_block(b, e, v); }
-      expr_assign(a, b) { v.visit_expr(b, e, v); v.visit_expr(a, e, v); }
-      expr_copy(a) { v.visit_expr(a, e, v); }
-      expr_move(a, b) { v.visit_expr(b, e, v); v.visit_expr(a, e, v); }
-      expr_swap(a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
-      expr_assign_op(_, a, b) {
-        v.visit_expr(b, e, v);
-        v.visit_expr(a, e, v);
-      }
-      expr_field(x, _, tys) {
-        v.visit_expr(x, e, v);
-        for tp in tys { v.visit_ty(tp, e, v); }
-      }
-      expr_index(a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
-      expr_path(p) { visit_path(p, e, v); }
-      expr_fail(eo) { visit_expr_opt(eo, e, v); }
-      expr_break { }
-      expr_cont { }
-      expr_ret(eo) { visit_expr_opt(eo, e, v); }
-      expr_be(x) { v.visit_expr(x, e, v); }
-      expr_log(_, lv, x) {
-        v.visit_expr(lv, e, v);
-        v.visit_expr(x, e, v);
-      }
-      expr_check(_, x) { v.visit_expr(x, e, v); }
-      expr_assert(x) { v.visit_expr(x, e, v); }
-      expr_mac(mac) { visit_mac(mac, e, v); }
-    }
-}
-
-fn visit_arm<E>(a: arm, e: E, v: vt<E>) {
-    for p: @pat in a.pats { v.visit_pat(p, e, v); }
-    visit_expr_opt(a.guard, e, v);
-    v.visit_block(a.body, e, v);
-}
-
-// Simpler, non-context passing interface. Always walks the whole tree, simply
-// calls the given functions on the nodes.
-
-type simple_visitor =
-    // takes the components so that one function can be
-    // generic over constr and ty_constr
-    @{visit_mod: fn@(_mod, span, node_id),
-      visit_view_item: fn@(@view_item),
-      visit_native_item: fn@(@native_item),
-      visit_item: fn@(@item),
-      visit_local: fn@(@local),
-      visit_block: fn@(ast::blk),
-      visit_stmt: fn@(@stmt),
-      visit_arm: fn@(arm),
-      visit_pat: fn@(@pat),
-      visit_decl: fn@(@decl),
-      visit_expr: fn@(@expr),
-      visit_ty: fn@(@ty),
-      visit_ty_params: fn@([ty_param]),
-      visit_constr: fn@(@path, span, node_id),
-      visit_fn: fn@(fn_kind, fn_decl, blk, span, node_id),
-      visit_class_item: fn@(span, privacy, class_member)};
-
-fn simple_ignore_ty(_t: @ty) {}
-
-fn default_simple_visitor() -> simple_visitor {
-    ret @{visit_mod: fn@(_m: _mod, _sp: span, _id: node_id) { },
-          visit_view_item: fn@(_vi: @view_item) { },
-          visit_native_item: fn@(_ni: @native_item) { },
-          visit_item: fn@(_i: @item) { },
-          visit_local: fn@(_l: @local) { },
-          visit_block: fn@(_b: ast::blk) { },
-          visit_stmt: fn@(_s: @stmt) { },
-          visit_arm: fn@(_a: arm) { },
-          visit_pat: fn@(_p: @pat) { },
-          visit_decl: fn@(_d: @decl) { },
-          visit_expr: fn@(_e: @expr) { },
-          visit_ty: simple_ignore_ty,
-          visit_ty_params: fn@(_ps: [ty_param]) {},
-          visit_constr: fn@(_p: @path, _sp: span, _id: node_id) { },
-          visit_fn: fn@(_fk: fn_kind, _d: fn_decl, _b: blk, _sp: span,
-                        _id: node_id) { },
-          visit_class_item: fn@(_s: span, _p: privacy, _c: class_member) {}
-         };
-}
-
-fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
-    fn v_mod(f: fn@(_mod, span, node_id), m: _mod, sp: span, id: node_id,
-             &&e: (), v: vt<()>) {
-        f(m, sp, id);
-        visit_mod(m, sp, id, e, v);
-    }
-    fn v_view_item(f: fn@(@view_item), vi: @view_item, &&e: (), v: vt<()>) {
-        f(vi);
-        visit_view_item(vi, e, v);
-    }
-    fn v_native_item(f: fn@(@native_item), ni: @native_item, &&e: (),
-                     v: vt<()>) {
-        f(ni);
-        visit_native_item(ni, e, v);
-    }
-    fn v_item(f: fn@(@item), i: @item, &&e: (), v: vt<()>) {
-        f(i);
-        visit_item(i, e, v);
-    }
-    fn v_local(f: fn@(@local), l: @local, &&e: (), v: vt<()>) {
-        f(l);
-        visit_local(l, e, v);
-    }
-    fn v_block(f: fn@(ast::blk), bl: ast::blk, &&e: (), v: vt<()>) {
-        f(bl);
-        visit_block(bl, e, v);
-    }
-    fn v_stmt(f: fn@(@stmt), st: @stmt, &&e: (), v: vt<()>) {
-        f(st);
-        visit_stmt(st, e, v);
-    }
-    fn v_arm(f: fn@(arm), a: arm, &&e: (), v: vt<()>) {
-        f(a);
-        visit_arm(a, e, v);
-    }
-    fn v_pat(f: fn@(@pat), p: @pat, &&e: (), v: vt<()>) {
-        f(p);
-        visit_pat(p, e, v);
-    }
-    fn v_decl(f: fn@(@decl), d: @decl, &&e: (), v: vt<()>) {
-        f(d);
-        visit_decl(d, e, v);
-    }
-    fn v_expr(f: fn@(@expr), ex: @expr, &&e: (), v: vt<()>) {
-        f(ex);
-        visit_expr(ex, e, v);
-    }
-    fn v_ty(f: fn@(@ty), ty: @ty, &&e: (), v: vt<()>) {
-        f(ty);
-        visit_ty(ty, e, v);
-    }
-    fn v_ty_params(f: fn@([ty_param]), ps: [ty_param], &&e: (), v: vt<()>) {
-        f(ps);
-        visit_ty_params(ps, e, v);
-    }
-    fn v_constr(f: fn@(@path, span, node_id), pt: @path, sp: span,
-                id: node_id, &&e: (), v: vt<()>) {
-        f(pt, sp, id);
-        visit_constr(pt, sp, id, e, v);
-    }
-    fn v_fn(f: fn@(fn_kind, fn_decl, blk, span, node_id),
-            fk: fn_kind, decl: fn_decl, body: blk, sp: span,
-            id: node_id, &&e: (), v: vt<()>) {
-        f(fk, decl, body, sp, id);
-        visit_fn(fk, decl, body, sp, id, e, v);
-    }
-    let visit_ty = if v.visit_ty == simple_ignore_ty {
-        bind skip_ty(_, _, _)
-    } else {
-        bind v_ty(v.visit_ty, _, _, _)
-    };
-    fn v_class_item(f: fn@(span, privacy, class_member),
-                    s:span, p:privacy, cm: class_member, &&e: (),
-                    v: vt<()>) {
-        f(s, p, cm);
-        visit_class_item(s, p, cm, e, v);
-    }
-    ret mk_vt(@{visit_mod: bind v_mod(v.visit_mod, _, _, _, _, _),
-                visit_view_item: bind v_view_item(v.visit_view_item, _, _, _),
-                visit_native_item:
-                    bind v_native_item(v.visit_native_item, _, _, _),
-                visit_item: bind v_item(v.visit_item, _, _, _),
-                visit_local: bind v_local(v.visit_local, _, _, _),
-                visit_block: bind v_block(v.visit_block, _, _, _),
-                visit_stmt: bind v_stmt(v.visit_stmt, _, _, _),
-                visit_arm: bind v_arm(v.visit_arm, _, _, _),
-                visit_pat: bind v_pat(v.visit_pat, _, _, _),
-                visit_decl: bind v_decl(v.visit_decl, _, _, _),
-                visit_expr: bind v_expr(v.visit_expr, _, _, _),
-                visit_ty: visit_ty,
-                visit_ty_params: bind v_ty_params(v.visit_ty_params, _, _, _),
-                visit_constr: bind v_constr(v.visit_constr, _, _, _, _, _),
-                visit_fn: bind v_fn(v.visit_fn, _, _, _, _, _, _, _),
-                visit_class_item: bind v_class_item(v.visit_class_item, _, _,
-                                                    _, _, _)
-               });
-}
-
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End: