• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
              • Lexer
              • Parser
              • Grammar-old
              • Grammar
              • Tokenizer
                • Tokenize-yul
                  • Filter-and-reduce-lexeme-tree-to-subtoken-trees
                  • Check-and-deref-tree-token?
                  • Check-and-deref-tree-lexeme?
                  • Tokenize-yul-bytes
                  • Is-tree-rulename?
              • Static-soundness
              • Static-semantics
              • Errors
            • Yul-json
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Tokenizer

    Tokenize-yul

    Lexes the bytes of yul-string into a list of tokens.

    Signature
    (tokenize-yul yul-string) → yul-lexemes
    Arguments
    yul-string — Guard (stringp yul-string).
    Returns
    yul-lexemes — Type (abnf::tree-list-resultp yul-lexemes).

    The returned trees are for rulenames keyword, literal, identifier, or symbol. Each token is represented by an abnf::tree. Discards comments and whitespace. If the input structure from any lexeme down to the specific token type is incorrect, returns an error result value of type reserr instead of a list of tokens. Also, if the input string ends in the middle of a token, returns reserr.

    Definitions and Theorems

    Function: tokenize-yul

    (defun tokenize-yul (yul-string)
     (declare (xargs :guard (stringp yul-string)))
     (let ((__function__ 'tokenize-yul))
      (declare (ignorable __function__))
      (b*
       (((mv erp lexeme-trees)
         (lexemeize-yul yul-string))
        ((when erp)
         (reserrf "problem lexing yul-string"))
        (subtoken-trees
         (filter-and-reduce-lexeme-tree-to-subtoken-trees lexeme-trees))
        ((when (reserrp subtoken-trees))
         (reserrf "problem with structure of lexeme tree")))
       subtoken-trees)))

    Theorem: tree-list-resultp-of-tokenize-yul

    (defthm tree-list-resultp-of-tokenize-yul
      (b* ((yul-lexemes (tokenize-yul yul-string)))
        (abnf::tree-list-resultp yul-lexemes))
      :rule-classes :rewrite)