1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
use vm_core::{
code_blocks::CodeBlock,
utils::{
collections::{BTreeMap, BTreeSet, Vec},
string::{String, ToString},
Box,
},
CodeBlockTable, Felt, Kernel, Operation, Program, StarkField, ONE, ZERO,
};
mod procedures;
pub use procedures::ProcedureId;
use procedures::{CallSet, Procedure};
mod parsers;
pub use parsers::{
parse_module, parse_program, ModuleAst, NamedModuleAst, ProcedureAst, ProgramAst,
};
mod tokens;
use tokens::{Token, TokenStream};
mod errors;
pub use errors::{AssemblyError, LibraryError, ParsingError};
mod assembler;
pub use assembler::Assembler;
#[cfg(test)]
mod tests;
const MODULE_PATH_DELIM: &str = "::";
const MAX_PUSH_INPUTS: usize = 16;
const ADVICE_READ_LIMIT: u8 = 16;
const MAX_U32_SHIFT_VALUE: u8 = 31;
const MAX_U32_ROTATE_VALUE: u8 = 31;
const MAX_EXP_BITS: u8 = 64;
const MAX_PROC_NAME_LEN: u8 = 100;
pub trait ModuleProvider {
fn get_module(&self, id: &ProcedureId) -> Option<NamedModuleAst<'_>>;
}
impl ModuleProvider for () {
fn get_module(&self, _id: &ProcedureId) -> Option<NamedModuleAst<'_>> {
None
}
}
pub trait Library {
type Module;
fn root_ns(&self) -> &str;
fn version(&self) -> &str;
fn get_module(&self, module_path: &str) -> Result<&Self::Module, LibraryError>;
}