Giter VIP home page Giter VIP logo

Comments (6)

kel85uk avatar kel85uk commented on June 12, 2024

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.

quantumkoen avatar quantumkoen commented on June 12, 2024

@Nader-Khammassi can you confirm the above? Can the spec paper be updated?

from libqasm.

kel85uk avatar kel85uk commented on June 12, 2024

Check the qasm test file example3.qasm for the updated example?

from libqasm.

quantumkoen avatar quantumkoen commented on June 12, 2024

@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.

kel85uk avatar kel85uk commented on June 12, 2024

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.

jvanstraten avatar jvanstraten commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.