ACL2 string from the fringe of the ABNF tree.
(tree=>string tree) → fringe?
For a tree that with no rulename leaves
(satisfies abnf::tree-terminatedp), this is
similar to
Another difference is that
If any number in the fringe is not a valid codepoint, return a reserrp.
Function:
(defun tree=>string (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'tree=>string)) (declare (ignorable __function__)) (b* ((abnf-string (abnf::tree->string tree)) ((unless (nat-listp abnf-string)) (reserrf (cons "Nonterminal leaves detected" abnf-string))) ((unless (acl2::ustring? abnf-string)) (reserrf (cons "Not a valid list of unicode codepoints" abnf-string))) (utf8-bytes (acl2::ustring=>utf8 abnf-string))) (nats=>string utf8-bytes))))
Theorem:
(defthm string-resultp-of-tree=>string (b* ((fringe? (tree=>string tree))) (string-resultp fringe?)) :rule-classes :rewrite)