Given a :nonleaf ABNF tree with rulename "decimal-number", return the appropriate literal AST node.
(cst2ast-decimal-number tree) → ast-node?
Function:
(defun cst2ast-decimal-number (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'cst2ast-decimal-number)) (declare (ignorable __function__)) (b* ((fringe (abnf::tree->string tree)) ((unless (acl2::unsigned-byte-listp 8 fringe)) (prog2$ (er hard? 'top-level "unexpected type of leafterm nats when parsing idenntifier") nil)) (decimal-number-string (acl2::nats=>string fringe)) (maybe-nat (str::strval decimal-number-string))) (if (natp maybe-nat) (make-literal-dec-number :get maybe-nat) nil))))
Theorem:
(defthm literal-optionp-of-cst2ast-decimal-number (b* ((ast-node? (cst2ast-decimal-number tree))) (literal-optionp ast-node?)) :rule-classes :rewrite)