• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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-exec

    Tail recursive implementation.

    Signature
    (vl-lex-main-exec echars breakp nrev st warnings) 
      → 
    (mv successp nrev warnings)
    Arguments
    echars — Guard (vl-echarlist-p echars).
    breakp — Guard (booleanp breakp).
    nrev — Guard (vl-tokenlist-p (nrev-copy nrev)).
    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-exec

    (defun vl-lex-main-exec (echars breakp nrev st warnings)
     (declare (xargs :stobjs (nrev)))
     (declare (xargs :guard (and (vl-echarlist-p echars)
                                 (booleanp breakp)
                                 (vl-tokenlist-p (nrev-copy nrev))
                                 (vl-lexstate-p st)
                                 (vl-warninglist-p warnings))))
     (let ((__function__ 'vl-lex-main-exec))
      (declare (ignorable __function__))
      (b*
       ((nrev (nrev-fix nrev))
        ((when (atom echars)) (mv t nrev (ok)))
        ((mv tok remainder warnings)
         (vl-lex-token echars breakp st warnings))
        ((when tok)
         (let*
          ((nrev (nrev-push tok nrev))
           (breakp
              (and (eq (vl-token->type tok) :vl-ws)
                   (vl-echarlist-has-newline-p (vl-token->etext tok)))))
          (vl-lex-main-exec remainder breakp nrev st warnings)))
        (- (cw "About to cause an error.~%"))
        (prev-chars (nrev-copy nrev))
        (prev-chop (nthcdr (nfix (- (length prev-chars) 30))
                           prev-chars))
        (prev-str
             (vl-echarlist->string (vl-tokenlist->etext prev-chop))))
       (mv
        (cw
         "Lexer error (~s0): unable to identify a valid token.~%~
                 [[ Previous  ]]: ~s1~%~
                 [[ Remaining ]]: ~s2~%"
         (vl-location-string (vl-echar->loc (car echars)))
         prev-str
         (vl-echarlist->string (first-n (min 30 (len echars)) echars)))
        nrev warnings))))

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

    (defthm vl-warninglist-p-of-vl-lex-main-exec.warnings
      (b* (((mv ?successp acl2::?nrev ?warnings)
            (vl-lex-main-exec echars breakp nrev st warnings)))
        (vl-warninglist-p warnings))
      :rule-classes :rewrite)