Parse an
(parse-input-file input) → (mv tree next-token rest-input)
This is the top-level function that organizes a list of tokens
into a CST.
We get the first token (if any),
and then we parse zero or more declarations,
and return an
Function:
(defun parse-input-file (input) (declare (xargs :guard (abnf::tree-listp input))) (let ((__function__ 'parse-input-file)) (declare (ignorable __function__)) (b* (((mv token input) (parse-token input)) ((pok trees) (parse-*-input-section token input)) ((when (or token (consp input))) (mv (reserrf :impossible) token input)) (tree (abnf::make-tree-nonleaf :rulename? (abnf::rulename "input-file") :branches (list trees)))) (mv tree nil nil))))
Theorem:
(defthm tree-resultp-of-parse-input-file.tree (b* (((mv ?tree ?next-token ?rest-input) (parse-input-file input))) (abnf::tree-resultp tree)) :rule-classes :rewrite)
Theorem:
(defthm tree-optionp-of-parse-input-file.next-token (b* (((mv ?tree ?next-token ?rest-input) (parse-input-file input))) (abnf::tree-optionp next-token)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-input-file.rest-input (b* (((mv ?tree ?next-token ?rest-input) (parse-input-file input))) (abnf::tree-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm parse-input-file-of-tree-list-fix-input (equal (parse-input-file (abnf::tree-list-fix input)) (parse-input-file input)))
Theorem:
(defthm parse-input-file-tree-list-equiv-congruence-on-input (implies (abnf::tree-list-equiv input input-equiv) (equal (parse-input-file input) (parse-input-file input-equiv))) :rule-classes :congruence)