Skip to content

Commit

Permalink
Merge pull request #2 from distributed-lab/fix/identifier-assign
Browse files Browse the repository at this point in the history
Fix bug with constraint assignment to parenthesis identifiers
  • Loading branch information
Arvolear authored Sep 8, 2024
2 parents 4724b90 + a12dc21 commit 01da6d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions data/Example1.circom
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions grammar/Circom.g4
Original file line number Diff line number Diff line change
Expand Up @@ -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) ';'
Expand All @@ -81,6 +83,8 @@ templateStmt
| logStmt ';'
;

element: (identifier ('.' identifier)?) ;

forControl: forInit ';' expression ';' forUpdate ;

forInit: 'var'? identifier (ASSIGNMENT rhsValue)? ;
Expand Down

0 comments on commit 01da6d3

Please sign in to comment.