pub fn clifft_to_stim_text(text: &str) -> StringExpand description
Rewrite Clifft circuit text so Stim can parse it.
Two changes, both forced by Stim’s grammar: T/T_DAG become
S[HONEST_T]/S_DAG[HONEST_T], and EXP_VAL lines are dropped
entirely — they are a Clifft-only probe instruction with no Stim
equivalent, so there is nothing to translate them into. That makes the
conversion lossy in exactly one way; stim_to_clifft_text recovers the
gates but not the probes.
Only a gate that opens a line (after indentation) and is followed by its
target list is rewritten, so an already-tagged or otherwise decorated T
is left alone rather than silently re-spelled.
§Examples
let clifft = "H 0\nREPEAT 2 {\n T_DAG 1\n}\nEXP_VAL X0*Z1\n";
assert_eq!(
clifft_to_stim_text(clifft),
"H 0\nREPEAT 2 {\n S_DAG[HONEST_T] 1\n}\n",
);