Skip to content

Commit

Permalink
Merge pull request #3 from distributed-lab/fix/minor
Browse files Browse the repository at this point in the history
Fix log and component multi dimensional array reference
  • Loading branch information
Arvolear authored Oct 10, 2024
2 parents 01da6d3 + d736012 commit 8a3a69b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions data/Example1.circom
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ template nbits(a) {
}
outA <== i;

log("Number: ", 100);
log("Complicated expression: ", 1 + g[d - functionCall2(1)] * 3 + functionCall(1, 2, 3));

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 8a3a69b

Please sign in to comment.