Skip to content

Commit 55ce258

Browse files
orpuente-MSidavis
andcommitted
Rename qsc_qasm3 to qsc_qasm (#2307)
Rename `qsc_qasm3` to `qsc_qasm`. --------- Co-authored-by: Ian Davis <[email protected]>
1 parent 6f6810d commit 55ce258

File tree

212 files changed

+330
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+330
-333
lines changed

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
matrix:
3535
os: [ubuntu-latest] # Fuzzing is not supported on Win. The macos is temporarily removed
3636
# because of low availability.
37-
target_name: [qsharp, qasm3]
37+
target_name: [qsharp, qasm]
3838

3939
runs-on: ${{ matrix.os }}
4040
permissions:

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ members = [
1818
"compiler/qsc_partial_eval",
1919
"compiler/qsc_passes",
2020
"compiler/qsc_project",
21-
"compiler/qsc_qasm3",
21+
"compiler/qsc_qasm",
2222
"compiler/qsc_rir",
2323
"fuzz",
2424
"katas",

compiler/qsc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ qsc_passes = { path = "../qsc_passes" }
3131
qsc_parse = { path = "../qsc_parse" }
3232
qsc_partial_eval = { path = "../qsc_partial_eval" }
3333
qsc_project = { path = "../qsc_project", features = ["fs"] }
34-
qsc_qasm3 = { path = "../qsc_qasm3", features = ["fs"] }
34+
qsc_qasm = { path = "../qsc_qasm", features = ["fs"] }
3535
qsc_rca = { path = "../qsc_rca" }
3636
qsc_circuit = { path = "../qsc_circuit" }
3737
rustc-hash = { workspace = true }

compiler/qsc/src/qasm.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33

44
use std::path::Path;
55

6-
use qsc_qasm3::io::SourceResolver;
7-
pub use qsc_qasm3::CompilerConfig;
8-
pub use qsc_qasm3::OperationSignature;
9-
pub use qsc_qasm3::OutputSemantics;
10-
pub use qsc_qasm3::ProgramType;
11-
pub use qsc_qasm3::QasmCompileUnit;
12-
pub use qsc_qasm3::QubitSemantics;
6+
use qsc_qasm::io::SourceResolver;
7+
pub use qsc_qasm::{
8+
CompilerConfig, OperationSignature, OutputSemantics, ProgramType, QasmCompileUnit,
9+
QubitSemantics,
10+
};
1311
pub mod io {
14-
pub use qsc_qasm3::io::*;
12+
pub use qsc_qasm::io::*;
1513
}
1614
pub mod parser {
17-
pub use qsc_qasm3::parser::*;
15+
pub use qsc_qasm::parser::*;
1816
}
1917
pub mod error {
20-
pub use qsc_qasm3::Error;
21-
pub use qsc_qasm3::ErrorKind;
18+
pub use qsc_qasm::Error;
19+
pub use qsc_qasm::ErrorKind;
2220
}
2321
pub mod completion {
24-
pub use qsc_qasm3::parser::completion::*;
22+
pub use qsc_qasm::parser::completion::*;
2523
}
26-
pub use qsc_qasm3::compile_to_qsharp_ast_with_config;
27-
pub use qsc_qasm3::package_store_with_qasm;
24+
pub use qsc_qasm::compile_to_qsharp_ast_with_config;
25+
pub use qsc_qasm::package_store_with_qasm;
2826

2927
#[must_use]
3028
pub fn parse_raw_qasm_as_fragments<S, P, R>(

compiler/qsc_qasm3/Cargo.toml renamed to compiler/qsc_qasm/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "qsc_qasm3"
2+
name = "qsc_qasm"
33
authors.workspace = true
44
homepage.workspace = true
55
repository.workspace = true
@@ -32,7 +32,7 @@ miette = { workspace = true, features = ["fancy"] }
3232
# Self import adding fs feature so that we can test
3333
# loading qasm from file.
3434
qsc = { path = "../qsc" }
35-
qsc_qasm3 = { path = ".", features = ["fs"] }
35+
qsc_qasm = { path = ".", features = ["fs"] }
3636
qsc_codegen = { path = "../qsc_codegen" }
3737

3838
[features]

compiler/qsc_qasm3/README.md renamed to compiler/qsc_qasm/README.md

Lines changed: 2 additions & 2 deletions

compiler/qsc_qasm3/benches/rgqft_multiplier.rs renamed to compiler/qsc_qasm/benches/rgqft_multiplier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
use criterion::{black_box, criterion_group, criterion_main, Criterion};
5-
use qsc_qasm3::{
5+
use qsc_qasm::{
66
compile_to_qsharp_ast_with_config, io::InMemorySourceResolver, CompilerConfig, OutputSemantics,
77
ProgramType, QasmCompileUnit, QubitSemantics,
88
};

compiler/qsc_qasm3/src/compiler.rs renamed to compiler/qsc_qasm/src/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ impl QasmCompiler {
693693
.filter_map(|annotation| self.compile_annotation(annotation));
694694

695695
// We use the same primitives used for declaring gates, because def declarations
696-
// in QASM3 can take qubits as arguments and call quantum gates.
696+
// in QASM can take qubits as arguments and call quantum gates.
697697
Some(build_function_or_operation(
698698
name,
699699
cargs,

compiler/qsc_qasm3/src/compiler/error.rs renamed to compiler/qsc_qasm/src/compiler/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ pub struct Error(pub CompilerErrorKind);
1515
#[derive(Clone, Debug, Diagnostic, Eq, Error, PartialEq)]
1616
pub enum CompilerErrorKind {
1717
#[error("annotations only valid on def and gate statements")]
18-
#[diagnostic(code("Qsc.Qasm3.Compiler.InvalidAnnotationTarget"))]
18+
#[diagnostic(code("Qasm.Compiler.InvalidAnnotationTarget"))]
1919
InvalidAnnotationTarget(#[label] Span),
2020
#[error("gate expects {0} qubit arguments, but {1} were provided")]
21-
#[diagnostic(code("Qsc.Qasm3.Compiler.InvalidNumberOfQubitArgs"))]
21+
#[diagnostic(code("Qasm.Compiler.InvalidNumberOfQubitArgs"))]
2222
InvalidNumberOfQubitArgs(usize, usize, #[label] Span),
2323
#[error("{0} are not supported")]
24-
#[diagnostic(code("Qsc.Qasm3.Compiler.NotSupported"))]
24+
#[diagnostic(code("Qasm.Compiler.NotSupported"))]
2525
NotSupported(String, #[label] Span),
2626
#[error("Qiskit circuits must have output registers")]
27-
#[diagnostic(code("Qsc.Qasm3.Compiler.QiskitEntryPointMissingOutput"))]
27+
#[diagnostic(code("Qasm.Compiler.QiskitEntryPointMissingOutput"))]
2828
QiskitEntryPointMissingOutput(#[label] Span),
2929
#[error("unexpected annotation: {0}")]
30-
#[diagnostic(code("Qsc.Qasm3.Compiler.UnknownAnnotation"))]
30+
#[diagnostic(code("Qasm.Compiler.UnknownAnnotation"))]
3131
UnknownAnnotation(String, #[label] Span),
3232
#[error("this statement is not yet handled during OpenQASM 3 import: {0}")]
33-
#[diagnostic(code("Qsc.Qasm3.Compiler.Unimplemented"))]
33+
#[diagnostic(code("Qasm.Compiler.Unimplemented"))]
3434
Unimplemented(String, #[label] Span),
3535
}
3636

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

compiler/qsc_qasm3/src/lex/cooked.rs renamed to compiler/qsc_qasm/src/lex/cooked.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ pub(crate) struct Token {
3838
#[derive(Clone, Copy, Debug, Diagnostic, Eq, Error, PartialEq)]
3939
pub enum Error {
4040
#[error("expected {0} to complete {1}, found {2}")]
41-
#[diagnostic(code("Qasm3.Lex.Incomplete"))]
41+
#[diagnostic(code("Qasm.Lex.Incomplete"))]
4242
Incomplete(raw::TokenKind, TokenKind, raw::TokenKind, #[label] Span),
4343

4444
#[error("expected {0} to complete {1}, found EOF")]
45-
#[diagnostic(code("Qasm3.Lex.IncompleteEof"))]
45+
#[diagnostic(code("Qasm.Lex.IncompleteEof"))]
4646
IncompleteEof(raw::TokenKind, TokenKind, #[label] Span),
4747

4848
#[error("unterminated string literal")]
49-
#[diagnostic(code("Qasm3.Lex.UnterminatedString"))]
49+
#[diagnostic(code("Qasm.Lex.UnterminatedString"))]
5050
UnterminatedString(#[label] Span),
5151

5252
#[error("string literal with an invalid escape sequence")]
53-
#[diagnostic(code("Qasm3.Lex.InvalidEscapeSequence"))]
53+
#[diagnostic(code("Qasm.Lex.InvalidEscapeSequence"))]
5454
InvalidEscapeSequence(#[label] Span),
5555

5656
#[error("unrecognized character `{0}`")]
57-
#[diagnostic(code("Qasm3.Lex.UnknownChar"))]
57+
#[diagnostic(code("Qasm.Lex.UnknownChar"))]
5858
Unknown(char, #[label] Span),
5959
}
6060

File renamed without changes.

compiler/qsc_qasm3/src/lib.rs renamed to compiler/qsc_qasm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl CompilerConfig {
127127
fn namespace(&self) -> Arc<str> {
128128
self.namespace
129129
.clone()
130-
.unwrap_or_else(|| Arc::from("qasm3_import"))
130+
.unwrap_or_else(|| Arc::from("qasm_import"))
131131
}
132132
}
133133

File renamed without changes.

compiler/qsc_qasm3/src/parser/error.rs renamed to compiler/qsc_qasm/src/parser/error.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,55 +87,55 @@ pub enum ErrorKind {
8787
#[diagnostic(transparent)]
8888
Lex(lex::Error),
8989
#[error("invalid {0} literal")]
90-
#[diagnostic(code("Qasm3.Parse.Literal"))]
90+
#[diagnostic(code("Qasm.Parse.Literal"))]
9191
Lit(&'static str, #[label] Span),
9292
#[error("unknown escape sequence: `{0}`")]
93-
#[diagnostic(code("Qasm3.Parse.Escape"))]
93+
#[diagnostic(code("Qasm.Parse.Escape"))]
9494
Escape(char, #[label] Span),
9595
#[error("expected {0}, found {1}")]
96-
#[diagnostic(code("Qasm3.Parse.Token"))]
96+
#[diagnostic(code("Qasm.Parse.Token"))]
9797
Token(TokenKind, TokenKind, #[label] Span),
9898
#[error("Empty statements are not supported")]
99-
#[diagnostic(code("Qasm3.Parse.EmptyStatement"))]
99+
#[diagnostic(code("Qasm.Parse.EmptyStatement"))]
100100
EmptyStatement(#[label] Span),
101101
#[error("Annotation missing target statement.")]
102-
#[diagnostic(code("Qasm3.Parse.FloatingAnnotation"))]
102+
#[diagnostic(code("Qasm.Parse.FloatingAnnotation"))]
103103
FloatingAnnotation(#[label] Span),
104104
#[error("expected {0}, found {1}")]
105-
#[diagnostic(code("Qasm3.Parse.Rule"))]
105+
#[diagnostic(code("Qasm.Parse.Rule"))]
106106
Rule(&'static str, TokenKind, #[label] Span),
107107
#[error("expected {0}, found {1}")]
108-
#[diagnostic(code("Qasm3.Parse.Convert"))]
108+
#[diagnostic(code("Qasm.Parse.Convert"))]
109109
Convert(&'static str, &'static str, #[label] Span),
110110
#[error("expected statement to end with a semicolon")]
111-
#[diagnostic(code("Qasm3.Parse.MissingSemi"))]
111+
#[diagnostic(code("Qasm.Parse.MissingSemi"))]
112112
MissingSemi(#[label] Span),
113113
#[error("expected inputs to be parenthesized")]
114-
#[diagnostic(code("Qasm3.Parse.MissingParens"))]
114+
#[diagnostic(code("Qasm.Parse.MissingParens"))]
115115
MissingParens(#[label] Span),
116116
#[error("missing entry in sequence")]
117-
#[diagnostic(code("Qasm3.Parse.MissingSeqEntry"))]
117+
#[diagnostic(code("Qasm.Parse.MissingSeqEntry"))]
118118
MissingSeqEntry(#[label] Span),
119119
#[error("missing switch statement cases")]
120-
#[diagnostic(code("Qasm3.Parse.MissingSwitchCases"))]
120+
#[diagnostic(code("Qasm.Parse.MissingSwitchCases"))]
121121
MissingSwitchCases(#[label] Span),
122122
#[error("missing switch statement case labels")]
123-
#[diagnostic(code("Qasm3.Parse.MissingSwitchCaseLabels"))]
123+
#[diagnostic(code("Qasm.Parse.MissingSwitchCaseLabels"))]
124124
MissingSwitchCaseLabels(#[label] Span),
125125
#[error("missing gate call operands")]
126-
#[diagnostic(code("Qasm3.Parse.MissingGateCallOperands"))]
126+
#[diagnostic(code("Qasm.Parse.MissingGateCallOperands"))]
127127
MissingGateCallOperands(#[label] Span),
128128
#[error("expected an item or closing brace, found {0}")]
129-
#[diagnostic(code("Qasm3.Parse.ExpectedItem"))]
129+
#[diagnostic(code("Qasm.Parse.ExpectedItem"))]
130130
ExpectedItem(TokenKind, #[label] Span),
131131
#[error("gphase gate requires exactly one angle")]
132-
#[diagnostic(code("Qasm3.Parse.GPhaseInvalidArguments"))]
132+
#[diagnostic(code("Qasm.Parse.GPhaseInvalidArguments"))]
133133
GPhaseInvalidArguments(#[label] Span),
134134
#[error("invalid gate call designator")]
135-
#[diagnostic(code("Qasm3.Parse.InvalidGateCallDesignator"))]
135+
#[diagnostic(code("Qasm.Parse.InvalidGateCallDesignator"))]
136136
InvalidGateCallDesignator(#[label] Span),
137137
#[error("multiple index operators are only allowed in assignments")]
138-
#[diagnostic(code("Qasm3.Parse.MultipleIndexOperators"))]
138+
#[diagnostic(code("Qasm.Parse.MultipleIndexOperators"))]
139139
MultipleIndexOperators(#[label] Span),
140140
#[error(transparent)]
141141
#[diagnostic(transparent)]

compiler/qsc_qasm3/src/semantic/const_eval.rs renamed to compiler/qsc_qasm/src/semantic/const_eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ use thiserror::Error;
2525
#[derive(Clone, Debug, Diagnostic, Eq, Error, PartialEq)]
2626
pub enum ConstEvalError {
2727
#[error("expression must be const")]
28-
#[diagnostic(code("Qsc.Qasm3.Compile.ExprMustBeConst"))]
28+
#[diagnostic(code("Qasm.Compile.ExprMustBeConst"))]
2929
ExprMustBeConst(#[label] Span),
3030
#[error("uint expression must evaluate to a non-negative value, but it evaluated to {0}")]
31-
#[diagnostic(code("Qsc.Qasm3.Compile.NegativeUIntValue"))]
31+
#[diagnostic(code("Qasm.Compile.NegativeUIntValue"))]
3232
NegativeUIntValue(i64, #[label] Span),
3333
#[error("{0} doesn't fit in {1}")]
34-
#[diagnostic(code("Qsc.Qasm3.Compile.ValueOverflow"))]
34+
#[diagnostic(code("Qasm.Compile.ValueOverflow"))]
3535
ValueOverflow(String, String, #[label] Span),
3636
}
3737

0 commit comments

Comments
 (0)