mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 18:52:58 +03:00
Clean up
This commit is contained in:
parent
966f4c90ca
commit
8702ad5ccd
@ -1,4 +1,3 @@
|
||||
// file = { SOI ~ NEWLINE* ~ import_section* ~ NEWLINE* ~ EOI }
|
||||
/// Visibility
|
||||
|
||||
visibility_public = { "public" }
|
||||
@ -48,6 +47,7 @@ operation_binary = _ {
|
||||
// operation_div_assign = { "/=" }
|
||||
|
||||
/// Types
|
||||
|
||||
ty_u32 = {"u32"}
|
||||
ty_field = {"fe"}
|
||||
ty_bool = {"bool"}
|
||||
@ -59,6 +59,7 @@ ty = {ty_array | ty_basic | ty_struct}
|
||||
type_list = _{(ty ~ ("," ~ ty)*)?}
|
||||
|
||||
/// Values
|
||||
|
||||
value_number = @{ "-"? ~ ("0" | ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*)}
|
||||
value_u32 = { value_number ~ ty_u32}
|
||||
value_field = { value_number ~ ty_field }
|
||||
@ -81,12 +82,15 @@ expression_primitive = { value | variable }
|
||||
|
||||
from_expression = { expression }
|
||||
to_expression = { expression }
|
||||
|
||||
range = { from_expression? ~ ".." ~ to_expression }
|
||||
range_or_expression = { range | expression }
|
||||
|
||||
access_array = { "[" ~ range_or_expression ~ "]" }
|
||||
access_call = { "(" ~ expression_tuple ~ ")" }
|
||||
access_member = { "." ~ variable }
|
||||
access = { access_array | access_call | access_member }
|
||||
|
||||
expression_postfix = { variable ~ access+ }
|
||||
|
||||
assignee_access = { access_array | access_member }
|
||||
@ -117,7 +121,6 @@ expression_conditional = { "if" ~ expression ~ "then" ~ expression ~ "else" ~ ex
|
||||
|
||||
/// Expressions
|
||||
|
||||
// Consider structs, conditionals, postfix, primary, inline array, array initializer, and unary
|
||||
expression_term = {
|
||||
("(" ~ expression ~ ")")
|
||||
| expression_inline_struct
|
||||
@ -170,6 +173,6 @@ from_import = { "from" ~ "\"" ~ import_source ~ "\"" ~ "import" ~ variable ~ ("a
|
||||
main_import = {"import" ~ "\"" ~ import_source ~ "\"" ~ ("as" ~ variable)? ~ NEWLINE+}
|
||||
import_source = @{(!"\"" ~ ANY)*}
|
||||
|
||||
/// Abstract Syntax Tree File
|
||||
/// Program File
|
||||
|
||||
file = { SOI ~ NEWLINE* ~ import* ~ NEWLINE* ~ struct_definition* ~ NEWLINE* ~ function_definition* ~ NEWLINE* ~ EOI }
|
||||
|
@ -1,14 +1,11 @@
|
||||
extern crate from_pest;
|
||||
extern crate pest;
|
||||
extern crate pest_ast;
|
||||
#[macro_use]
|
||||
extern crate pest_derive;
|
||||
|
||||
extern crate from_pest;
|
||||
// #[macro_use]
|
||||
extern crate pest_ast;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
pub mod ast;
|
||||
|
||||
pub mod program;
|
||||
|
24
src/main.rs
24
src/main.rs
@ -1,25 +1,23 @@
|
||||
use leo::*;
|
||||
|
||||
use snarkos_algorithms::snark::{
|
||||
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
|
||||
};
|
||||
use snarkos_curves::bls12_377::{Bls12_377, Fr};
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::r1cs::{ConstraintSynthesizer, ConstraintSystem}
|
||||
};
|
||||
|
||||
use from_pest::FromPest;
|
||||
use rand::thread_rng;
|
||||
use std::{
|
||||
fs,
|
||||
marker::PhantomData,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use snarkos_curves::bls12_377::{Bls12_377, Fr};
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::{ConstraintSynthesizer, ConstraintSystem};
|
||||
|
||||
use snarkos_algorithms::snark::{
|
||||
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
|
||||
};
|
||||
|
||||
use rand::thread_rng;
|
||||
|
||||
// use std::env;
|
||||
|
||||
pub struct Benchmark<F: Field + PrimeField> {
|
||||
_engine: PhantomData<F>,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use crate::program::{Integer, IntegerExpression, IntegerSpreadOrExpression, Vari
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::ConstraintSystem,
|
||||
utilities::{alloc::AllocGadget, boolean::Boolean, eq::ConditionalEqGadget, uint32::UInt32},
|
||||
utilities::{boolean::Boolean, eq::ConditionalEqGadget, uint32::UInt32},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
|
@ -4,15 +4,15 @@
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
pub mod types;
|
||||
pub use self::types::*;
|
||||
|
||||
pub mod constraints;
|
||||
pub use self::constraints::*;
|
||||
|
||||
pub mod imports;
|
||||
pub use self::imports::*;
|
||||
|
||||
pub mod types;
|
||||
pub use self::types::*;
|
||||
|
||||
pub mod types_display;
|
||||
pub use self::types_display::*;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user