mirror of
https://github.com/circify/circ.git
synced 2026-01-12 23:28:14 -05:00
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
use circ::front::zsharp::{Inputs, ZSharpFE};
|
|
|
|
use circ::front::Mode;
|
|
use std::path::PathBuf;
|
|
use structopt::StructOpt;
|
|
|
|
#[derive(Debug, StructOpt)]
|
|
#[structopt(name = "circ", about = "CirC: the circuit compiler")]
|
|
struct Options {
|
|
/// Input file
|
|
#[structopt(parse(from_os_str))]
|
|
zsharp_path: PathBuf,
|
|
|
|
/// File with input witness
|
|
#[structopt(short, long, name = "FILE", parse(from_os_str))]
|
|
inputs: Option<PathBuf>,
|
|
|
|
/// Number of parties for an MPC. If missing, generates a proof circuit.
|
|
#[structopt(short, long, name = "PARTIES")]
|
|
parties: Option<u8>,
|
|
|
|
/// Whether to maximize the output
|
|
#[structopt(short, long)]
|
|
maximize: bool,
|
|
}
|
|
|
|
fn main() {
|
|
env_logger::Builder::from_default_env()
|
|
.format_level(false)
|
|
.format_timestamp(None)
|
|
.init();
|
|
let options = Options::from_args();
|
|
//println!("{:?}", options);
|
|
let mode = if options.maximize {
|
|
Mode::Opt
|
|
} else {
|
|
match options.parties {
|
|
Some(p) => Mode::Mpc(p),
|
|
None => Mode::Proof,
|
|
}
|
|
};
|
|
let inputs = Inputs {
|
|
file: options.zsharp_path,
|
|
inputs: options.inputs,
|
|
mode,
|
|
};
|
|
let cs = ZSharpFE::interpret(inputs);
|
|
cs.pretty(&mut std::io::stdout().lock())
|
|
.expect("error pretty-printing value");
|
|
println!();
|
|
}
|