Parse a
(parse-definition token input) → (mv tree next-token rest-input)
Function:
(defun parse-definition (token input) (declare (xargs :guard (and (abnf::tree-optionp token) (abnf::tree-listp input)))) (let ((__function__ 'parse-definition)) (declare (ignorable __function__)) (b* (((pok tree1) (parse-identifier token input)) ((pok tree2) (parse-separator "(" token input)) ((pok tree3) (if (token-stringp ")" token) (mv (abnf::make-tree-nonleaf :rulename? nil :branches nil) token input) (b* (((pok< tree) (parse-identifier token input)) ((pok trees) (parse-*-comma-identifier token input))) (mv (abnf::make-tree-nonleaf :rulename? nil :branches (list (list tree) trees)) token input)))) ((pok tree4) (parse-separator ")" token input)) ((pok tree5) (parse-operator ":=" token input)) ((pok tree6) (parse-separator "{" token input)) ((pok tree7) (if (token-stringp "}" token) (mv (abnf::make-tree-nonleaf :rulename? nil :branches nil) token input) (b* (((pok< tree) (parse-constraint token input)) ((pok trees) (parse-*-comma-constraint token input))) (mv (abnf::make-tree-nonleaf :rulename? nil :branches (list (list tree) trees)) token input)))) ((pok tree8) (parse-separator "}" token input))) (mv (abnf::make-tree-nonleaf :rulename? (abnf::rulename "definition") :branches (list (list tree1) (list tree2) (list tree3) (list tree4) (list tree5) (list tree6) (list tree7) (list tree8))) token input))))
Theorem:
(defthm tree-resultp-of-parse-definition.tree (b* (((mv ?tree ?next-token ?rest-input) (parse-definition token input))) (abnf::tree-resultp tree)) :rule-classes :rewrite)
Theorem:
(defthm tree-optionp-of-parse-definition.next-token (b* (((mv ?tree ?next-token ?rest-input) (parse-definition token input))) (abnf::tree-optionp next-token)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-definition.rest-input (b* (((mv ?tree ?next-token ?rest-input) (parse-definition token input))) (abnf::tree-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm parsize-of-parse-definition-<= (b* (((mv ?tree ?next-token ?rest-input) (parse-definition token input))) (<= (parsize next-token rest-input) (parsize token input))) :rule-classes :linear)
Theorem:
(defthm parsize-of-parse-definition-< (b* (((mv ?tree ?next-token ?rest-input) (parse-definition token input))) (implies (not (reserrp tree)) (< (parsize next-token rest-input) (parsize token input)))) :rule-classes :linear)
Theorem:
(defthm parse-definition-of-tree-option-fix-token (equal (parse-definition (abnf::tree-option-fix token) input) (parse-definition token input)))
Theorem:
(defthm parse-definition-tree-option-equiv-congruence-on-token (implies (abnf::tree-option-equiv token token-equiv) (equal (parse-definition token input) (parse-definition token-equiv input))) :rule-classes :congruence)
Theorem:
(defthm parse-definition-of-tree-list-fix-input (equal (parse-definition token (abnf::tree-list-fix input)) (parse-definition token input)))
Theorem:
(defthm parse-definition-tree-list-equiv-congruence-on-input (implies (abnf::tree-list-equiv input input-equiv) (equal (parse-definition token input) (parse-definition token input-equiv))) :rule-classes :congruence)