privacy-scaling-explorations / chiquito

DSL for Halo2 circuits
https://docs.pecadorplonkish.xyz/
161 stars 36 forks source link

add missing binary operators to lalrpop and ast #224

Closed rutefig closed 3 months ago

rutefig commented 3 months ago

Added missing logic, arithmetic and bitwise operators to lalrop and ast.

Covers #205 and #216 issues

leolara commented 3 months ago

The circom documentation references the rust documentation about precendence: https://docs.circom.io/circom-language/basic-operators/ https://doc.rust-lang.org/1.22.1/reference/expressions/operator-expr.html#operator-precedence

This does not explain the precedence of **, ~ so we need to investigate which is actually in circom

rutefig commented 3 months ago

The circom documentation references the rust documentation about precendence: https://docs.circom.io/circom-language/basic-operators/ https://doc.rust-lang.org/1.22.1/reference/expressions/operator-expr.html#operator-precedence

This does not explain the precedence of **, ~ so we need to investigate which is actually in circom

Yeah I checked the lalrop file, ~ is a unary operator so it has the same precedence as the rest of unary operators, and pow ** comes before the mul and div group, right after the unary operators.

Regarding the groups I agree it should all be grouped :) gonna do it right away