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(); 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)? ;