• 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
  • Lexer

Vl-lex

Top level lexing function.

Signature
(vl-lex echars &key warnings config) 
  → 
(mv successp tokens warnings)
Arguments
echars — The extended-characters to tokenize.
    Guard (vl-echarlist-p echars).
warnings — A warnings accumulator to extend with any warnings, which are mainly about overflows or potential incompatibilities ~ involving integer literals.
    Guard (vl-warninglist-p warnings).
config — Options about which keywords and operators to accept, i.e., for implementing different Verilog editions.
    Guard (vl-loadconfig-p config).
Returns
successp — Did we successfully tokenize the input? Note that even on success there may be some warnings.
    Type (booleanp successp).
tokens — The resulting tokens, including any comment or whitespace tokens.
    Type (vl-tokenlist-p tokens), given (force (vl-echarlist-p echars)).
warnings — Extended warnings accumulator.
    Type (vl-warninglist-p warnings).

Definitions and Theorems

Function: vl-lex-fn

(defun vl-lex-fn (echars warnings config)
  (declare (xargs :guard (and (vl-echarlist-p echars)
                              (vl-warninglist-p warnings)
                              (vl-loadconfig-p config))))
  (let ((__function__ 'vl-lex))
    (declare (ignorable __function__))
    (b* ((st (vl-lexstate-init config))
         ((mv okp tokens warnings)
          (vl-lex-main echars st warnings)))
      (mv okp tokens warnings))))

Theorem: booleanp-of-vl-lex.successp

(defthm booleanp-of-vl-lex.successp
  (b* (((mv ?successp ?tokens ?warnings)
        (vl-lex-fn echars warnings config)))
    (booleanp successp))
  :rule-classes :type-prescription)

Theorem: vl-tokenlist-p-of-vl-lex.tokens

(defthm vl-tokenlist-p-of-vl-lex.tokens
  (implies (force (vl-echarlist-p echars))
           (b* (((mv ?successp ?tokens ?warnings)
                 (vl-lex-fn echars warnings config)))
             (vl-tokenlist-p tokens)))
  :rule-classes :rewrite)

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

(defthm vl-warninglist-p-of-vl-lex.warnings
  (b* (((mv ?successp ?tokens ?warnings)
        (vl-lex-fn echars warnings config)))
    (vl-warninglist-p warnings))
  :rule-classes :rewrite)

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

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

Subtopics

Vl-lex-token1
Try to parse a single token at the front of echars.
Vl-lex-plain-alist
Vl-lex-plain
Try to match a particular string literal corresponding to some plain token.
Vl-lex-token
Vl-lex-main
Vl-lex-main-exec
Tail recursive implementation.