quil-lang / quil

Specification of Quil: A Practical Quantum Instruction Set Architecture
https://quil-lang.github.io/
Apache License 2.0
104 stars 16 forks source link

Allow single-quoted strings for PRAGMA #52

Open notmgsk opened 2 years ago

notmgsk commented 2 years ago

In Quil-T we make use of PRAGMA FILTER-NODE which expects a json-like string object. For example

PRAGMA FILTER-NODE raw "{'key': 'value', ...}"

The problem is, however, single-quoted strings are not valid JSON, so the above would have to be written

PRAGMA FILTER-NODE raw "{\"key\": \"value\", ...}"

which is awkward and error-prone when writing by-hand.

If we supported using single quotes for the pragma freeform string then the above would become

PRAGMA FILTER-NODE raw '{"key": "value", ...}'

@stylewarning WDYT?

stylewarning commented 2 years ago

Discussion from Quil call:

notmgsk commented 2 years ago

can we use """ for docstrings too? 👼🏽

caldwellshane commented 2 years ago

Bumping this issue. We'd also like to write JSON into DEFFRAME HARDWARE-OBJECT and have it look nice. The backslashes are a bit of a bummer in that case.

caldwellshane commented 2 years ago

In fact, would it unreasonable for Quil to have a designator for a JSON string? I feel like we're bumping into genuine contention between Quil and JSON (and potentially other formats) over the " character. Given the description,

HARDWARE-OBJECT is a string indicating the (implementation-specific) hardware object that the frame is associated with.

it seems reasonable to support structured strings describing objects here.