• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
          • Vl-loadstate
          • Parser
            • Parse-expressions
            • Parse-udps
            • Vl-genelements
            • Parse-paramdecls
            • Parse-blockitems
            • Parse-utils
            • Parse-insts
            • Parse-datatype
            • Parse-functions
            • Parse-datatypes
            • Parse-strengths
            • Vl-parse-genvar-declaration
            • Vl-parse
            • Parse-ports
              • Parse-port-types
              • Sv-ansi-portdecls
              • Creating-portdecls/vardecls
              • Sv-non-ansi-portdecls
              • Verilog-2005-ports
              • Sv-ansi-port-interpretation
              • Verilog-2005-portdecls
                • Vl-parse-basic-port-declaration-tail
                • Vl-parse-port-declaration-noatts-2005
                • Vl-parse-port-declaration-atts-2005
                • Vl-parse-1+-port-declarations-separated-by-commas-2005
                • Vl-parse-1+-identifiers-separated-by-commas
                  • Vl-parse-port-declaration-noatts
                  • Vl-parse-module-port-list-top-2005
                  • Vl-parse-output-reg-port-tail
              • Seq
              • Parse-packages
            • 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
    • Verilog-2005-portdecls

    Vl-parse-1+-identifiers-separated-by-commas

    Matches identifier { ',' identifier }

    Signature
    (vl-parse-1+-identifiers-separated-by-commas 
         &key (tokstream 'tokstream) 
         (config 'config)) 
     
      → 
    (mv errmsg? value new-tokstream)
    Arguments
    config — Guard (vl-loadconfig-p config).

    We have to take extra care here, because we can have situations like

    input [7:0] a, b, output c

    in list_of_port_declarations. In this case, note that the comma following b is not really part of the identifier list. Because of this, we can't just assume that because we've seen a comma, "the comma belongs to us and must be followed by another identifier." Instead, we have to look for the comma and the subsequent identifier.

    Definitions and Theorems

    Function: vl-parse-1+-identifiers-separated-by-commas-fn

    (defun vl-parse-1+-identifiers-separated-by-commas-fn
           (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-1+-identifiers-separated-by-commas))
      (declare (ignorable __function__))
      (seq
          tokstream
          (first := (vl-match-token :vl-idtoken))
          (when (and (vl-is-token? :vl-comma)
                     (vl-lookahead-is-token?
                          :vl-idtoken (cdr (vl-tokstream->tokens))))
                (:= (vl-match))
                (rest := (vl-parse-1+-identifiers-separated-by-commas)))
          (return (cons first rest)))))

    Theorem: vl-parse-1+-identifiers-separated-by-commas-fails-gracefully

    (defthm vl-parse-1+-identifiers-separated-by-commas-fails-gracefully
     (implies
          (mv-nth 0
                  (vl-parse-1+-identifiers-separated-by-commas))
          (not (mv-nth 1
                       (vl-parse-1+-identifiers-separated-by-commas)))))

    Theorem: vl-warning-p-of-vl-parse-1+-identifiers-separated-by-commas

    (defthm vl-warning-p-of-vl-parse-1+-identifiers-separated-by-commas
      (iff (vl-warning-p
                (mv-nth 0
                        (vl-parse-1+-identifiers-separated-by-commas)))
           (mv-nth 0
                   (vl-parse-1+-identifiers-separated-by-commas))))

    Theorem: vl-parse-1+-identifiers-separated-by-commas-result

    (defthm vl-parse-1+-identifiers-separated-by-commas-result
     (implies
          (and t)
          (vl-idtoken-list-p
               (mv-nth 1
                       (vl-parse-1+-identifiers-separated-by-commas)))))

    Theorem: vl-parse-1+-identifiers-separated-by-commas-true-listp

    (defthm vl-parse-1+-identifiers-separated-by-commas-true-listp
     (true-listp (mv-nth 1
                         (vl-parse-1+-identifiers-separated-by-commas)))
     :rule-classes :type-prescription)

    Theorem: vl-parse-1+-identifiers-separated-by-commas-count-strong

    (defthm vl-parse-1+-identifiers-separated-by-commas-count-strong
     (and
      (<= (vl-tokstream-measure
               :tokstream
               (mv-nth 2
                       (vl-parse-1+-identifiers-separated-by-commas)))
          (vl-tokstream-measure))
      (implies
         (not (mv-nth 0
                      (vl-parse-1+-identifiers-separated-by-commas)))
         (< (vl-tokstream-measure
                 :tokstream
                 (mv-nth 2
                         (vl-parse-1+-identifiers-separated-by-commas)))
            (vl-tokstream-measure))))
     :rule-classes ((:rewrite) (:linear)))