             }
             return nil
 
-        case .NestedParse(let partBox) :
+        case .NestedParse(let ruleBox) :
             let stkptr = _stkptr
             let ntbase = _ntbase
             _ntbase = stkptr
-            let result: Result = execute(partBox[0], lexer)
+            let result = execute(ruleBox[0], lexer)
             _stkptr = stkptr
             _ntbase = ntbase
-            if let value: Value = result { store(value) }
+            if let value = result { store(value) }
             return result
-            
+
         case .Conjunction(let body) :
             var index = 0
-            let limit = body.count
+            let count = body.count
             var latest: Result = true
-            while latest && index < limit
-            {
-                latest = execute(element(body, index), lexer)
-                ++index
+            while latest && index < count
+            {
+                latest = execute(body[index++], lexer)
             }
             return latest
-            
+
         case .Disjunction(let body) :
             let stkptr = _stkptr
             let mark = lexer.tell()
-            let final = body.count - 1
-            for index in 0...final
-            {
-                let result: Result = execute(element(body, index), lexer)
+            let count = body.count
+            for index in 0..count
+            {
+                let result = execute(body[index], lexer)
                 if result { return result }
                 _stkptr = stkptr
                 lexer.seek(mark)
             }
             return nil
-            
+
         case .Computation(let actionBox) :
-            return actionBox[0](getter)
-            
-        case .Termination(let partBox) :
-            let result: Result = execute(partBox[0], lexer)
+            let result = actionBox[0](getter)
+            if let value = result { store(value) }
+            return result
+
+        case .Termination(let ruleBox) :
+            let result = execute(ruleBox[0], lexer)
             return lexer.done() ? result : nil
         }
-    }
-
-    // Getter for the current NT's parse results.
-    @lazy var getter: Getter = { [unowned self] index in self._values[self._ntbase + index - 1] }
-
-    /// Constructs a parser for a grammar with the given terminal symbols.
-    init (terminals: String[])
-    {
-        _ruleMap = Dictionary()
-        _partMap = Dictionary()
-        _values  = []
-        _stkptr  = 0
-        _ntbase  = 0
-
-        for name in terminals
-        {
-            _ruleMap[name] = true
-        }
-    }
-
-    /// Defines a parsing rule for the named nonterminal in the grammar.
-    func rule (name: String, parses part: Part)
-    {
-        _partMap[name] = part
-    }
-
-    /// Defines a parsing rule for the named nonterminal in the grammar.
-    func rule (name: String, parses symbol: String)
-    {
-        rule(name, parses: .RulePromise(symbol))
-    }
-
-    /// Parses the defined grammar starting with the given rule.
-    func start (part: Part, _ lexer: Lexer)
-    -> Result
-    {
-        _values = []
-        _stkptr = 0
-        _ntbase = 0
-
-        return execute(part, lexer)
-    }
-
-    /// Parses the defined grammar with the given start symbol.
-    func start (symbol: String, _ lexer: Lexer)
-    -> Result
-    {
-        return start(.RulePromise(symbol), lexer)
     }
 
 }   // class Parser

/// A Parser using rules made of composable functions.
class Parser
{
    typealias Value  = AnyObject
    typealias Result = Value?
    typealias Getter = (Int) -> Value
    typealias Action = (Getter) -> Result

    // Abstraction for nonterminal elements.
    enum Part
    {
        case RulePromise(String)
        case TerminalLex(String)
        case NestedParse(Part[])    // Boxing Array
        case Conjunction(Part[])    // Actual Array
        case Disjunction(Part[])    // Actual Array
        case Computation(Action[])  // Boxing Array
        case Termination(Part[])    // Boxing Array
    }

    var _ruleMap: Dictionary<String, Bool>
    var _partMap: Dictionary<String, Part>
    var _values:  Value[]
    var _stkptr:  Int
    var _ntbase:  Int

    func store (value: Value)
    {

/// =<`value`   (an Unconditional Success rule)
/// Successfully parses an empty slice of input and returns the given value.
@prefix func =< (value: Parser.Value)
-> Parser.Rule
{
    return .Computation([{ _ in value }])
}

/// =!`action`   (an Unconditional Success rule)
/// Successfully parses an empty slice of input and returns the action's value.
@prefix func =! (block: Parser.Action)
-> Parser.Rule
{
    return .Computation([block])
}

/// `rule` &> `rule`
/// Attempts to parse the conjunction of LHS and RHS sequentially.
@infix func &> (lhsRule: Parser.Rule, rhsRule: Parser.Rule)
-> Parser.Rule
{
    switch lhsRule
    {
    case .Conjunction(let lhsBody) :
        var body = lhsBody.copy()
        switch rhsRule
        {
        case .Conjunction(let rhsBody) :
            body.extend(rhsBody)
            return .Conjunction(body)

        default :
            body.append(rhsRule)
            return .Conjunction(body)
        }

    default :
        switch rhsRule
        {
        case .Conjunction(let rhsBody) :
            var body = rhsBody.copy()
            body.insert(lhsRule, atIndex: 0)
            return .Conjunction(body)

        default :
            return .Conjunction([lhsRule, rhsRule])
        }
    }
}

@infix func &> (lhsRule: Parser.Rule, rhsBlock: Parser.Action)
-> Parser.Rule
{
    return (lhsRule &> .Computation([rhsBlock]))
}

@infix func &> (lhsRule: Parser.Rule, rhsName: String)
-> Parser.Rule
{
    return (lhsRule &> .RulePromise(rhsName))
}

@infix func &> (lhsBlock: Parser.Action, rhsRule: Parser.Rule)
-> Parser.Rule
{
    return (.Computation([lhsBlock]) &> rhsRule)
}

@infix func &> (lhsBlock: Parser.Action, rhsName: String)
-> Parser.Rule
{
    return (.Computation([lhsBlock]) &> .RulePromise(rhsName))
}

@infix func &> (lhsName: String, rhsRule: Parser.Rule)
-> Parser.Rule
{
    return (.RulePromise(lhsName) &> rhsRule)
}

@infix func &> (lhsName: String, rhsBlock: Parser.Action)
-> Parser.Rule
{
    return (.RulePromise(lhsName) &> .Computation([rhsBlock]))
}

@infix func &> (lhsName: String, rhsName: String)
-> Parser.Rule
{
    return .Conjunction([.RulePromise(lhsName), .RulePromise(rhsName)])
}

/// `rule` |> `rule`
/// Attempts to parse LHS first and RHS afterwards, if LHS fails.
@infix func |> (lhsRule: Parser.Rule, rhsRule: Parser.Rule)
-> Parser.Rule
{
    switch lhsRule
    {
    case .Disjunction(let lhsBody) :
        var body = lhsBody.copy()
        switch rhsRule
        {
        case .Disjunction(let rhsBody) :
            body.extend(rhsBody)
            return .Disjunction(body)

        default :
            body.append(rhsRule)
            return .Disjunction(body)
        }

    default :
        switch rhsRule
        {
        case .Disjunction(let rhsBody) :
            var body = rhsBody.copy()
            body.insert(lhsRule, atIndex: 0)
            return .Disjunction(body)

        default :
            return .Disjunction([lhsRule, rhsRule])
        }
    }
}

@infix func |> (lhsRule: Parser.Rule, rhsBlock: Parser.Action)
-> Parser.Rule
{
    return (lhsRule |> .Computation([rhsBlock]))
}

@infix func |> (lhsRule: Parser.Rule, rhsName: String)
-> Parser.Rule
{
    return (lhsRule |> .RulePromise(rhsName))
}

@infix func |> (lhsBlock: Parser.Action, rhsRule: Parser.Rule)
-> Parser.Rule
{
    return (.Computation([lhsBlock]) |> rhsRule)
}

@infix func |> (lhsBlock: Parser.Action, rhsName: String)
-> Parser.Rule
{
    return (.Computation([lhsBlock]) |> .RulePromise(rhsName))
}

@infix func |> (lhsName: String, rhsRule: Parser.Rule)
-> Parser.Rule
{
    return (.RulePromise(lhsName) |> rhsRule)
}

@infix func |> (lhsName: String, rhsBlock: Parser.Action)
-> Parser.Rule
{
    return (.RulePromise(lhsName) |> .Computation([rhsBlock]))
}

@infix func |> (lhsName: String, rhsName: String)
-> Parser.Rule
{
    return .Disjunction([.RulePromise(lhsName), .RulePromise(rhsName)])
}

/// `rule`<!
/// Asserts End-Of-Input (EOI) after parsing the preceding rule.
@postfix func <! (rule: Parser.Rule)
-> Parser.Rule
{
    return .Termination([rule])
}

@postfix func <! (name: String)
-> Parser.Rule
{
    return .Termination([.RulePromise(name)])
}

@postfix func <! (block: Parser.Action)
-> Parser.Rule
{
    return .Termination([.Computation([block])])
}

/// `rule` <! `action`
/// Asserts EOI after parsing the rule, then returns the action's value.
@infix func <! (condition: Parser.Rule, block: Parser.Action)
-> Parser.Rule
{
    return (.Termination([condition]) &> .Computation([block]))
}

@infix func <! (condName: String, block: Parser.Action)
-> Parser.Rule
{
    return (.Termination([.RulePromise(condName)]) &> .Computation([block]))
}

/// Sequence construction utility for use in rule actions.
