19 const std::string &filename,
20 const std::string &api_version
32 const std::string &filename,
33 const std::string &api_version
44 const std::string &data,
45 const std::string &filename,
46 const std::string &api_version
65 std::ostringstream args;
66 for (
int i = 0; i <= 50; i++) {
67 analyzer.register_error_model(
"depolarizing_channel", args.str());
72 analyzer.register_instruction(
"measure_all",
"",
false,
false);
73 analyzer.register_instruction(
"measure_parity",
"QaQa",
false,
false,
false,
true);
74 analyzer.register_instruction(
"x",
"Q");
75 analyzer.register_instruction(
"y",
"Q");
76 analyzer.register_instruction(
"z",
"Q");
77 analyzer.register_instruction(
"i",
"Q");
78 analyzer.register_instruction(
"h",
"Q");
79 analyzer.register_instruction(
"x90",
"Q");
80 analyzer.register_instruction(
"y90",
"Q");
81 analyzer.register_instruction(
"mx90",
"Q");
82 analyzer.register_instruction(
"my90",
"Q");
83 analyzer.register_instruction(
"s",
"Q");
84 analyzer.register_instruction(
"sdag",
"Q");
85 analyzer.register_instruction(
"t",
"Q");
86 analyzer.register_instruction(
"tdag",
"Q");
87 analyzer.register_instruction(
"u",
"Qu");
88 analyzer.register_instruction(
"prep",
"Q",
false);
89 analyzer.register_instruction(
"prep_x",
"Q",
false);
90 analyzer.register_instruction(
"prep_y",
"Q",
false);
91 analyzer.register_instruction(
"prep_z",
"Q",
false);
92 analyzer.register_instruction(
"measure",
"Q",
false);
93 analyzer.register_instruction(
"measure_x",
"Q",
false);
94 analyzer.register_instruction(
"measure_y",
"Q",
false);
95 analyzer.register_instruction(
"measure_z",
"Q",
false);
96 analyzer.register_instruction(
"rx",
"Qr");
97 analyzer.register_instruction(
"ry",
"Qr");
98 analyzer.register_instruction(
"rz",
"Qr");
99 analyzer.register_instruction(
"cnot",
"QQ");
100 analyzer.register_instruction(
"cz",
"QQ");
101 analyzer.register_instruction(
"swap",
"QQ");
102 analyzer.register_instruction(
"cr",
"QQr");
103 analyzer.register_instruction(
"crk",
"QQi");
104 analyzer.register_instruction(
"toffoli",
"QQQ");
105 analyzer.register_instruction(
"not",
"B");
106 analyzer.register_instruction(
"display",
"",
false,
false);
107 analyzer.register_instruction(
"display",
"B",
false,
false);
108 analyzer.register_instruction(
"display_binary",
"",
false,
false);
109 analyzer.register_instruction(
"display_binary",
"B",
false,
false);
110 analyzer.register_instruction(
"skip",
"i",
false,
false);
111 analyzer.register_instruction(
"wait",
"i",
false,
false);
112 analyzer.register_instruction(
"reset-averaging",
"",
false,
false);
113 analyzer.register_instruction(
"reset-averaging",
"Q",
false,
false);
114 analyzer.register_instruction(
"load_state",
"s",
false,
false);
Main class used for analyzing cQASM files.
tree::One< semantic::Program > analyze_string(const std::string &data, const std::string &filename, const std::string &api_version)
Parses and analyzes the given string with the default analyzer, dumping error messages to stderr and ...
analyzer::Analyzer default_analyzer(const std::string &api_version)
Constructs an Analyzer object with the defaults for cQASM 1.0 already loaded into it...
AnalysisResult analyze(const ast::Program &program) const
Analyzes the given program AST node.
Toplevel namespace with entry points for the new API.
tree::One< semantic::Program > analyze(const std::string &filename, const std::string &api_version)
Parses and analyzes the given file with the default analyzer, dumping error messages to stderr and th...
Main include file for parsing v1 files.
Namespace for the "new" cQASM 1.x API.
void register_default_functions_and_mappings()
Registers a number of default functions and mappings, such as the operator functions, the usual trigonometric functions, mappings for pi, eu (aka e, 2.718...), im (imaginary unit) and so on.
::tree::base::One< T > One
AnalysisResult analyze_string(const std::string &data, const std::string &filename="<unknown>") const
Parses and analyzes the given string.
ast::One< semantic::Program > unwrap(std::ostream &out=std::cerr) const
"Unwraps" the result (as you would in Rust) to get the program node or an exception.