mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-07 11:16:42 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25759e53cd | ||
|
|
4fa0c79e26 | ||
|
|
e685392523 |
@@ -1,4 +1,4 @@
|
|||||||
# Circon
|
# Circom
|
||||||
|
|
||||||
Circon is a language designed to write arithmetic circuits that can be used in zero knowledge proofs.
|
Circon is a language designed to write arithmetic circuits that can be used in zero knowledge proofs.
|
||||||
|
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.12",
|
"version": "0.0.13",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.12",
|
"version": "0.0.13",
|
||||||
"description": "Language to generate logic circuits",
|
"description": "Language to generate logic circuits",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module.exports = compile;
|
|||||||
|
|
||||||
const parser = require("../parser/jaz.js").parser;
|
const parser = require("../parser/jaz.js").parser;
|
||||||
|
|
||||||
const timeout = ms => new Promise(res => setTimeout(res, ms))
|
const timeout = ms => new Promise(res => setTimeout(res, ms));
|
||||||
|
|
||||||
async function compile(srcFile) {
|
async function compile(srcFile) {
|
||||||
const fullFileName = srcFile;
|
const fullFileName = srcFile;
|
||||||
|
|||||||
@@ -578,10 +578,12 @@ function execIf(ctx, ast) {
|
|||||||
exec(ctx, ast.then);
|
exec(ctx, ast.then);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
} else {
|
} else {
|
||||||
|
if (ast.else) {
|
||||||
exec(ctx, ast.else);
|
exec(ctx, ast.else);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function execVarAssignement(ctx, ast) {
|
function execVarAssignement(ctx, ast) {
|
||||||
|
|||||||
@@ -246,9 +246,13 @@ function genIf(ctx, ast) {
|
|||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
const thenBody = gen(ctx, ast.then);
|
const thenBody = gen(ctx, ast.then);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
|
if (ast.else) {
|
||||||
const elseBody = gen(ctx, ast.else);
|
const elseBody = gen(ctx, ast.else);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
return `if (${condition}) {\n${thenBody}\n} else {\n${elseBody}\n}\n`;
|
return `if (${condition}) {\n${thenBody}\n} else {\n${elseBody}\n}\n`;
|
||||||
|
} else {
|
||||||
|
return `if (${condition}) {\n${thenBody}\n}\n`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user