• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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-plain-alist-token/remainder-thms
              • 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-plain-alist

Signature
(vl-lex-plain-alist echars breakp alist warnings) 
  → 
(mv token/nil remainder warnings)
Arguments
echars — Guard (vl-echarlist-p echars).
breakp — Guard (booleanp breakp).
alist — Guard (vl-plaintoken-alistp alist).
warnings — Guard (vl-warninglist-p warnings).
Returns
warnings — Type (vl-warninglist-p warnings).

We walk through the alist, looking for the first string that matches the beginning of echars. If we find one, we build a plaintoken using the matching echars and the corresponding type. Since the alist is searched in order, you can search for long prefixes first, e.g., >>> before >>.

Definitions and Theorems

Function: vl-lex-plain-alist

(defun vl-lex-plain-alist (echars breakp alist warnings)
  (declare (xargs :guard (and (vl-echarlist-p echars)
                              (booleanp breakp)
                              (vl-plaintoken-alistp alist)
                              (vl-warninglist-p warnings))))
  (let ((__function__ 'vl-lex-plain-alist))
    (declare (ignorable __function__))
    (b* (((when (atom alist))
          (mv nil echars (ok)))
         ((mv token remainder warnings)
          (vl-lex-plain echars breakp (caar alist)
                        (cdar alist)
                        warnings))
         ((when token)
          (mv token remainder warnings)))
      (vl-lex-plain-alist echars breakp (cdr alist)
                          warnings))))

Theorem: vl-warninglist-p-of-vl-lex-plain-alist.warnings

(defthm vl-warninglist-p-of-vl-lex-plain-alist.warnings
  (b* (((mv ?token/nil ?remainder ?warnings)
        (vl-lex-plain-alist echars breakp alist warnings)))
    (vl-warninglist-p warnings))
  :rule-classes :rewrite)

Theorem: vl-token-p-of-vl-lex-plain-alist

(defthm vl-token-p-of-vl-lex-plain-alist
 (implies
  (and (force (vl-echarlist-p echars))
       (and (force (vl-plaintoken-alistp alist))
            (force (booleanp breakp))))
  (equal
    (vl-token-p
         (mv-nth 0
                 (vl-lex-plain-alist echars breakp alist warnings)))
    (if (mv-nth 0
                (vl-lex-plain-alist echars breakp alist warnings))
        t
      nil))))

Theorem: true-listp-of-vl-lex-plain-alist

(defthm true-listp-of-vl-lex-plain-alist
 (equal
    (true-listp
         (mv-nth 1
                 (vl-lex-plain-alist echars breakp alist warnings)))
    (true-listp echars))
 :rule-classes
 ((:rewrite)
  (:type-prescription
   :corollary
   (implies
    (true-listp echars)
    (true-listp
     (mv-nth 1
             (vl-lex-plain-alist echars breakp alist warnings)))))))

Theorem: vl-echarlist-p-of-vl-lex-plain-alist

(defthm vl-echarlist-p-of-vl-lex-plain-alist
 (implies
  (force (vl-echarlist-p echars))
  (equal
    (vl-echarlist-p
         (mv-nth 1
                 (vl-lex-plain-alist echars breakp alist warnings)))
    t)))

Theorem: append-of-vl-lex-plain-alist

(defthm append-of-vl-lex-plain-alist
 (implies
  (and (mv-nth 0
               (vl-lex-plain-alist echars breakp alist warnings))
       (force (vl-echarlist-p echars))
       (and (force (vl-plaintoken-alistp alist))
            (force (booleanp breakp))))
  (equal
   (append
    (vl-token->etext
         (mv-nth 0
                 (vl-lex-plain-alist echars breakp alist warnings)))
    (mv-nth 1
            (vl-lex-plain-alist echars breakp alist warnings)))
   echars)))

Theorem: no-change-loser-of-vl-lex-plain-alist

(defthm no-change-loser-of-vl-lex-plain-alist
 (implies
   (not (mv-nth 0
                (vl-lex-plain-alist echars breakp alist warnings)))
   (equal (mv-nth 1
                  (vl-lex-plain-alist echars breakp alist warnings))
          echars)))

Theorem: acl2-count-of-vl-lex-plain-alist-weak

(defthm acl2-count-of-vl-lex-plain-alist-weak
 (<=
    (acl2-count
         (mv-nth 1
                 (vl-lex-plain-alist echars breakp alist warnings)))
    (acl2-count echars))
 :rule-classes ((:rewrite) (:linear)))

Theorem: acl2-count-of-vl-lex-plain-alist-strong

(defthm acl2-count-of-vl-lex-plain-alist-strong
 (implies
  (and (mv-nth 0
               (vl-lex-plain-alist echars breakp alist warnings))
       t)
  (<
    (acl2-count
         (mv-nth 1
                 (vl-lex-plain-alist echars breakp alist warnings)))
    (acl2-count echars)))
 :rule-classes ((:rewrite) (:linear)))

Subtopics

Vl-lex-plain-alist-token/remainder-thms
Token and remainder theorems for vl-lex-plain-alist, automatically generated by def-token/remainder-thms.