miden_assembly/
lib.rs

1#![no_std]
2#![cfg_attr(all(nightly, not(feature = "std")), feature(error_in_core))]
3
4#[macro_use]
5extern crate alloc;
6
7#[cfg(any(test, feature = "std"))]
8extern crate std;
9
10use vm_core::{
11    Felt, ONE, Word, ZERO,
12    crypto::hash::RpoDigest,
13    prettier,
14    utils::{
15        ByteReader, ByteWriter, Deserializable, DeserializationError, DisplayHex, Serializable,
16    },
17};
18
19mod assembler;
20pub mod ast;
21mod compile;
22pub mod diagnostics;
23mod errors;
24mod library;
25mod parser;
26mod sema;
27#[cfg(any(test, feature = "testing"))]
28pub mod testing;
29#[cfg(test)]
30mod tests;
31
32// Re-exported for downstream crates
33
34/// Merkelized abstract syntax tree (MAST) components defining Miden VM programs.
35pub use vm_core::mast;
36pub use vm_core::utils;
37
38pub use self::{
39    assembler::Assembler,
40    compile::{Compile, Options as CompileOptions},
41    diagnostics::{
42        DefaultSourceManager, Report, SourceFile, SourceId, SourceManager, SourceSpan, Span,
43        Spanned,
44    },
45    errors::AssemblyError,
46    library::{
47        KernelLibrary, Library, LibraryError, LibraryNamespace, LibraryPath, LibraryPathComponent,
48        PathError, Version, VersionError,
49    },
50    parser::ModuleParser,
51};
52
53// CONSTANTS
54// ================================================================================================
55
56/// The maximum number of elements that can be popped from the advice stack in a single `adv_push`
57/// instruction.
58const ADVICE_READ_LIMIT: u8 = 16;
59
60/// The maximum number of bits by which a u32 value can be shifted in a bitwise operation.
61const MAX_U32_SHIFT_VALUE: u8 = 31;
62
63/// The maximum number of bits by which a u32 value can be rotated in a bitwise operation.
64const MAX_U32_ROTATE_VALUE: u8 = 31;
65
66/// The maximum number of bits allowed for the exponent parameter for exponentiation instructions.
67const MAX_EXP_BITS: u8 = 64;