Skip to main content

Module asm

Module asm 

Source
Expand description

EVM bytecode assembler.

Structsยง

Inst ๐Ÿ”’
A parsed instruction.
MacroDef ๐Ÿ”’
A macro definition: parameter names and body tokens.
Token ๐Ÿ”’
A token produced by the tokenizer.
Tokenizer ๐Ÿ”’
Character-by-character tokenizer over source text.

Enumsยง

Imm ๐Ÿ”’
An immediate value.
Item ๐Ÿ”’
A parsed item from the source.
PushKind ๐Ÿ”’
How the push width is determined.
TokenKind ๐Ÿ”’
The kind of a Token.

Functionsยง

builtin_macros ๐Ÿ”’
Builtin macros available in all assembly sources.
emit_inst_no_labels ๐Ÿ”’
Emit a single instruction (no-label fast path).
encode_imm ๐Ÿ”’
Encode a U256 as big-endian bytes with optional fixed size.
expand_macros ๐Ÿ”’
Expand macro invocations in a token stream.
expect_imm ๐Ÿ”’
Consume the next token as an immediate (number or label ref).
expect_number_u8 ๐Ÿ”’
Consume the next token as a number and convert to u8.
layout_and_emit ๐Ÿ”’
Layout items with label resolution (fixed-point for auto-sized label pushes) and emit bytecode.
min_push_width ๐Ÿ”’
Compute the minimum push width for a value (0 for zero, 1 for 1..=0xff, etc.).
parse_asm
Parse EVM assembly from a string into bytecode.
parse_define ๐Ÿ”’
Parse a #define directive body (everything after #define) into the macro table.
parse_items ๐Ÿ”’
Parse a token stream into items.
preprocess ๐Ÿ”’
Preprocess source text: extract #define directives (line-scoped), tokenize the rest, then expand macro invocations on the token stream.
resolve_imm ๐Ÿ”’
Resolve an immediate value, substituting label PCs.