You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
501 B

package main
import (
"os"
"github.com/urfave/cli"
"github.com/arnaucube/go-snark/circuit"
)
func compile(context *cli.Context) error {
circuitPath := context.Args().Get(0)
// load circuit
circuitFile, err := os.Open(circuitPath)
if err != nil {
return err
}
parser := circuit.NewParser(circuitFile)
// parse circuit
cir, err := parser.Parse()
if err != nil {
return err
}
// flat code to R1CS
cir.GenerateR1CS()
// save circuit
return saveToFile(compiledFileName, cir)
}