Comments (6)
AFAIK, this was already discussed with Nader and the example is not supposed to work that way. I suppose it wasn't updated? It breaks the syntax. One must make a numeric list, e.g.
c-x b[0, 1, 4], q[4]
from libqasm.
@Nader-Khammassi can you confirm the above? Can the spec paper be updated?
from libqasm.
Check the qasm test file example3.qasm for the updated example?
from libqasm.
@kel85uk so it turns out users of qx-simulator don't check the libqasm examples to find out what valid syntax is, but rather refer to the cqasm paper (odd, I know :) and assume that what is described there is valid syntax. That is how this bug report came about, someone was looking at the paper and trying things described there, and then got syntax errors.
from libqasm.
It's fine either way. We need to make things consistent though. Perhaps we should just relax the grammar to accept such changes. Need further discussion on this.
from libqasm.
The documentation for cQASM, now here instead of in paper form, documents this behavior of the language. There are more inconsistencies between the paper and the parser implementation, by the way; the test code of the new API includes all the examples in the paper with the behavior as it was prior to the new API (successful parse or parse failure) as well as fixed versions of the examples that failed to parse. Unfortunately the language cannot easily be changed because it could break existing cQASM files, and the paper cannot be changed because it's already on arXiv and I don't have its source files anyway.
I considered c-c-x b[0], b[1], q[4]
for cQASM at one point for clearer syntax than what's there right now. This would be backward compatible and easy to do even in the type-system-based grammar. However, the expressions that have since been added provide a much more flexible way of specifying multiple conditions going forward. It'd look like this:
c-x b[0] && b[1], q[4]
or, using the new conditional syntax,
cond(b[0] && b[1]) x q[4]
Until targets support that however, c-x b[0,1], q[4]
would be the way to go, awkward as it may be.
from libqasm.
Related Issues (20)
- CMake support
- Memory leak in src/library/libQasm.hpp HOT 3
- `test-v1-parsing` fails to run in WSL due to line endings handling HOT 1
- Improve user experience HOT 1
- Exceptions thrown by the parser should include the exact error and line number HOT 1
- B as alias is not parsed HOT 8
- Float parser doesn't recognize `1.`
- Add load_state support
- Including the Location of Errors in the Syntax/Semantic Error Messages HOT 9
- Semantic checker incomplete
- `error_model depolarizing_channel, 0` not parsed
- Write documentation for Windows build HOT 1
- Windows build does not support swig and python module setup HOT 1
- Add custom gate support
- Add support for more than one numerical parameter HOT 1
- Error while installing in the qsim servers HOT 2
- Python usage of libqasm HOT 4
- Mac OS support HOT 1
- clearing state across multiple runs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libqasm.