/
lib.rs
62 lines (49 loc) · 1.77 KB
/
lib.rs
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
#![no_std]
#![cfg_attr(all(nightly, not(feature = "std")), feature(error_in_core))]
#[macro_use]
extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate std;
use vm_core::{
crypto::hash::RpoDigest,
errors::KernelError,
utils::{
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
},
Felt, Word, ONE, ZERO,
};
use vm_core::{prettier, utils::DisplayHex};
mod assembler;
pub mod ast;
mod compile;
pub mod diagnostics;
mod errors;
pub mod library;
mod parser;
mod sema;
#[cfg(any(test, feature = "testing"))]
pub mod testing;
#[cfg(test)]
mod tests;
pub use self::assembler::{ArtifactKind, Assembler, AssemblyContext};
pub use self::compile::{Compile, Options as CompileOptions};
pub use self::errors::AssemblyError;
pub use self::library::{
Library, LibraryError, LibraryNamespace, LibraryPath, MaslLibrary, PathError, Version,
};
pub use self::parser::{SourceLocation, SourceSpan, Span, Spanned};
/// Re-exported for downstream crates
pub use vm_core::utils;
// CONSTANTS
// ================================================================================================
/// The maximum number of constant inputs allowed for the `push` instruction.
const MAX_PUSH_INPUTS: usize = 16;
/// The maximum number of elements that can be popped from the advice stack in a single `adv_push`
/// instruction.
const ADVICE_READ_LIMIT: u8 = 16;
/// The maximum number of bits by which a u32 value can be shifted in a bitwise operation.
const MAX_U32_SHIFT_VALUE: u8 = 31;
/// The maximum number of bits by which a u32 value can be rotated in a bitwise operation.
const MAX_U32_ROTATE_VALUE: u8 = 31;
/// The maximum number of bits allowed for the exponent parameter for exponentiation instructions.
const MAX_EXP_BITS: u8 = 64;