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
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
use vm_core::{
code_blocks::CodeBlock,
crypto,
errors::KernelError,
utils::{
collections::{btree_map, BTreeMap},
ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, SliceReader,
},
CodeBlockTable, Felt, Kernel, Operation, Program, StarkField, ONE, ZERO,
};
mod library;
pub use library::{Library, LibraryNamespace, LibraryPath, MaslLibrary, Module, Version};
mod procedures;
use procedures::{CallSet, NamedProcedure, Procedure};
pub use procedures::{ProcedureId, ProcedureName};
pub mod ast;
use ast::{NAMESPACE_LABEL_PARSER, PROCEDURE_LABEL_PARSER};
mod tokens;
use tokens::{Token, TokenStream};
mod errors;
pub use errors::{AssemblyError, LabelError, LibraryError, ParsingError, PathError};
mod assembler;
pub use assembler::{Assembler, AssemblyContext};
#[cfg(test)]
mod tests;
// RE-EXPORTS
// ================================================================================================
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;
/// The maximum length (in bytes) of a constant, procedure, or library namespace labels.
const MAX_LABEL_LEN: usize = 255;
/// The required length of the hexadecimal representation for an input value when more than one hex
/// input is provided to `push` masm operation without period separators.
const HEX_CHUNK_SIZE: usize = 16;