Chol Park
Chol Park

Reputation: 21

Circom: Syntax Error When Compiling Simple Circuit (Expecting 'EOF', 'function', 'IDENTIFIER')

I am following this Circom tutorial to compile a simple circuit. Here is my code:

pragma circom 2.0.0;

template Multiplier2() {
 signal input a;
 signal input b;
 signal output c; 
 c <== a*b;
}

component main = Multiplier2();

When I try to compile this using the following command:

circom multiplier2.circom --r1cs --wasm --sym --c

I get the following error:

Error Message:Error: Parse error on line 1:pragma circom 2.0.0;template Mult---------------^Expecting 'EOF', 'function', 'IDENTIFIER', '(', ')', 'template', ',', 'if', 'else', 'for', ';', 'while', 'do', 'compute', 'return', 'include', '{', '}', '==>', '-->', '===', '?', ':', '||', '&&', '|', '^', '&', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '+', '-', '*', '/', '\', '%', '**', '++', '--', '!', '~', 'DECNUMBER', 'HEXNUMBER', 'var', 'signal', 'component', '[', ']', got '.'

I also found this article which mentions that Circom doesn't like multiline comments. However, my code doesn't have any comments.

I've double-checked the syntax and everything seems correct, but the error persists. Can anyone help me identify what I'm missing?

Upvotes: 1

Views: 324

Answers (2)

shiqian li
shiqian li

Reputation: 1

I had the same problem and my solution is as follows: 1, remove the original installation of circom (previous installation of circom via command: npm install --save circom snarkjs) 2, Reinstall using the method in this link (https://docs.circom.io/getting-started/writing-circuits/) I've written my own blog post on this issue (https://blog.csdn.net/qq_45059937/article/details/140844302?spm=1001.2014.3001.5502), so I hope this helps!

Upvotes: 0

jake b.
jake b.

Reputation: 11

Remove the first line. This worked for me.

Upvotes: 1

Related Questions