Skip to content

Commit

Permalink
Fixed log and component multi dimensional array reference
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrylR committed Oct 10, 2024
1 parent 01da6d3 commit cb5cecc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions data/Example1.circom
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ template nbits(a) {
}
outA <== i;

log("Number: ", 100);

for(var i=0; i<2; i++)for(var idx=0; idx<CHUNK_NUMBER; idx++){
tmp[0][i][idx] <== add.out[i][idx] + addIsDouble * (doub.out[i][idx] - add.out[i][idx]);
// if a = O, then a + b = b
tmp[1][i][idx] <== tmp[0][i][idx] + aIsInfinity * (b[i][idx] - tmp[0][i][idx]);
// if b = O, then a + b = a
tmp[2][i][idx] <== tmp[1][i][idx] + bIsInfinity * (a[i][idx] - tmp[1][i][idx]);
out[i][idx] <== tmp[2][i][idx] + isInfinity * (a[i][idx] - tmp[2][i][idx]);
}

component commitmentHash = Poseidon(2);
(commitmentHash.inputs[0], commitmentHash.inputs[1]) <== (nullifier, secret);
}
Expand Down
4 changes: 2 additions & 2 deletions grammar/Circom.g4
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ primary
;

logStmt
: 'log' '(' (STRING | expression)? ')'
: 'log' '(' ((STRING | expression) (',' (STRING | expression))*)? ')'
;

componentDefinition: 'component' ID ;
Expand Down Expand Up @@ -156,7 +156,7 @@ blockInstantiation: 'parallel'? ID '(' expressionList? ')' componentCall? ;

expressionList: expression (',' expression)* ;

identifier: ID arrayDimension* ;
identifier: (ID | (ID '.' ID)) arrayDimension* ;

arrayDimension: '[' expression ']' ;

Expand Down

0 comments on commit cb5cecc

Please sign in to comment.