From 34b4bc21cd8bcb7c6ba3d372364c0094201d1fb7 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Sat, 7 Sep 2024 21:29:42 +0300 Subject: [PATCH 1/2] Fixed bug with constraint assignment to parenthesis identifiers --- grammar/Circom.g4 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/grammar/Circom.g4 b/grammar/Circom.g4 index 1de3435..efca039 100644 --- a/grammar/Circom.g4 +++ b/grammar/Circom.g4 @@ -68,8 +68,10 @@ templateStmt | blockInstantiation ';' | (identifier ('.' ID)?) ASSIGNMENT expression ';' | expression CONSTRAINT_EQ expression ';' - | (primary | (identifier '.' identifier)) (LEFT_ASSIGNMENT | ASSIGNMENT_OP) expression ';' - | expression RIGHT_ASSIGNMENT (identifier ('.' identifier)?) ';' + | element (LEFT_ASSIGNMENT | ASSIGNMENT_OP) expression ';' + | '(' element (',' element)* ')' LEFT_ASSIGNMENT expression ';' + | expression RIGHT_ASSIGNMENT element ';' + | expression RIGHT_ASSIGNMENT '(' element (',' element)* ')' ';' | '_' (ASSIGNMENT | LEFT_ASSIGNMENT) (expression | blockInstantiation) ';' | (expression | blockInstantiation) RIGHT_ASSIGNMENT '_' ';' | '(' argsWithUnderscore ')' (ASSIGNMENT | LEFT_ASSIGNMENT) (blockInstantiation | expression) ';' @@ -81,6 +83,8 @@ templateStmt | logStmt ';' ; +element: (identifier ('.' identifier)?) ; + forControl: forInit ';' expression ';' forUpdate ; forInit: 'var'? identifier (ASSIGNMENT rhsValue)? ; From a12dc21ec5023af198697a0d43cc8b230bbff5e9 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Sat, 7 Sep 2024 21:33:51 +0300 Subject: [PATCH 2/2] Added complicated example to the test --- data/Example1.circom | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/Example1.circom b/data/Example1.circom index 97af253..356c22f 100644 --- a/data/Example1.circom +++ b/data/Example1.circom @@ -57,6 +57,9 @@ template nbits(a) { i = out; } outA <== i; + + component commitmentHash = Poseidon(2); + (commitmentHash.inputs[0], commitmentHash.inputs[1]) <== (nullifier, secret); } component main {public [in1]}= A();