You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a parser implementation in quil-rust, it struck me that the INT alternative of the right-hand operand in a logical binary operation could possibly be further specified & wanted to get some thoughts. For reference:
logicalBinaryOp : ( AND | OR | IOR | XOR ) addr ( addr | INT ) ;
// ...INT : [0-9]+ ;
Is it reasonable to introduce a BIT definition which would reduce the range of values to 1 or 0? @kalzoo mentioned we can (maybe already do?) coerce an INT when needed so maybe this isn't necessary.
Is there a case for parsing an expression in this position?
The text was updated successfully, but these errors were encountered:
The original reason for not allowing INTEGER values there is because different implementations of Quil might represent integers in different ways. For example, different schemes for signed fixed-precision numbers. I didn't want to require any specific width or bit-layout to integers.
There is a way in Quil to allow for this implementation-dependent behavior though; it's to use octet aliasing. Assuming INTEGER values are 16-bit unsigned integers, one could do:
DECLARE xs OCTET[2]
DECLARE ys OCTET[2]
DECLARE x INTEGER SHARING xs
DECLARE y INTEGER SHARING ys
AND xs[0] xs[0] ys[0]
AND xs[1] xs[1] ys[1]
While working on a parser implementation in
quil-rust
, it struck me that theINT
alternative of the right-hand operand in a logical binary operation could possibly be further specified & wanted to get some thoughts. For reference:BIT
definition which would reduce the range of values to1
or0
? @kalzoo mentioned we can (maybe already do?) coerce anINT
when needed so maybe this isn't necessary.The text was updated successfully, but these errors were encountered: