Skip to content

Analog Grammar modification - #120

Open
yhteoh wants to merge 67 commits into
v1.0from
grammar_modification
Open

yhteoh wants to merge 67 commits into
v1.0from
grammar_modification

Conversation

@yhteoh

@yhteoh yhteoh commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator
  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    refactor, feature

  • What is the current behavior? (You can also link to an open issue here)

  • What is the new behavior (if this is a feature change)?

Features

  • Added xor operator ^^
  • Added complex number representation e.g. 1.0r2.0j
  • QuantumRegister, ModeRegister and Extract support arbitrary arguments
  • Qudit support e.g. qreg(2, 3) for qutrit register and %X(0,1,3) for embedding Pauli X in the [0,1] subspace of a qutrit
  • Jump operators support for Evolve
  • Added builtin functions print, len, flatten, round
  • Binary operators take arb. number of operands corresponding
  • ConstantFolding dataflow analysis and rule to apply
  • Added 'commutator', 'acommutator', 'dag' builtin functions
  • Added builtin functions for operators '_pos', '_neg', '_add', '_sub', etc.

Removal

  • Remove special operator for operator addition %+, subtraction %-, multiplication %* and kron %@
    • use the normal +, -, *, @ instead

Fixes

  • Fix DimensionChecker
  • Fix AnalogBoundsChecker
  • Fix TypeChecker
  • Fix operator precedence in grammar
    • indexing > ^ > unary > *,/ > +,- > <,<=,>,>= > == > &&, and > ||, or > ^^, xor
  • Fix associativity of exponential expression to right associativity e.g. 2^3^4 == 2^(3^4)
    • other operations have left associativity e.g. 1-2-3 = (1-2) - 3
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    Major changes to grammar for language

  • Other information:

…cker but it only works for static size of qmode and qreg
…AnalogASTBuilder, Added support for qudits, Refactor BinaryOp to take more than 2 arguments corresponding to repeated application of binary op from left to right
…ecorator to turn a function into analog. Removed deprecated PrintOperator.
…variables should by default be assigned tha top.
@yhteoh
yhteoh force-pushed the grammar_modification branch from 6ef3dc2 to c244c6c Compare October 15, 2026 16:24
@yhteoh
yhteoh force-pushed the grammar_modification branch from f42831e to b9bc467 Compare October 15, 2026 17:14
@yhteoh
yhteoh marked this pull request as ready for review October 16, 2026 17:40
@yhteoh yhteoh changed the title Grammar modification Analog Grammar modification Oct 16, 2026
@yhteoh
yhteoh force-pushed the grammar_modification branch from 93e370f to a594251 Compare October 19, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant