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

    Make-test-tokens

    A simple way to lex an ACL2 string.

    Signature
    (make-test-tokens string &key (config '*vl-default-loadconfig*)) 
      → 
    tokens
    Arguments
    string — Should be free of preprocessor symbols.
        Guard (stringp string).
    config — Guard (vl-loadconfig-p config).
    Returns
    tokens — Type (vl-tokenlist-p tokens).

    This is mainly intended for testing parser routines. We don't bother to preprocess the input and just ignore any warning.

    Definitions and Theorems

    Function: make-test-tokens-fn

    (defun make-test-tokens-fn (string config)
      (declare (xargs :guard (and (stringp string)
                                  (vl-loadconfig-p config))))
      (let ((__function__ 'make-test-tokens))
        (declare (ignorable __function__))
        (b* ((echars (vl-echarlist-from-str string))
             ((mv successp tokens ?warnings)
              (vl-lex echars
                      :config config
                      :warnings nil))
             ((unless successp)
              (raise "Lexing failed."))
             ((mv tokens ?cmap)
              (vl-kill-whitespace-and-comments tokens)))
          tokens)))

    Theorem: vl-tokenlist-p-of-make-test-tokens

    (defthm vl-tokenlist-p-of-make-test-tokens
      (b* ((tokens (make-test-tokens-fn string config)))
        (vl-tokenlist-p tokens))
      :rule-classes :rewrite)