Expand description
EVM bytecode assembler.
Structsยง
- Inst ๐
- A parsed instruction.
- Macro
Def ๐ - 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.
- Push
Kind ๐ - How the push width is determined.
- Token
Kind ๐ - 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
#definedirective body (everything after#define) into the macro table. - parse_
items ๐ - Parse a token stream into items.
- preprocess ๐
- Preprocess source text: extract
#definedirectives (line-scoped), tokenize the rest, then expand macro invocations on the token stream. - resolve_
imm ๐ - Resolve an immediate value, substituting label PCs.