Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ControlCplusControlV/Scribe
/ functions
Functions
181 in github.com/ControlCplusControlV/Scribe
⨍
Functions
181
◇
Types & classes
34
↓ 58 callers
Method
add_line
Adds a line to the miden program output, properly indented
crates/papyrus/src/miden_generator.rs:1030
↓ 55 callers
Function
run_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 callers
Method
add_comment
Add a comment in to the Miden assembly. Comments are generated throughout transpilation.
crates/papyrus/src/miden_generator.rs:1052
↓ 16 callers
Method
_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 callers
Method
indent
Function to indent the Miden assembly by four spaces. Ex. if.true push.0
crates/papyrus/src/miden_generator.rs:104
↓ 13 callers
Method
outdent
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 callers
Method
push
Function to push a u32 value on both the miden stack and our stack
crates/papyrus/src/miden_generator.rs:330
↓ 13 callers
Function
run_miden_function
( proc: &str, stack: Vec<primitive_types::U256>, expected: MidenResult, )
crates/miden-integration-tests/tests/quickcheck_tests.rs:34
↓ 12 callers
Method
transpile_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 callers
Method
add_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 callers
Function
compile_example
(yul_code: &str, expected_output: &str)
crates/miden-integration-tests/tests/utils.rs:83
↓ 10 callers
Function
parse_block
Parses a block into an Expr
crates/papyrus/src/parser.rs:327
↓ 9 callers
Method
newline
Add a new empty line into the Miden assembly
crates/papyrus/src/miden_generator.rs:1047
↓ 9 callers
Function
print_title
(s: &str)
crates/miden-integration-tests/tests/utils.rs:21
↓ 9 callers
Method
transpile_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 callers
Method
walk_ast
(&mut self, ast: &Vec<Expr>)
crates/papyrus/src/type_inference.rs:20
↓ 8 callers
Method
transpile_function_args
(&mut self, op: &ExprFunctionCall)
crates/papyrus/src/miden_generator.rs:759
↓ 7 callers
Function
parse_expression
Function to parse grammar within an expression rule
crates/papyrus/src/parser.rs:247
↓ 6 callers
Method
add_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 callers
Function
walk_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 callers
Function
join_u32s_to_u256
(x: Vec<u32>)
crates/papyrus/src/utils.rs:46
↓ 4 callers
Method
begin_branch
Function to tell the transpiler to begin a branch during when entering a conditional statement
crates/papyrus/src/miden_generator.rs:142
↓ 4 callers
Method
dup_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 callers
Method
end_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 callers
Function
execute
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 callers
Function
infer_types
Function to
crates/papyrus/src/type_inference.rs:6
↓ 4 callers
Method
miden_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 callers
Function
optimize_ast
(ast: Vec<Expr>)
crates/papyrus/src/ast_optimization.rs:8
↓ 4 callers
Function
parse_yul_syntax
To see examples for each Expr, check out types.rs
crates/papyrus/src/parser.rs:19
↓ 4 callers
Method
prepare_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 callers
Method
top_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 callers
Method
move_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 callers
Function
parse_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 callers
Function
parse_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 callers
Function
parse_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 callers
Method
pop_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 callers
Function
transpile_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 callers
Method
get_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 callers
Method
get_typed_identifier
Get the data type for a specific variable
crates/papyrus/src/miden_generator.rs:548
↓ 2 callers
Method
infer_literal
(&mut self, literal: ExprLiteral)
crates/papyrus/src/type_inference.rs:241
↓ 2 callers
Function
miden_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 callers
Method
move_from_offset
(&mut self, offset: u32, yul_type: YulType)
crates/papyrus/src/miden_generator.rs:395
↓ 2 callers
Method
push_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 callers
Function
reverse
(xs: &[T])
crates/miden-integration-tests/tests/quickcheck_tests.rs:240
↓ 2 callers
Method
target_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 callers
Method
transpile_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 callers
Method
transpile_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 callers
Method
add_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 callers
Method
add_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 callers
Method
add_use
(&mut self, library: &str)
crates/papyrus/src/miden_generator.rs:1105
↓ 1 callers
Method
add_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 callers
Method
begin_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 callers
Function
convert_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 callers
Method
drop_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 callers
Method
dup_from_offset
TODO: explain the function and then explain what an offset is
crates/papyrus/src/miden_generator.rs:302
↓ 1 callers
Function
expressions_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 callers
Method
get_inferred_type
(&self)
crates/papyrus/src/types.rs:33
↓ 1 callers
Method
load_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 callers
Method
miden_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 callers
Function
parse_case
Parses a case statement into an Expr
crates/papyrus/src/parser.rs:209
↓ 1 callers
Function
parse_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 callers
Function
parse_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 callers
Method
pop_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 callers
Method
push_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 callers
Function
read_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 callers
Function
split_u256_to_u32s
(x: &U256)
crates/papyrus/src/utils.rs:26
↓ 1 callers
Function
start_repl
(functions_file: Option<String>, stack_string: Option<String>)
bin/repl/src/repl.rs:73
↓ 1 callers
Method
stop_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 callers
Method
transpile_break
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:958
↓ 1 callers
Method
transpile_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 callers
Method
transpile_continue
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:964
↓ 1 callers
Method
transpile_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 callers
Method
transpile_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 callers
Method
transpile_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 callers
Method
transpile_leave
TODO: update placeholder
crates/papyrus/src/miden_generator.rs:961
↓ 1 callers
Method
transpile_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 callers
Method
transpile_repeat
Transpiles a repeat expression
crates/papyrus/src/miden_generator.rs:661
↓ 1 callers
Method
transpile_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 callers
Method
transpile_variable_declaration
Transpile a variable declaration. Ex. let x := 1000 or let x:u256 := 1000
crates/papyrus/src/miden_generator.rs:558
↓ 1 callers
Method
transpile_variable_reference
FIXME: Still needs comments see push identifier to top
crates/papyrus/src/miden_generator.rs:919
↓ 1 callers
Method
update_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 callers
Method
visit_expr
(&mut self, _expr: Expr)
crates/papyrus/src/ast_optimization.rs:76
↓ 1 callers
Function
walk_expr
TODO: it would be nice if there wasn't so much cloning in here
crates/papyrus/src/ast_optimization.rs:201
↓ 1 callers
Method
walk_expr
(&mut self, expr: Expr)
crates/papyrus/src/type_inference.rs:28
↓ 1 callers
Function
write_yul_to_masm
(yul_file: YulFile)
bin/scribe/src/main.rs:12
Function
addition
(x: U256, y: U256)
crates/miden-integration-tests/tests/quickcheck_tests.rs:87
Method
arbitrary
(g: &mut Gen)
crates/miden-integration-tests/tests/quickcheck_tests.rs:19
Function
auto_and
(x: U256, y: U256)
crates/miden-integration-tests/tests/quickcheck_tests.rs:177
Function
debug_execution
()
crates/papyrus/src/executor.rs:24
Method
default
()
crates/papyrus/src/miden_generator.rs:1117
Function
double_reversal_is_identity
(xs: Vec<isize>)
crates/miden-integration-tests/tests/quickcheck_tests.rs:249
Method
fmt
Print TypedIdentifier
crates/papyrus/src/types.rs:471
Method
fmt
(&self, f: &mut std::fmt::Formatter<'_>)
crates/papyrus/src/miden_generator.rs:75
Function
format_inferred_types
Convert a Vec of YulType to a string
crates/papyrus/src/types.rs:496
Method
from
(typed_identifier: &TypedIdentifier)
crates/papyrus/src/miden_generator.rs:61
Method
from_annotation
Converts a string representation of u32 or u256 to a YulType
crates/papyrus/src/types.rs:53
Method
get_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
Function
greater_than
(x: U256Small, y: U256Small)
crates/miden-integration-tests/tests/quickcheck_tests.rs:133
Function
greater_than_or_equal_to
(x: U256Small, y: U256Small)
crates/miden-integration-tests/tests/quickcheck_tests.rs:155
Function
inferred_type_to_string
Convert YulType to string
crates/papyrus/src/types.rs:488
next →
1–100 of 181, ranked by callers