Parse a
(parse-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 import declarations,
and then we parse the program declaration,
and return a
Function:
(defun parse-file (input) (declare (xargs :guard (abnf::tree-listp input))) (let ((__function__ 'parse-file)) (declare (ignorable __function__)) (b* (((mv token input) (parse-token input)) ((pok import-trees) (parse-*-import-declaration token input)) ((pok tree1) (parse-program-declaration token input))) (mv (abnf::make-tree-nonleaf :rulename? (abnf::rulename "file") :branches (list import-trees (list tree1))) nil nil))))
Theorem:
(defthm tree-resultp-of-parse-file.tree (b* (((mv ?tree ?next-token ?rest-input) (parse-file input))) (abnf::tree-resultp tree)) :rule-classes :rewrite)
Theorem:
(defthm tree-optionp-of-parse-file.next-token (b* (((mv ?tree ?next-token ?rest-input) (parse-file input))) (abnf::tree-optionp next-token)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-file.rest-input (b* (((mv ?tree ?next-token ?rest-input) (parse-file input))) (abnf::tree-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm parse-file-of-tree-list-fix-input (equal (parse-file (abnf::tree-list-fix input)) (parse-file input)))
Theorem:
(defthm parse-file-tree-list-equiv-congruence-on-input (implies (abnf::tree-list-equiv input input-equiv) (equal (parse-file input) (parse-file input-equiv))) :rule-classes :congruence)