pub type TypedProgram = Program<Type>;Expand description
crate::ast::Program after typechecking.
Aliased Type§
pub struct TypedProgram {
pub const_deps: HashMap<String, HashMap<String, (Type, MetaInfo)>>,
pub const_defs: HashMap<String, ConstDef>,
pub struct_defs: HashMap<String, StructDef>,
pub enum_defs: HashMap<String, EnumDef>,
pub fn_defs: HashMap<String, FnDef<Type>>,
}Fields§
§const_deps: HashMap<String, HashMap<String, (Type, MetaInfo)>>The external constants that the top level const definitions depend upon.
const_defs: HashMap<String, ConstDef>Top level const definitions.
struct_defs: HashMap<String, StructDef>Top level struct type definitions.
enum_defs: HashMap<String, EnumDef>Top level enum type definitions.
fn_defs: HashMap<String, FnDef<Type>>Top level function definitions.
Implementations§
Source§impl TypedProgram
impl TypedProgram
Sourcepub fn compile(
&self,
fn_name: &str,
) -> Result<(Circuit, &TypedFnDef), Vec<CompilerError>>
pub fn compile( &self, fn_name: &str, ) -> Result<(Circuit, &TypedFnDef), Vec<CompilerError>>
Compiles the (type-checked) program, producing a circuit of gates.
Assumes that the input program has been correctly type-checked and panics if incompatible types are found that should have been caught by the type-checker.
Sourcepub fn compile_with_constants(
&self,
fn_name: &str,
consts: HashMap<String, HashMap<String, Literal>>,
) -> Result<(Circuit, &'_ TypedFnDef, HashMap<String, usize>), Vec<CompilerError>>
pub fn compile_with_constants( &self, fn_name: &str, consts: HashMap<String, HashMap<String, Literal>>, ) -> Result<(Circuit, &'_ TypedFnDef, HashMap<String, usize>), Vec<CompilerError>>
Compiles the (type-checked) program with provided constants, producing a circuit of gates.
Assumes that the input program has been correctly type-checked and panics if incompatible types are found that should have been caught by the type-checker.