Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msoeken/qsharp
Q# for Rust
https://github.com/msoeken/qsharp
Last synced: 2 days ago
JSON representation
Q# for Rust
- Host: GitHub
- URL: https://github.com/msoeken/qsharp
- Owner: msoeken
- License: mit
- Created: 2021-09-21T07:27:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-24T16:25:02.000Z (about 2 years ago)
- Last Synced: 2024-11-08T15:52:00.338Z (about 2 months ago)
- Language: Rust
- Size: 60.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Q# integration in Rust
This is a personal project to experiment with an integration of Q# in Rust. For
stable Q# compilers, see the following:* [Microsoft Quantum Development Kit: Q# Compiler and Language Server](https://github.com/microsoft/qsharp-compiler)
* [Microsoft Quantum Development Kit: IQ# Kernel](https://github.com/microsoft/iqsharp)## Contents
* [qsharp](./qsharp) • Procedural macros to insert Q# code into Rust code
* [qsharp-ast](./qsharp-ast) • Q# parser from Rust token stream
* [qsharp-codegen](./qsharp-codegen) • Rust code generation from Q# AST (*very preliminary*)
* [qsharp-runtime](./qsharp-runtime) • Runtime intrinsics used by Rust code generation (*very preliminary*)## Example
This is a Rust file.
```rust
use qsharp::qsharp;
use qsharp::runtime::*;qsharp! {
namespace QsharpInRust {
use Microsoft.Quantum.Intrinsic;operation Hello() : Unit {
Message("Hello from Rust!");
}
}}
fn main() {
// this can be a custom or pre-defined simulator
let mut sim = Simulator::new();QsharpInRust::Hello(&mut sim);
}
```## Build and test
To build the program run `cargo build` from the repository's root folder and run
`cargo test` to run all the tests.