         [:ok thm-name definition metadata]))))
 
 (defn handle-thm-declaration [thm-name params ty]
-  (let [[status params] (reduce (fn [[_ params] [x ty]]
-                                  (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
-                                    (if (= status :ko)
-                                      (reduced [:ko ty'])
-                                      [:ok (conj params [x ty'])]))) [:ok []] params)]
+  (let [[status params] (parse-parameters defenv/empty-env params)]
     (if (= status :ko)
       [:ko params]
       (let [[status ty'] (stx/parse-term defenv/empty-env ty)]

        [:ok ax-name definition metadata]))))

(defn handle-ax-declaration [ax-name params ty]
  (let [[status params] (reduce (fn [[_ params] [x ty]]
                                  (let [[status ty'] (stx/parse-term defenv/empty-env ty)]
                                    (if (= status :ko)
                                      (reduced [:ko ty'])
                                      [:ok (conj params [x ty'])]))) [:ok []] params)]
    (if (= status :ko)
      [:ko params]
      (let [[status ty'] (stx/parse-term defenv/empty-env ty)]

                                                             :arglists (list (quote ~params)))))
               [:defined :term (quote ~def-name)])))))))

(defn parse-parameters [def-env params]
  (reduce (fn [[sts params] [x ty]]
            (let [[status ty] (stx/parse-term def-env ty)]
              (if (= status :ko)
                (reduced [:ko ty])
                [:ok (conj params [x ty])]))) [:ok []] params))

(defn handle-term-definition [def-name params body]
  ;; parse parameters
  (let [[status params] (parse-parameters defenv/empty-env params)]
    (if (= status :ko)
      [:ko params]
      (let [[status body-term] (stx/parse-term defenv/empty-env body)]
