• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
              • Compilation
              • Static-semantics
              • Concrete-syntax
                • Pretty-printer
                • Grammar
                • Lexing-and-parsing
                  • Lexer
                  • Parser
                  • Token-fringe
                  • Longest-lexp
                  • Parser-interface
                  • Grammar-lexp
                  • Identifier-lexp
                  • Output-file-parsep
                  • Input-file-parsep
                  • File-lex-parse-p
                  • Filter-tokens
                  • Lexp
                  • File-parsep
                  • Input-parser
                    • Parse-public/private/constants/constant/const/main/registers
                    • Parse-public/private/constants/constant/const
                    • Parse-input-item
                    • Parse-input-expression
                    • Parse-input-title
                    • Parse-input-section
                    • Parse-*-input-section
                    • Parse-input-type
                    • Parse-*-input-item
                    • Parse-input-file
                    • Output-file-lex-parse-p
                    • Input-file-lex-parse-p
                    • Parser-abstractor-interface
                    • Identifier-abnf-stringp
                    • Symbol-abnf-stringp
                    • Keyword-abnf-stringp
                    • Output-parser
                    • Tokenizer
                  • Input-pretty-printer
                  • Output-pretty-printer
                  • Unicode-characters
                  • Concrete-syntax-trees
                  • Symbols
                  • Keywords
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Input-parser

    Parse-input-file

    Parse an input-file.

    Signature
    (parse-input-file input) → (mv tree next-token rest-input)
    Arguments
    input — Guard (abnf::tree-listp input).
    Returns
    tree — Type (abnf::tree-resultp tree).
    next-token — Type (abnf::tree-optionp next-token).
    rest-input — Type (abnf::tree-listp 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 input-file CST. If there is no error, there is no next token and no remaining input.

    Definitions and Theorems

    Function: parse-input-file

    (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: tree-resultp-of-parse-input-file.tree

    (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: tree-optionp-of-parse-input-file.next-token

    (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: tree-listp-of-parse-input-file.rest-input

    (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: parse-input-file-of-tree-list-fix-input

    (defthm parse-input-file-of-tree-list-fix-input
      (equal (parse-input-file (abnf::tree-list-fix input))
             (parse-input-file input)))

    Theorem: parse-input-file-tree-list-equiv-congruence-on-input

    (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)