   (let [interfaces (getinterfaces config)]
     (into {} (map #(vector % (compileintf path %)) interfaces))))
 
-(defn fieldattrs [ast]
+;;-----------------------------------------------------------------
+;; getX - extracts fields from an AST message
+;;-----------------------------------------------------------------
+(defn getfieldattrs [ast]
   (loop [loc ast attrs {}]
     (if (nil? loc)
       attrs

;;

;;(deftype Field    [^String modifier ^String type ^String name ^Int index])
;;(deftype Message  [^String name ^ArrayList fields])

(def grammar (insta/parser (io/resource "parsers/interface/grammar.bnf")
                           :auto-whitespace (insta/parser (io/resource "parsers/interface/skip.bnf"))))

      fields

      :else
      ;; do something with each node here
      (let [attrs (->> loc zip/down zip/right getfieldattrs)]
        (recur (zip/right loc) (assoc fields (:index attrs) attrs))))))

;;-----------------------------------------------------------------
;; buildX - build our ST friendly objects from the AST
;;-----------------------------------------------------------------
(defn buildfields [ast]
  (let [rawfields (getfields ast)]
      rawfields))

(defn buildmessage [ast]
  (let [name (->> ast zip/right zip/node)
        fields (buildfields (->> ast zip/right zip/right))]
      (->Message name fields)))

;;(defn generateproto [intf ast template]
;;  (loop [loc ast]
