• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
        • Proof-support
        • Semantics
        • Lifting
        • R1cs-subset
        • Indexed-names
        • Well-formedness
        • Abstract-syntax
        • Concrete-syntax
          • Lexer
            • Lex-separator
            • Lex-operator
            • Lex-group-letter/digit/_
            • Lex-token
            • Lex-whitespace
            • Lex-line-terminator
            • Lex-identifier
            • Lex-lexeme
            • Lex-letter
            • Lex-uppercase-letter
            • Lex-lowercase-letter
            • Lex-carriage-return
            • Lex-line-feed
            • Lex-space
            • Lex-optional-cr
            • Lex-numeral
            • Lex-digit
            • Lex-*-rest-of-identifier
            • Lex-1*-digit
            • Lexemize-pfcs-from-string
            • Lex-*-lexeme
            • Lex-*-digit
            • Lexemize-pfcs-from-bytes
              • Lexemize-pfcs
              • *defparse-pfcs-repetition-table*
              • *defparse-pfcs-option-table*
              • Lex-generation-macros
              • *defparse-pfcs-group-table*
              • Lex-generation-tables
            • Grammar
            • Parser
            • Tokenizer
          • R1cs-bridge
          • Parser-interface
        • Wp-gen
        • Dimacs-reader
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Riscv
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Lexer

    Lexemize-pfcs-from-bytes

    Lexes the UTF-8 bytes into a list of lexemes.

    Signature
    (lexemize-pfcs-from-bytes pfcs-bytes) → pfcs-lexemes
    Arguments
    pfcs-bytes — Guard (nat-listp pfcs-bytes).
    Returns
    pfcs-lexemes — Type (abnf::tree-list-resultp pfcs-lexemes).

    A lexeme is a token or whitespace. lexemize-pfcs-from-bytes returns two values: an error flag and a list of these lexemes in abnf::tree form.

    If the input cannot be fully lexed, a reserrp is returned.

    Definitions and Theorems

    Function: lexemize-pfcs-from-bytes

    (defun lexemize-pfcs-from-bytes (pfcs-bytes)
      (declare (xargs :guard (nat-listp pfcs-bytes)))
      (let ((__function__ 'lexemize-pfcs-from-bytes))
        (declare (ignorable __function__))
        (b* (((unless (unsigned-byte-listp 8 pfcs-bytes))
              (reserrf (cons :invalid-octets pfcs-bytes)))
             (codepoints (acl2::utf8=>ustring pfcs-bytes))
             ((unless (nat-listp codepoints))
              (reserrf (cons :invalid-utf-8 pfcs-bytes))))
          (lexemize-pfcs codepoints))))

    Theorem: tree-list-resultp-of-lexemize-pfcs-from-bytes

    (defthm tree-list-resultp-of-lexemize-pfcs-from-bytes
      (b* ((pfcs-lexemes (lexemize-pfcs-from-bytes pfcs-bytes)))
        (abnf::tree-list-resultp pfcs-lexemes))
      :rule-classes :rewrite)