 (defn parse [code]
   (-root (lex code)))
 
-(defn matched-nodes [input types] ;; bit round the houses
+(defn alternatives [input types] ;; bit round the houses
   (vec (map (fn [t] (t input)) ;; get nodes for each matching type
             (filter (fn [t] (not= nil (t input))) ;; get matching types
                     types))))

;; values

(defn -value [token]
  (def nodes (matched-nodes token value-types))
  (if (> (count nodes) 0)
    (nnode :value [(first nodes)])
    nil))

;; expressions

(defn -expression [tokens collected]
  (def expressions (alternatives tokens [-assignment -invocation]))
  (if (> (count expressions) 0)
    (let [{expr :expr left-tokens :left-tokens} (first expressions)]
      {:expr (nnode :expression [expr]) :left-tokens left-tokens}) ;; return expr
