• 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
                    • Parse-from-file-at-path+
                    • Tokens-to-cst
                    • Parse-fragment-to-cst+
                    • Lexemes-to-cst+
                    • Parse-from-string+
                    • Parse-from-codepoints+
                    • Parse-fragment-to-cst
                    • Parse-from-bytes+
                    • Parse-from-string
                    • Parse-from-file-at-path
                    • Token-parses?
                    • Statement-parses?
                      • Expression-parses?
                      • File-parses?
                      • Token-parses-same-fringe?
                      • Expression-parses-same-fringe?
                      • Statement-parses-same-fringe?
                      • Parse-from-codepoints
                      • File-parses-same-fringe?
                      • Parse-from-bytes
                    • Grammar-lexp
                    • Identifier-lexp
                    • Output-file-parsep
                    • Input-file-parsep
                    • File-lex-parse-p
                    • Filter-tokens
                    • Lexp
                    • File-parsep
                    • Input-parser
                    • 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
    • Parser-interface

    Statement-parses?

    Checks if the given string can be parsed to a Leo statement CST.

    Signature
    (statement-parses? statement-string) → yes/no
    Arguments
    statement-string — Guard (stringp statement-string).
    Returns
    yes/no — Type (booleanp yes/no).

    Checks that the given string is lexed, tokenized, and parsed successfully and checks that the CST from parsing has the root rule name statement.

    Does not check that the lexemes have the same fringe as the given string. For that you want statement-parses-same-fringe?.

    Definitions and Theorems

    Function: statement-parses?

    (defun statement-parses? (statement-string)
     (declare (xargs :guard (stringp statement-string)))
     (let ((__function__ 'statement-parses?))
      (declare (ignorable __function__))
      (b* ((tree? (parse-fragment-to-cst "statement" statement-string)))
        (and (abnf::treep tree?)
             (abnf-tree-with-root-p tree? "statement")))))

    Theorem: booleanp-of-statement-parses?

    (defthm booleanp-of-statement-parses?
      (b* ((yes/no (statement-parses? statement-string)))
        (booleanp yes/no))
      :rule-classes :rewrite)