• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Vl-loadstate
          • 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-1step-or-number
              • Vl-lex-timescale
              • Vl-lex-plain
              • Vl-lex-plain-alist
              • 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
            • Parser
            • Vl-load-merge-descriptions
            • Vl-find-basename/extension
            • Vl-load-file
            • Vl-loadresult
            • Scope-of-defines
            • Vl-find-file
            • Vl-flush-out-descriptions
            • Vl-description
            • Vl-read-file
            • Vl-includeskips-report-gather
            • Vl-load-main
            • Extended-characters
            • Vl-load
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-preprocess-debug
            • Vl-write-preprocessor-debug-file
            • Vl-read-file-report-gather
            • Vl-load-descriptions
            • Vl-load-files
            • Translate-off
            • Vl-load-read-file-hook
            • Vl-read-file-report
            • Vl-loadstate-pad
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-loadstate->warnings
            • Vl-iskips-report
            • Vl-descriptionlist
          • Warnings
          • Getting-started
          • Utilities
          • Printer
          • Kit
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-lex

    Vl-lex-main

    Signature
    (vl-lex-main echars breakp st warnings) 
      → 
    (mv successp token-list warnings)
    Arguments
    echars — Guard (vl-echarlist-p echars).
    breakp — Guard (booleanp breakp).
    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 breakp st warnings)
     (declare (xargs :guard (and (vl-echarlist-p echars)
                                 (booleanp breakp)
                                 (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 breakp st warnings))
         ((unless first) (mv nil nil warnings))
         (breakp
             (and (eq (vl-token->type first) :vl-ws)
                  (vl-echarlist-has-newline-p (vl-token->etext first))))
         ((mv successp rest warnings)
          (vl-lex-main echars breakp 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 breakp 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 breakp 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 breakp acc st warnings)
             (mv-let (successp tokens warnings)
                     (vl-lex-main echars breakp 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 breakp 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 breakp 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 (booleanp breakp))
                    (force (vl-lexstate-p st)))
               (vl-tokenlist-p
                    (mv-nth 1
                            (vl-lex-main echars breakp 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 breakp st warnings)))
        (implies (and okp (force (vl-echarlist-p echars))
                      (force (true-listp echars))
                      (force (booleanp breakp))
                      (force (vl-lexstate-p st)))
                 (equal (vl-tokenlist->etext tokens)
                        echars))))