             }
             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

        ++_stkptr
    }

    // Rule interpreter.
    func execute (part: Part, _ lexer: Lexer)
    -> Result
    {
        func resolve (name: String) -> Part
        {
            if let _    = _ruleMap[name] { return .TerminalLex(name)   }
            if let part = _partMap[name] { return .NestedParse([part]) }

            println("Parser error: Undefined symbol “\(name)”")
            return .Disjunction([])     // Constant Failure.
        }
        
        func element (body: Part[], index: Int) -> Part
        {
            var part = body[index]
            switch part
            {
            case .RulePromise(let name) :
                part = resolve(name)
                body[index] = part
            default :
                nil
            }
            return part
        }

        switch part
        {
        case .RulePromise(let name) :
            return execute(resolve(name), lexer)
            
        case .TerminalLex(let name) :
            if let (term, value: Value) = lexer.next()
            {
                if term == name
                {
                    store(value)
                    return value

/// A Parser using rules made of composable functions.
class Parser
{
    /// —— Public Types ——

    // Values that occur during parsing.  Those are terminal values
    // from the lexer as well as parse results of nonterminal rules
    // and return values from your action code blocks.
    typealias Value  = NSObject

    // Actual rule result type includes the possibility of failure.
    typealias Result = Value?

    // Interface that lets your action code blocks access the parse
    // results of previous elements in the current nonterminal rule.
    // Naming the Getter as `$`, you access the first value with
    // `$(1)`.  `$(0)` would access the last value that was parsed
    // before the current rule became active.  It is your responsibility
    // to keep the index argument to the Getter in a sensible range.
    typealias Getter = (Int) -> Value

    // Your action code blocks.  Note that you may return nil to signal failure.
    typealias Action = (Getter) -> Result

    /// —— Public Methods ——

    /// Constructs a parser for a grammar with the given terminal symbols.
    init (terminals: String[])
    {
        _tsRule = Dictionary()
        _ntRule = Dictionary()
        _values = []
        _stkptr = 0
        _ntbase = 0

        for name in terminals
        {
            _tsRule[name] = true
        }
    }

    /// Defines a parsing rule for the named nonterminal in the grammar.
    func rule (name: String, parses rule: Rule)
    {
        _ntRule[name] = rule
    }

    /// 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 (rule: Rule, _ lexer: Lexer)
    -> Result
    {
        _values = []
        _stkptr = 0
        _ntbase = 0

        return execute(compile(rule), lexer)
    }

    /// Parses the defined grammar with the given start symbol.
    func start (symbol: String, _ lexer: Lexer)
    -> Result
    {
        return start(.RulePromise(symbol), lexer)
    }

    /// —— Private Parts ——

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

    var _tsRule: Dictionary<String, Bool>
    var _ntRule: Dictionary<String, Rule>
    var _values: Value[]
    var _stkptr: Int
    var _ntbase: Int

    // Getter for the current NT's parse results.
    @lazy var getter: Getter = { [unowned self] index in self._values[self._ntbase + index - 1] }

    func store (value: Value)
    {
