• 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

    Parse-from-string

    Parse UTF-8 ACL2 string into a CST.

    Signature
    (parse-from-string leo-string) → tree
    Arguments
    leo-string — Guard (stringp leo-string).
    Returns
    tree — Type (abnf::tree-resultp tree).

    Lexes, tokenizes, and parses a Leo source file expressed as a string of acl2 characters whose char-codes are UTF-8 bytes. Returns a file CST.

    If any step fails, returns a reserr. The parse consumes the entire string or a reserr is returned.

    Since ACL2 strings are sequences of characters with codes from 0 to 255, leo-string, when converted to codes, is required to be valid UTF-8.

    Definitions and Theorems

    Function: parse-from-string

    (defun parse-from-string (leo-string)
      (declare (xargs :guard (stringp leo-string)))
      (let ((__function__ 'parse-from-string))
        (declare (ignorable __function__))
        (b* (((mv file-cst ?lexemes)
              (parse-from-string+ leo-string)))
          file-cst)))

    Theorem: tree-resultp-of-parse-from-string

    (defthm tree-resultp-of-parse-from-string
      (b* ((tree (parse-from-string leo-string)))
        (abnf::tree-resultp tree))
      :rule-classes :rewrite)