Struct ryna::context::RynaContext
source · pub struct RynaContext {Show 20 fields
pub type_templates: Vec<TypeTemplate>,
pub interfaces: Vec<Interface>,
pub interface_impls: Vec<InterfaceImpl>,
pub unary_ops: Vec<Operator>,
pub binary_ops: Vec<Operator>,
pub nary_ops: Vec<Operator>,
pub sorted_ops: Vec<Operator>,
pub functions: Vec<Function>,
pub macros: Vec<RynaMacro>,
pub variables: Vec<Object>,
pub lambdas: usize,
pub lambda_code_length: usize,
pub lambda_code: Vec<RynaInstruction>,
pub lambda_positions: HashMap<usize, usize>,
pub cache: RynaCache,
pub optimize: bool,
pub module_name: Arc<String>,
pub module_path: String,
pub captured_output: RefCell<String>,
pub program_input: Vec<String>,
}Fields§
§type_templates: Vec<TypeTemplate>§interfaces: Vec<Interface>§interface_impls: Vec<InterfaceImpl>§unary_ops: Vec<Operator>§binary_ops: Vec<Operator>§nary_ops: Vec<Operator>§sorted_ops: Vec<Operator>§functions: Vec<Function>§macros: Vec<RynaMacro>§variables: Vec<Object>§lambdas: usize§lambda_code_length: usize§lambda_code: Vec<RynaInstruction>§lambda_positions: HashMap<usize, usize>§cache: RynaCache§optimize: bool§module_name: Arc<String>§module_path: String§captured_output: RefCell<String>§program_input: Vec<String>Implementations§
source§impl RynaContext
impl RynaContext
pub fn redefine_type( &mut self, l: Location, annotations: Vec<Annotation>, representation: String, params: Vec<String>, attributes: Vec<(String, Type)>, alias: Option<Type>, patterns: Vec<Pattern>, parser: Option<ParsingFunction>, ) -> Result<(), String>
pub fn define_type( &mut self, l: Location, annotations: Vec<Annotation>, representation: String, params: Vec<String>, attributes: Vec<(String, Type)>, alias: Option<Type>, patterns: Vec<Pattern>, parser: Option<ParsingFunction>, ) -> Result<(), String>
pub fn redefine_interface( &mut self, l: Location, annotations: Vec<Annotation>, representation: String, params: Vec<String>, fns: Vec<InterfaceFunctionHeader>, uns: Vec<InterfaceUnaryOpHeader>, bin: Vec<InterfaceBinaryOpHeader>, nary: Vec<InterfaceNaryOpHeader>, ) -> Result<(), String>
pub fn define_interface( &mut self, l: Location, annotations: Vec<Annotation>, representation: String, params: Vec<String>, fns: Vec<InterfaceFunctionHeader>, uns: Vec<InterfaceUnaryOpHeader>, bin: Vec<InterfaceBinaryOpHeader>, nary: Vec<InterfaceNaryOpHeader>, ) -> Result<(), String>
pub fn define_interface_impl( &mut self, representation: String, templates: Vec<String>, tp: Type, t_args: Vec<Type>, ) -> Result<(), String>
pub fn implements_interface( &self, t: &Type, constraint: &InterfaceConstraint, t_assignments: &mut HashMap<usize, Type>, t_deps: &mut HashMap<usize, HashSet<usize>>, ) -> bool
pub fn define_unary_operator( &mut self, representation: String, prefix: bool, precedence: usize, ) -> Result<(), String>
pub fn get_unary_operations( &self, id: usize, a: Type, ) -> Vec<&Operation<UnaryFunctionFn>>
pub fn define_native_unary_operation( &mut self, id: usize, templates: usize, a: Type, ret: Type, f: fn(_: &Vec<Type>, _: &Type, _: Object) -> Result<Object, String>, ) -> Result<usize, String>
pub fn define_unary_operation( &mut self, l: Location, annot: Vec<Annotation>, id: usize, templates: usize, a: Type, ret: Type, f: OptUnaryFunctionFn, ) -> Result<usize, String>
pub fn define_binary_operator( &mut self, representation: String, right_associative: bool, precedence: usize, ) -> Result<(), String>
pub fn get_binary_operations( &self, id: usize, a: Type, b: Type, ) -> Vec<&Operation<BinaryFunctionFn>>
pub fn define_native_binary_operation( &mut self, id: usize, templates: usize, a: Type, b: Type, ret: Type, f: BinaryFunctionFn, ) -> Result<usize, String>
pub fn define_binary_operation( &mut self, l: Location, annot: Vec<Annotation>, id: usize, templates: usize, a: Type, b: Type, ret: Type, f: OptBinaryFunctionFn, ) -> Result<usize, String>
pub fn define_nary_operator( &mut self, open_rep: String, close_rep: String, precedence: usize, ) -> Result<(), String>
pub fn get_nary_operations( &self, id: usize, from: Type, args: &[Type], ) -> Vec<&Operation<NaryFunctionFn>>
pub fn define_native_nary_operation( &mut self, id: usize, templates: usize, from: Type, args: &[Type], ret: Type, f: NaryFunctionFn, ) -> Result<usize, String>
pub fn define_nary_operation( &mut self, l: Location, annot: Vec<Annotation>, id: usize, templates: usize, from: Type, args: &[Type], ret: Type, f: OptNaryFunctionFn, ) -> Result<usize, String>
pub fn define_function(&mut self, name: String) -> Result<usize, String>
pub fn get_function_overloads( &self, id: usize, templates: &[Type], args: &[Type], ) -> Vec<&FunctionOverload>
pub fn define_native_function_overload( &mut self, id: usize, templates: usize, args: &[Type], ret: Type, f: FunctionOverloadFn, ) -> Result<usize, String>
pub fn define_function_overload( &mut self, l: Location, annot: Vec<Annotation>, id: usize, templates: usize, args: &[Type], ret: Type, f: OptFunctionOverloadFn, ) -> Result<usize, String>
source§impl RynaContext
impl RynaContext
pub fn located<'a, O, P1: FnMut(Span<'a>) -> PResult<'a, O>>( &'a self, parser: P1, ) -> impl FnMut(Span<'a>) -> PResult<'a, (Location, O)>
pub fn get_type_id(&self, name: String) -> Result<usize, String>
pub fn get_interface_id(&self, name: String) -> Result<usize, String>
pub fn get_function_id(&self, name: String) -> Result<usize, String>
pub fn get_function(&self, name: &str) -> Option<&Function>
pub fn get_interface(&self, name: &str) -> Option<&Interface>
pub fn get_type_template(&self, name: &str) -> Option<&TypeTemplate>
pub fn type_parser<'a>(&'a self, input: Span<'a>) -> PResult<'a, Type>
pub fn parse_literal_type<'a>( &'a self, c_type: &'a TypeTemplate, input: Span<'a>, cache: &PCache<'a>, ) -> PResult<'a, Object>
pub fn ryna_expr_parser<'a>( &'a self, input: Span<'a>, cache: &PCache<'a>, ) -> PResult<'a, RynaExpr>
pub fn ryna_operators_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_function_headers_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<(String, Option<Vec<String>>, Vec<(String, Type)>, Type)>>
pub fn ryna_operations_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_macros_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_interface_implementation_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_interface_definition_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_interface_definition_names_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<String>>
pub fn ryna_class_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, Vec<RynaExpr>>
pub fn ryna_class_names_parser<'a>( &'a self, input: Span<'a>, ) -> PResult<'a, HashSet<String>>
pub fn ryna_parser<'a>(&'a self, input: Span<'a>) -> PResult<'a, Vec<RynaExpr>>
source§impl RynaContext
impl RynaContext
pub fn get_first_unary_op( &self, id: usize, arg_type: Type, call_templates: Option<Vec<Type>>, sub_t: bool, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn is_unary_op_ambiguous( &self, id: usize, arg_type: Type, ) -> Option<Vec<(Type, Type)>>
pub fn get_first_binary_op( &self, id: usize, a_type: Type, b_type: Type, call_templates: Option<Vec<Type>>, sub_t: bool, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn is_binary_op_ambiguous( &self, id: usize, a_type: Type, b_type: Type, ) -> Option<Vec<(Type, Type, Type)>>
pub fn get_first_nary_op( &self, id: usize, a_type: Type, b_type: Vec<Type>, call_templates: Option<Vec<Type>>, sub_t: bool, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn is_nary_op_ambiguous( &self, id: usize, a_type: Type, b_type: Vec<Type>, ) -> Option<Vec<(Type, Vec<Type>, Type)>>
pub fn get_first_function_overload( &self, id: usize, arg_type: Vec<Type>, call_templates: Option<Vec<Type>>, sub_t: bool, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn is_function_overload_ambiguous( &self, id: usize, arg_type: Vec<Type>, ) -> Option<Vec<(Type, Type)>>
pub fn implements_iterable(&self, container_type: &Type) -> bool
pub fn get_iterator_type( &self, container_type: &Type, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn get_iterator_output_type( &self, iterator_type: &Type, l: &Location, ) -> Result<(usize, Type, bool, Vec<Type>), RynaError>
pub fn infer_type(&self, expr: &RynaExpr) -> Result<Type, RynaError>
source§impl RynaContext
impl RynaContext
pub fn ensured_return_check(expr: &RynaExpr) -> Result<(), RynaError>
pub fn ensured_return_check_body( lines: &Vec<RynaExpr>, l: &Location, instance: &str, ) -> Result<(), RynaError>
pub fn return_check( &self, expr: &RynaExpr, ret_type: &Option<Type>, ) -> Result<(), RynaError>
pub fn ambiguity_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn break_continue_check( expr: &RynaExpr, allowed: bool, ) -> Result<(), RynaError>
pub fn invalid_type_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn check_type_well_formed( &self, t: &Type, l: &Location, ) -> Result<(), RynaError>
pub fn type_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn implicit_syntax_check( &self, name: &String, templates: &[String], attributes: &[(String, Type)], syntaxes: &Vec<Pattern>, ) -> Result<(), String>
pub fn class_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn macro_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn interface_impl_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn no_template_check_type( &self, t: &Type, l: &Location, ) -> Result<(), RynaError>
pub fn no_template_check_types( &self, t: &[Type], l: &Location, ) -> Result<(), RynaError>
pub fn no_template_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn lambda_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn repeated_args( &self, args: &Vec<&String>, item: &str, ) -> Result<(), String>
pub fn repeated_arguments_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn check_test_annotation( &self, annot: &Annotation, t: &Vec<String>, args: &Vec<(String, Type)>, ret: &Type, ) -> Result<(), String>
pub fn check_fn_doc_annotation( &self, annot: &Annotation, args: &Vec<(String, Type)>, ) -> Result<(), String>
pub fn check_noret_doc_annotation( &self, annot: &Annotation, args: &Vec<(String, Type)>, ) -> Result<(), String>
pub fn annotation_checks(&self, expr: &RynaExpr) -> Result<(), RynaError>
pub fn check_formats(&self, expr: &RynaExpr)
pub fn static_check_expected( &self, expr: &RynaExpr, expected: &Option<Type>, ) -> Result<(), RynaError>
pub fn static_check(&self, expr: &RynaExpr) -> Result<(), RynaError>
source§impl RynaContext
impl RynaContext
pub fn transform_term(&mut self, expr: &mut RynaExpr) -> Result<(), RynaError>
pub fn compile_vars_and_infer( &mut self, body: &mut Vec<RynaExpr>, args: &Vec<(String, Type)>, ) -> Result<usize, RynaError>
pub fn compile( &mut self, body: &mut Vec<RynaExpr>, args: &Vec<(String, Type)>, ) -> Result<(), RynaError>
source§impl RynaContext
impl RynaContext
pub fn get_inner_dep_graph( &mut self, lines: &[RynaExpr], ) -> Result<DirectedGraph<(ImportType, usize), ()>, RynaError>
pub fn get_inner_dep_graph_body( &self, lines: &Vec<RynaExpr>, parent: &(ImportType, usize), deps: &mut DirectedGraph<(ImportType, usize), ()>, )
pub fn get_inner_dep_graph_expr( &self, expr: &RynaExpr, parent: &(ImportType, usize), deps: &mut DirectedGraph<(ImportType, usize), ()>, )
pub fn get_template_calls_body( &mut self, lines: &Vec<RynaExpr>, ) -> Result<(), RynaError>
pub fn get_template_calls_pass( &mut self, expr: &RynaExpr, changed: &mut bool, ) -> Result<(), RynaError>
pub fn get_template_calls_body_pass( &mut self, lines: &Vec<RynaExpr>, changed: &mut bool, ) -> Result<(), RynaError>
pub fn subtitute_type_params_expr( expr: &mut RynaExpr, templates: &HashMap<usize, Type>, )
pub fn compile_lambda_expr( &mut self, line: &RynaExpr, only_length: bool, ) -> Result<(), RynaError>
pub fn compile_lambdas( &mut self, lines: &Vec<RynaExpr>, only_length: bool, ) -> Result<(), RynaError>
pub fn compile_function_lambdas( &mut self, lines: &Vec<RynaExpr>, only_length: bool, ) -> Result<(), RynaError>
pub fn compiled_form( &mut self, lines: &Vec<RynaExpr>, ) -> Result<Vec<RynaInstruction>, RynaError>
pub fn compiled_form_size( &self, expr: &RynaExpr, root: bool, root_counter: &mut usize, ) -> Result<usize, RynaError>
pub fn compiled_form_body_size( &self, lines: &Vec<RynaExpr>, root: bool, ) -> Result<usize, RynaError>
pub fn compiled_literal_size(obj: &Object) -> usize
pub fn compile_literal(obj: &Object) -> Vec<RynaInstruction>
pub fn compiled_form_expr( &self, expr: &RynaExpr, root: bool, ) -> Result<Vec<RynaInstruction>, RynaError>
pub fn compiled_form_body( &self, lines: &[RynaExpr], ) -> Result<Vec<RynaInstruction>, RynaError>
pub fn define_module_macro( &mut self, definition: RynaExpr, defined_macros: &mut FxHashSet<Location>, ) -> Result<bool, RynaError>
pub fn define_module_class( &mut self, definition: RynaExpr, ) -> Result<(), RynaError>
pub fn define_module_macros(&mut self, code: &String) -> Result<(), RynaError>
pub fn define_module_classes(&mut self, code: &String) -> Result<(), RynaError>
pub fn define_module_operators( &mut self, code: &String, ) -> Result<(), RynaError>
pub fn define_module_functions( &mut self, code: &String, ) -> Result<(), RynaError>
pub fn define_module_operations( &mut self, code: &String, ) -> Result<(), RynaError>
pub fn define_module_function_overloads( &mut self, lines: &Vec<RynaExpr>, ) -> Result<(), RynaError>
pub fn parse_ryna_module( &mut self, code: &String, ) -> Result<Vec<RynaExpr>, RynaError>
pub fn map_ryna_interface( &mut self, other: &RynaContext, id: usize, id_mapper: &mut IdMapper, l: &Location, ) -> Result<usize, String>
pub fn map_ryna_class( &mut self, other: &RynaContext, id: usize, id_mapper: &mut IdMapper, l: &Location, ) -> Result<usize, String>
pub fn map_ryna_expression( &mut self, expr: &mut RynaExpr, ctx: &RynaContext, id_mapper: &mut IdMapper, ) -> Result<(), RynaError>
pub fn import_code( &mut self, code: &[RynaExpr], source: &Vec<String>, ctx: &RynaContext, imports: &Imports, ) -> Result<(Vec<RynaExpr>, Vec<String>), RynaError>
pub fn parse_with_dependencies( &mut self, name: &str, code: &String, modules: &HashMap<String, &RynaModule>, ) -> Result<(Vec<RynaExpr>, Vec<String>), RynaError>
pub fn parse_without_precompiling( &mut self, code: &String, ) -> Result<Vec<RynaExpr>, RynaError>
pub fn precompile_module( &mut self, lines: &mut Vec<RynaExpr>, ) -> Result<(), RynaError>
pub fn parse_and_precompile( &mut self, code: &String, ) -> Result<Vec<RynaExpr>, RynaError>
pub fn parse_and_compile( &mut self, code: &String, ) -> Result<Vec<RynaInstruction>, RynaError>
source§impl RynaContext
impl RynaContext
pub fn count_usages_expr( expr: &RynaExpr, var_usages: &mut FxHashMap<usize, usize>, offset: usize, )
pub fn insert_moves_expr( &self, expr: &mut RynaExpr, var_usages: &mut FxHashMap<usize, usize>, )
pub fn insert_moves(&self, body: &mut Vec<RynaExpr>)
pub fn strength_reduction_expr(&self, expr: &mut RynaExpr)
pub fn inlining_weight(&self, body: &Vec<RynaExpr>) -> f32
pub fn max_variable(expr: &RynaExpr, offset: &mut usize)
pub fn offset_variables(expr: &mut RynaExpr, offset: usize)
pub fn inline_body( &self, body: Vec<RynaExpr>, args: Vec<RynaExpr>, var_offset: &mut usize, l: &Location, ) -> Vec<RynaExpr>
pub fn inline_functions_expr(&self, expr: &mut RynaExpr, offset: &mut usize)
pub fn inline_functions(&self, body: &mut Vec<RynaExpr>, offset: &mut usize)
pub fn strength_reduction(&self, body: &mut Vec<RynaExpr>)
pub fn optimize(&self, body: &mut Vec<RynaExpr>)
pub fn is_constant_expr( &self, expr: &RynaExpr, consts: &FxHashMap<usize, bool>, ) -> bool
pub fn compute_constant_expr( expr: &RynaExpr, const_exprs: &FxHashMap<usize, RynaExpr>, ) -> Object
pub fn get_constants( &self, expr: &RynaExpr, consts: &mut FxHashMap<usize, bool>, const_exprs: &mut FxHashMap<usize, RynaExpr>, )
pub fn constant_propagation(&self, body: &mut Vec<RynaExpr>)
pub fn late_optimize(&self, body: &mut Vec<RynaExpr>)
source§impl RynaContext
impl RynaContext
pub fn optimize_instructions(&self, program: &mut Vec<RynaInstruction>)
source§impl RynaContext
impl RynaContext
pub fn parse_and_execute_ryna_module( &mut self, code: &String, ) -> Result<ExecutionInfo, RynaError>
pub fn parse_and_execute_ryna_project_inner<const DEBUG: bool>( path: String, macro_code: Option<String>, force_recompile: bool, optimize: bool, test: bool, program_input: &[String], ) -> Result<ExecutionInfo, RynaError>
pub fn parse_and_execute_ryna_project<const DEBUG: bool>( path: String, force_recompile: bool, optimize: bool, test: bool, program_input: &[String], ) -> Result<ExecutionInfo, RynaError>
source§impl RynaContext
impl RynaContext
pub fn execute_compiled_code<const DEBUG: bool>( &mut self, program: &[CompiledRynaExpr], debug_info: &[DebugInfo], ) -> Result<ExecutionInfo, RynaError>
source§impl RynaContext
impl RynaContext
pub fn get_serializable_module( &self, hash: String, instructions: &[RynaInstruction], ) -> CompiledRynaModule
Trait Implementations§
source§impl Clone for RynaContext
impl Clone for RynaContext
source§fn clone(&self) -> RynaContext
fn clone(&self) -> RynaContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Default for RynaContext
impl Default for RynaContext
source§fn default() -> RynaContext
fn default() -> RynaContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for RynaContext
impl !RefUnwindSafe for RynaContext
impl !Send for RynaContext
impl !Sync for RynaContext
impl Unpin for RynaContext
impl !UnwindSafe for RynaContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)