Parser for Verilog-2005
The Verilog-2005 grammar distinguishes between
hierarchial_net_identifier ::= hierarchial_identifier,
and also account for our treatment of a
net_lvalue ::= hierarchial_identifier [ { '[' expression ']' '[' range_expression ']' } ] | '{' net_lvalue { ',' net_lvalue } '}' variable_lvalue ::= hierarchial_identifier [ { '[' expression ']' '[' range_expression ']' } ] | '{' variable_lvalue { ',' variable_lvalue } '}'
Function:
(defun vl-parse-lvalue-2005-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-lvalue-2005)) (declare (ignorable __function__)) (if (not (vl-is-token? :vl-lcurly)) (vl-parse-indexed-id) (seq tokstream (:= (vl-match-token :vl-lcurly)) (args := (vl-parse-1+-lvalues-separated-by-commas-2005)) (:= (vl-match-token :vl-rcurly)) (return (make-vl-concat :parts args))))))
Function:
(defun vl-parse-1+-lvalues-separated-by-commas-2005-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-1+-lvalues-separated-by-commas-2005)) (declare (ignorable __function__)) (seq tokstream (first :s= (vl-parse-lvalue-2005)) (when (vl-is-token? :vl-comma) (:= (vl-match)) (rest := (vl-parse-1+-lvalues-separated-by-commas-2005))) (return (cons first rest)))))
Theorem:
(defthm count-strong-vl-parse-lvalue-2005 (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-lvalue-2005))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-lvalue-2005))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-lvalue-2005))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm count-strong-vl-parse-1+-lvalues-separated-by-commas-2005 (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-1+-lvalues-separated-by-commas-2005))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-1+-lvalues-separated-by-commas-2005))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-1+-lvalues-separated-by-commas-2005))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm fails-gracefully-vl-parse-lvalue-2005 (and (implies (mv-nth 0 (vl-parse-lvalue-2005)) (not (mv-nth 1 (vl-parse-lvalue-2005)))) (iff (vl-warning-p (mv-nth 0 (vl-parse-lvalue-2005))) (mv-nth 0 (vl-parse-lvalue-2005)))))
Theorem:
(defthm fails-gracefully-vl-parse-1+-lvalues-separated-by-commas-2005 (and (implies (mv-nth 0 (vl-parse-1+-lvalues-separated-by-commas-2005)) (not (mv-nth 1 (vl-parse-1+-lvalues-separated-by-commas-2005)))) (iff (vl-warning-p (mv-nth 0 (vl-parse-1+-lvalues-separated-by-commas-2005))) (mv-nth 0 (vl-parse-1+-lvalues-separated-by-commas-2005)))))
Theorem:
(defthm result-vl-parse-lvalue-2005 (equal (vl-expr-p (mv-nth 1 (vl-parse-lvalue-2005))) (not (mv-nth 0 (vl-parse-lvalue-2005)))))
Theorem:
(defthm result-vl-parse-1+-lvalues-separated-by-commas-2005 (vl-exprlist-p (mv-nth 1 (vl-parse-1+-lvalues-separated-by-commas-2005))))
Theorem:
(defthm parse-lvalues-true-listp-vl-parse-lvalue-2005 t :rule-classes nil)
Theorem:
(defthm parse-lvalues-true-listp-vl-parse-1+-lvalues-separated-by-commas-2005 (true-listp (mv-nth 1 (vl-parse-1+-lvalues-separated-by-commas-2005))) :rule-classes :type-prescription)