5
5
6
6
(in-package # :cl-quil.frontend)
7
7
8
- (defvar *standard-post-process -transforms*
9
- ' (validate-defgate-loops expand-circuits type-check simplify-individual-instructions )
10
- " The standard transforms that are applied by PARSE-QUIL. " )
8
+ (defvar *standard-post-parsing -transforms*
9
+ ' (validate-defgate-loops expand-circuits type-check)
10
+ " The standard transforms that are applied by PARSE-QUIL after parsing. (See also: *STANDARD-PRE-COMPILATION-TRANSFORMS*) " )
11
11
12
12
(define-condition ambiguous-definition-condition ()
13
13
((instruction :initarg :instruction
@@ -118,8 +118,9 @@ This also signals ambiguous definitions, which may be handled as needed."
118
118
2. PARSER-EXTENSIONS is a list of parser functions which PARSE-PROGRAM-LINES may dispatch to.
119
119
3. LEXER-EXTENSIONS is a list of lexer functions which LINE-LEXER may dispatch to."
120
120
(handler-bind
121
- ; ; We disallow multiple declarations of the same memory region (even if equivalent).
122
- ; ; Otherwise, for gate or circuit definitions, the default choice is to "accept the mystery."
121
+ ; ; We disallow multiple declarations of the same memory region
122
+ ; ; (even if equivalent). Otherwise, for gate or circuit
123
+ ; ; definitions, the default choice is to "accept the mystery."
123
124
((ambiguous-definition-condition (a :disjoin
124
125
#' error-on-ambiguous-memory-declaration
125
126
ambiguous-definition-handler)))
@@ -163,7 +164,7 @@ This also signals ambiguous definitions, which may be handled as needed."
163
164
(return nil )))))))
164
165
165
166
(defun parse (string &key originating-file
166
- (transforms *standard-post-process -transforms* )
167
+ (transforms *standard-post-parsing -transforms* )
167
168
(ambiguous-definition-handler #' continue ))
168
169
" Parse the input STRING which can be either Quil or OpenQASM code."
169
170
(if (%check-for-qasm-header string )
@@ -174,7 +175,7 @@ This also signals ambiguous definitions, which may be handled as needed."
174
175
:ambiguous-definition-handler ambiguous-definition-handler)))
175
176
176
177
(defun parse-quil (string &key originating-file
177
- (transforms *standard-post-process -transforms* )
178
+ (transforms *standard-post-parsing -transforms* )
178
179
(ambiguous-definition-handler #' continue ))
179
180
" Parse and process the Quil string STRING, which originated from the file ORIGINATING-FILE. Transforms in TRANSFORMS are applied in-order to the processed Quil string.
180
181
@@ -263,7 +264,7 @@ In the presence of multiple definitions with a common signature, a signal is rai
263
264
(read-it filename)))))
264
265
265
266
(defun safely-parse-quil (string &key originating-file
266
- (transforms *standard-post-process -transforms* )
267
+ (transforms *standard-post-parsing -transforms* )
267
268
(ambiguous-definition-handler #' continue ))
268
269
" Safely parse a Quil string STRING."
269
270
(flet ((parse-it (string )
0 commit comments