MCPcopy Create free account

hub / github.com/ControlCplusControlV/Scribe / functions

Functions181 in github.com/ControlCplusControlV/Scribe

↓ 58 callersMethodadd_line
Adds a line to the miden program output, properly indented
crates/papyrus/src/miden_generator.rs:1030
↓ 55 callersFunctionrun_example
Function to display transpile Yul code and display each step of the transpilation process in the terminal. This function is only used to demonstrate w
crates/miden-integration-tests/tests/utils.rs:20
↓ 17 callersMethodadd_comment
Add a comment in to the Miden assembly. Comments are generated throughout transpilation.
crates/papyrus/src/miden_generator.rs:1052
↓ 16 callersMethod_consume_top_stack_values
Consume n stack values from the top of our stack. This doesn't affect miden's stack.
crates/papyrus/src/miden_generator.rs:496
↓ 14 callersMethodindent
Function to indent the Miden assembly by four spaces. Ex. if.true push.0
crates/papyrus/src/miden_generator.rs:104
↓ 13 callersMethodoutdent
Function to decrease the indent in the Miden assembly by four spaces Ex. if.true push.0 drop
crates/papyrus/src/miden_generator.rs:115
↓ 13 callersMethodpush
Function to push a u32 value on both the miden stack and our stack
crates/papyrus/src/miden_generator.rs:330
↓ 13 callersFunctionrun_miden_function
( proc: &str, stack: Vec<primitive_types::U256>, expected: MidenResult, )
crates/miden-integration-tests/tests/quickcheck_tests.rs:34
↓ 12 callersMethodtranspile_op
Function to transpile expressions into Miden instructions See the transpilation function for each expression for more detail on each case
crates/papyrus/src/miden_generator.rs:1065
↓ 10 callersMethodadd_unknown
Add an unkown value onto our stack, for example if we evaluate `add(1,2)`, we know there's a new value on the stack but it isn't assigned to a variabl
crates/papyrus/src/miden_generator.rs:184
↓ 10 callersFunctioncompile_example
(yul_code: &str, expected_output: &str)
crates/miden-integration-tests/tests/utils.rs:83
↓ 10 callersFunctionparse_block
Parses a block into an Expr
crates/papyrus/src/parser.rs:327
↓ 9 callersMethodnewline
Add a new empty line into the Miden assembly
crates/papyrus/src/miden_generator.rs:1047
↓ 9 callersFunctionprint_title
(s: &str)
crates/miden-integration-tests/tests/utils.rs:21
↓ 9 callersMethodtranspile_block
Transpile a block. Loops through an ExprBlock which is a Vec of expressions and transpiles each expression.
crates/papyrus/src/miden_generator.rs:605
↓ 9 callersMethodwalk_ast
(&mut self, ast: &Vec<Expr>)
crates/papyrus/src/type_inference.rs:20
↓ 8 callersMethodtranspile_function_args
(&mut self, op: &ExprFunctionCall)
crates/papyrus/src/miden_generator.rs:759
↓ 7 callersFunctionparse_expression
Function to parse grammar within an expression rule
crates/papyrus/src/parser.rs:247
↓ 6 callersMethodadd_proc_exec
Adds a line to execute the given proc, also marks it as used so we can insert the relevant proc later
crates/papyrus/src/miden_generator.rs:1041
↓ 6 callersFunctionwalk_ast
Walks through each expression in the abstract syntax tree, optimizing the AST where possible. A new, optimized AST is returned Which is then passed in
crates/papyrus/src/ast_optimization.rs:21
↓ 5 callersFunctionjoin_u32s_to_u256
(x: Vec<u32>)
crates/papyrus/src/utils.rs:46
↓ 4 callersMethodbegin_branch
Function to tell the transpiler to begin a branch during when entering a conditional statement
crates/papyrus/src/miden_generator.rs:142
↓ 4 callersMethoddup_identifier
not pushing but duping to the top, offset is just where the value starts and depending on the type it may have to dup 8 elements
crates/papyrus/src/miden_generator.rs:297
↓ 4 callersMethodend_branch
Function to tell the transpiler to end a branch when exiting a conditional statement, updating the state of the stack and variables.
crates/papyrus/src/miden_generator.rs:150
↓ 4 callersFunctionexecute
Compiles and executes a compiled Miden program, returning the stack and any Miden errors. The program is passed in as a String, passed to the Miden As
crates/papyrus/src/executor.rs:6
↓ 4 callersFunctioninfer_types
Function to
crates/papyrus/src/type_inference.rs:6
↓ 4 callersMethodmiden_stack_width
Returns the stack width that the uint occupies in the Miden VM Miden stack elements can occupy 32bits, a u32 number will occupy one element, where a u
crates/papyrus/src/types.rs:64
↓ 4 callersFunctionoptimize_ast
(ast: Vec<Expr>)
crates/papyrus/src/ast_optimization.rs:8
↓ 4 callersFunctionparse_yul_syntax
To see examples for each Expr, check out types.rs
crates/papyrus/src/parser.rs:19
↓ 4 callersMethodprepare_for_stack_values
Function to check the stack size and determine whether or not the push will overflow into inaccesible stack slots (17+). If it would push values past
crates/papyrus/src/miden_generator.rs:348
↓ 4 callersMethodtop_is_var
Sets the value at the top of the stack to a typed_identifier. For example, when a value gets pushed to the stack, it is unknown. Then once top_is_var(
crates/papyrus/src/miden_generator.rs:532
↓ 3 callersMethodmove_identifier_to_top
Fetches an identifier from either memory or the stack, and moves it to the top. Will dup from the stack if dup is true, otherwise will move up
crates/papyrus/src/miden_generator.rs:204
↓ 3 callersFunctionparse_literal
Parses a literal into an Expr Literals can be a number literal, string literal, true/false literal or a hex literal. Literals can also have an optiona
crates/papyrus/src/parser.rs:239
↓ 3 callersFunctionparse_statement
Parses a Yul statement. This function matches a grammar rule and return an Expr struct which is later added into the Abstract Syntax Tree
crates/papyrus/src/parser.rs:54
↓ 3 callersFunctionparse_typed_identifier_list
Parses a typed identifier list for function definitions or variable declarations. This is later used to determine what type of operation to use for sp
crates/papyrus/src/parser.rs:219
↓ 3 callersMethodpop_top_stack_value_to_memory
Function to remove the top stack value from the stack and save it into memory. If the variable is already stored in memory, the transpiler will update
crates/papyrus/src/miden_generator.rs:429
↓ 3 callersFunctiontranspile_program
Transpile a Miden program from a Vec of expressions and return the compiled Miden program as a string
crates/papyrus/src/miden_generator.rs:1126
↓ 2 callersMethodget_size_of_stack
Return the size of the stack, accounting for u256 values taking up 8 values.
crates/papyrus/src/miden_generator.rs:472
↓ 2 callersMethodget_typed_identifier
Get the data type for a specific variable
crates/papyrus/src/miden_generator.rs:548
↓ 2 callersMethodinfer_literal
(&mut self, literal: ExprLiteral)
crates/papyrus/src/type_inference.rs:241
↓ 2 callersFunctionmiden_to_u256
Converts the top 8 elements on the top of the stack to a U256 struct This is used during testing to assert that the Miden output is the correct U256 v
crates/miden-integration-tests/tests/utils.rs:131
↓ 2 callersMethodmove_from_offset
(&mut self, offset: u32, yul_type: YulType)
crates/papyrus/src/miden_generator.rs:395
↓ 2 callersMethodpush_from_memory_to_top_of_stack
Push a value from memory to the top of the stack. If the element is a u32, it takes up one 32bit element of one memory address. When the element is a
crates/papyrus/src/miden_generator.rs:273
↓ 2 callersFunctionreverse
(xs: &[T])
crates/miden-integration-tests/tests/quickcheck_tests.rs:240
↓ 2 callersMethodtarget_stack
Function to return the state of the stack before branching. For more details on a branch, see the Branch struct.
crates/papyrus/src/miden_generator.rs:122
↓ 2 callersMethodtranspile_assignment
Transpile an assignment Ex. x = 1000 or x = 1000:u256 Note that ExprAssignment has parameters of pub identifiers: Vec<String>, (ie. variable names) pu
crates/papyrus/src/miden_generator.rs:585
↓ 2 callersMethodtranspile_literal
Transpile a literal If the value is u32, a single push will occur If the value is u256, 8 elements will be pushed onto the stack. See push_u256 for mo
crates/papyrus/src/miden_generator.rs:900
↓ 1 callersMethodadd_function_stack
Modifies the stack to include values from developer written functions in Yul For example, if someone were to write a function called return_two_number
crates/papyrus/src/miden_generator.rs:540
↓ 1 callersMethodadd_to_tree
Add the Expr to the abstract syntax tree. Each Expr is added as a tree "leaf".
crates/papyrus/src/types.rs:244
↓ 1 callersMethodadd_use
(&mut self, library: &str)
crates/papyrus/src/miden_generator.rs:1105
↓ 1 callersMethodadd_utility_functions
Adds all procedures defined in the u256.masm file as utility functions that can be called in the transpiled Miden program Ex. u256add_unsafe, u256sub_
crates/papyrus/src/miden_generator.rs:1088
↓ 1 callersMethodbegin_accepting_overflow
Generally we keep all stack values accessible (aka, only use the first 16 slots). This will temporarily disable that protection, for cases where we kn
crates/papyrus/src/miden_generator.rs:171
↓ 1 callersFunctionconvert_u256_to_pushes
Function to output Miden assembly to convert a u256 struct, into eight 32bit segments and push them onto the stack
crates/papyrus/src/utils.rs:6
↓ 1 callersMethoddrop_after_returns
Drops the stack after the nth element. For example if the stack is [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] drop_after(10) will result [
crates/papyrus/src/miden_generator.rs:505
↓ 1 callersMethoddup_from_offset
TODO: explain the function and then explain what an offset is
crates/papyrus/src/miden_generator.rs:302
↓ 1 callersFunctionexpressions_to_tree
Add a Vec of Expr to an abstract syntax tree and return the tree as a string
crates/papyrus/src/types.rs:459
↓ 1 callersMethodget_inferred_type
(&self)
crates/papyrus/src/types.rs:33
↓ 1 callersMethodload_identifier_from_memory
Function to load a variable's value from memory and push it to the top of the stack See push_from_memory_to_top_of_stack for more details on how diffe
crates/papyrus/src/miden_generator.rs:256
↓ 1 callersMethodmiden_memory_addresses
Returns the amount of addresses in memory the number occupies. Memory addresses in Miden are four words (one word is 32bits). A u32 number will take u
crates/papyrus/src/types.rs:75
↓ 1 callersFunctionparse_case
Parses a case statement into an Expr
crates/papyrus/src/parser.rs:209
↓ 1 callersFunctionparse_identifier
Parses an identifier into an Expr, which gets transpiled into a variable reference. These variables need to be kept track of during transpilation in c
crates/papyrus/src/parser.rs:319
↓ 1 callersFunctionparse_identifier_list
Parses an identifier list for function definitions or variable declarations. TODO: explain how this gets handled in transpilation, variables stored in
crates/papyrus/src/parser.rs:199
↓ 1 callersMethodpop_bottom_var_to_memory
Function to remove the bottom variable from the stack and move it to memory. Under the hood, this function moves the bottom value to the top of the st
crates/papyrus/src/miden_generator.rs:370
↓ 1 callersMethodpush_u256
Push a u256 value to the stack. See convert_u256_to_pushes for more details on how u256 segments are pushed.
crates/papyrus/src/miden_generator.rs:481
↓ 1 callersFunctionread_yul_contracts
Read in all of the Yul contracts from the contracts directory and return a Vec of Yul Files
bin/scribe/src/main.rs:39
↓ 1 callersFunctionsplit_u256_to_u32s
(x: &U256)
crates/papyrus/src/utils.rs:26
↓ 1 callersFunctionstart_repl
(functions_file: Option<String>, stack_string: Option<String>)
bin/repl/src/repl.rs:73
↓ 1 callersMethodstop_accepting_overflow
Re-enable our overflow protection (saving values that go below the 16 accesible slots, to memory)
crates/papyrus/src/miden_generator.rs:177
↓ 1 callersMethodtranspile_break
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:958
↓ 1 callersMethodtranspile_case
Transpile a case expression Note that ExprCase has two parameters pub literal: ExprLiteral, (this is the case statement) pub block: ExprBlock, (this i
crates/papyrus/src/miden_generator.rs:970
↓ 1 callersMethodtranspile_continue
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:964
↓ 1 callersMethodtranspile_for_loop
Transpile a for loop. A for loop is made up of an init block, a conditional, an after block and an interior block. Under the hood, while.true evaluate
crates/papyrus/src/miden_generator.rs:624
↓ 1 callersMethodtranspile_function_declaration
Transpiles a function declaration First, the transpiler gets the stack values that the function will push onto the Miden stack and the function parame
crates/papyrus/src/miden_generator.rs:929
↓ 1 callersMethodtranspile_if_statement
Transpile an if statement Branches are created to preserve the state of the stack before and after the if statement. See the Branch struct for more de
crates/papyrus/src/miden_generator.rs:885
↓ 1 callersMethodtranspile_leave
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:961
↓ 1 callersMethodtranspile_miden_function
Transpiles a procedure in miden. For example, if a function call is passed in as an expression, the first parameter type is u256 and the function name
crates/papyrus/src/miden_generator.rs:769
↓ 1 callersMethodtranspile_repeat
Transpiles a repeat expression
crates/papyrus/src/miden_generator.rs:661
↓ 1 callersMethodtranspile_switch
Transpiles a switch statement Note that ExprSwitch has four parts pub default_case: Option<ExprBlock>, pub inferred_type: Option<YulType>, pub expr: B
crates/papyrus/src/miden_generator.rs:677
↓ 1 callersMethodtranspile_variable_declaration
Transpile a variable declaration. Ex. let x := 1000 or let x:u256 := 1000
crates/papyrus/src/miden_generator.rs:558
↓ 1 callersMethodtranspile_variable_reference
FIXME: Still needs comments see push identifier to top
crates/papyrus/src/miden_generator.rs:919
↓ 1 callersMethodupdate_identifier_in_memory
Function to update the value of a variable stored in memory. First, the value of the variable is pushed to the top of the stack where it is then saved
crates/papyrus/src/miden_generator.rs:197
↓ 1 callersMethodvisit_expr
(&mut self, _expr: Expr)
crates/papyrus/src/ast_optimization.rs:76
↓ 1 callersFunctionwalk_expr
TODO: it would be nice if there wasn't so much cloning in here
crates/papyrus/src/ast_optimization.rs:201
↓ 1 callersMethodwalk_expr
(&mut self, expr: Expr)
crates/papyrus/src/type_inference.rs:28
↓ 1 callersFunctionwrite_yul_to_masm
(yul_file: YulFile)
bin/scribe/src/main.rs:12
Functionaddition
(x: U256, y: U256)
crates/miden-integration-tests/tests/quickcheck_tests.rs:87
Methodarbitrary
(g: &mut Gen)
crates/miden-integration-tests/tests/quickcheck_tests.rs:19
Functionauto_and
(x: U256, y: U256)
crates/miden-integration-tests/tests/quickcheck_tests.rs:177
Functiondebug_execution
()
crates/papyrus/src/executor.rs:24
Methoddefault
()
crates/papyrus/src/miden_generator.rs:1117
Functiondouble_reversal_is_identity
(xs: Vec<isize>)
crates/miden-integration-tests/tests/quickcheck_tests.rs:249
Methodfmt
Print TypedIdentifier
crates/papyrus/src/types.rs:471
Methodfmt
(&self, f: &mut std::fmt::Formatter<'_>)
crates/papyrus/src/miden_generator.rs:75
Functionformat_inferred_types
Convert a Vec of YulType to a string
crates/papyrus/src/types.rs:496
Methodfrom
(typed_identifier: &TypedIdentifier)
crates/papyrus/src/miden_generator.rs:61
Methodfrom_annotation
Converts a string representation of u32 or u256 to a YulType
crates/papyrus/src/types.rs:53
Methodget_const_variables
Checks for variables that are only assigned once and returns a hashmap of the variables to convert into constants.
crates/papyrus/src/ast_optimization.rs:54
Functiongreater_than
(x: U256Small, y: U256Small)
crates/miden-integration-tests/tests/quickcheck_tests.rs:133
Functiongreater_than_or_equal_to
(x: U256Small, y: U256Small)
crates/miden-integration-tests/tests/quickcheck_tests.rs:155
Functioninferred_type_to_string
Convert YulType to string
crates/papyrus/src/types.rs:488
next →1–100 of 181, ranked by callers