prism-silq
v1.0.0
Published
Prism.js language plugin for the Silq quantum programming language
Downloads
376
Maintainers
Readme
prism-silq
Prism.js language plugin for Silq — the high-level quantum programming language from ETH Zurich.
Features
- Full syntax highlighting for Silq source code
- Supports all three Silq comment styles (
//,/* */,/+ +/) - Highlights quantum gates (
H,X,Y,Z,measure,reset, ...) - Unicode type characters (
𝟙,𝔹,ℕ,ℤ,ℚ,ℝ) with tooltip descriptions - Type names (
int,uint,qint,quint) and array types (int[5]) - Lambda expressions (
λ/lambda) - Import path highlighting
- Function name detection (
def funcName()
Install
npm install prism-silqUsage
const Prism = require("prismjs");
require("prism-silq");
const code = `
def main() {
x := H(0:𝔹);
y := measure(x);
return y;
}
`;
const html = Prism.highlight(code, Prism.languages.silq, "silq");
console.log(html);Or in the browser:
<script src="prism.js"></script>
<script src="prism-silq.js"></script>
<pre><code class="language-silq">
def main() {
x := H(0:𝔹);
}
</code></pre>A slq alias is also registered, so language-silq and language-slq both work.
License
MIT
