Created
August 16, 2019 23:08
-
-
Save adamisntdead/eba7f5e64c28b1c53e35d8324870f926 to your computer and use it in GitHub Desktop.
QASM Grammar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following is an implementation of OpenQASM | |
// using a recursive descent style parser. | |
// MainProgram := "OPENQASM" Real ";" Program | |
// Program ::= Statement | Program Statement | |
// Statement ::= Decl | |
// | GateDecl GeoList "}" | |
// | GateDecl "}" | |
// | "opaque" Id Idlist ";" | |
// | "opaque" Id "()" IdList ";" | |
// | "opaque" Id "(" IdList ")" IdList ";" | |
// | Qop | |
// | "if" "(" Id "==" Integer ")" Qop | |
// | "barrier" AnyList ";" | |
// Decl ::= "qreg" Id "[" Integer "]" ";" | "creg" Id "[" Integer "]" ";" | |
// GateDecl ::= "gate" Id IdList "{" | "gate" Id "()" IdList "{" | "gate" Id "(" IdList ")" Idlist "{" | |
// GopList ::= Uop | "barrier" IdList ";" | GopList Uop | GopList "barrier" IdList ";" | |
// Qop ::= Uop | "measure" Argument "->" Argument ";" | "reset" Argument ";" | |
// Uop ::= "U" "(" ExpList ")" Argument ";" | "CX" Argument "," Argument ";" | Id AnyList ";" | Id "()" AnyList ";" | Id "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment