• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Lexer
            • Lex-strings
            • Lex-identifiers
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
            • Chartypes
            • Vl-lex
              • Vl-lex-token1
              • Vl-lex-plain-alist
              • Vl-lex-plain
              • Vl-lex-token
              • Vl-lex-main
                • Vl-lex-main-exec
              • Defchar
              • Tokens
              • Lex-keywords
              • Lexstate
              • Make-test-tokens
              • Lexer-utils
              • Lex-comments
              • Vl-typo-uppercase-list-p
              • Vl-typo-lowercase-list-p
              • Vl-typo-number-list-p
            • Vl-loadstate
            • Parser
            • Vl-load-merge-descriptions
            • Scope-of-defines
            • Vl-load-file
            • Vl-flush-out-descriptions
            • Vl-description
            • Vl-loadresult
            • Vl-read-file
            • Vl-find-basename/extension
            • Vl-find-file
            • Vl-read-files
            • Extended-characters
            • Vl-load
            • Vl-load-main
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-load-descriptions
            • Vl-load-files
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-descriptionlist
          • Transforms
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-lex

    Vl-lex-main

    Signature
    (vl-lex-main echars st warnings) 
      → 
    (mv successp token-list warnings)
    Arguments
    echars — Guard (vl-echarlist-p echars).
    st — Guard (vl-lexstate-p st).
    warnings — Guard (vl-warninglist-p warnings).
    Returns
    warnings — Type (vl-warninglist-p warnings).

    Definitions and Theorems

    Function: vl-lex-main

    (defun vl-lex-main (echars st warnings)
     (declare (xargs :guard (and (vl-echarlist-p echars)
                                 (vl-lexstate-p st)
                                 (vl-warninglist-p warnings))))
     (let ((__function__ 'vl-lex-main))
      (declare (ignorable __function__))
      (mbe
          :logic
          (b* (((when (atom echars)) (mv t nil (ok)))
               ((mv first echars warnings)
                (vl-lex-token echars st warnings))
               ((unless first) (mv nil nil warnings))
               ((mv successp rest warnings)
                (vl-lex-main echars st warnings)))
            (mv successp (cons first rest)
                warnings))
          :exec
          (with-local-stobj
               nrev
               (mv-let (successp tokens warnings nrev)
                       (b* (((mv successp nrev warnings)
                             (vl-lex-main-exec echars nrev st warnings))
                            ((mv tokens nrev) (nrev-finish nrev)))
                         (mv successp tokens warnings nrev))
                 (mv successp tokens warnings))))))

    Theorem: vl-warninglist-p-of-vl-lex-main.warnings

    (defthm vl-warninglist-p-of-vl-lex-main.warnings
      (b* (((mv ?successp ?token-list ?warnings)
            (vl-lex-main echars st warnings)))
        (vl-warninglist-p warnings))
      :rule-classes :rewrite)

    Theorem: vl-lex-main-exec-redefinition

    (defthm vl-lex-main-exec-redefinition
      (equal (vl-lex-main-exec echars acc st warnings)
             (mv-let (successp tokens warnings)
                     (vl-lex-main echars st warnings)
               (mv successp (append acc tokens)
                   warnings))))

    Theorem: type-of-vl-lex-main-successp

    (defthm type-of-vl-lex-main-successp
      (booleanp (mv-nth 0 (vl-lex-main echars st warnings)))
      :rule-classes :type-prescription)

    Theorem: true-listp-of-vl-lex-main-tokens

    (defthm true-listp-of-vl-lex-main-tokens
      (true-listp (mv-nth 1 (vl-lex-main echars st warnings)))
      :rule-classes :type-prescription)

    Theorem: vl-tokenlist-p-of-vl-lex-main

    (defthm vl-tokenlist-p-of-vl-lex-main
     (implies
          (and (force (vl-echarlist-p echars))
               (force (vl-lexstate-p st)))
          (vl-tokenlist-p (mv-nth 1 (vl-lex-main echars st warnings)))))

    Theorem: vl-tokenlist->etext-of-vl-lex-main

    (defthm vl-tokenlist->etext-of-vl-lex-main
      (b* (((mv okp tokens ?warnings)
            (vl-lex-main echars st warnings)))
        (implies (and okp (force (vl-echarlist-p echars))
                      (force (true-listp echars))
                      (force (vl-lexstate-p st)))
                 (equal (vl-tokenlist->etext tokens)
                        echars))))