go-ethereum: github.com/ethereum/go-ethereum/core/asm Index | Files

package asm

import "github.com/ethereum/go-ethereum/core/asm"

Provides support for dealing with EVM assembly instructions (e.g., disassembling them).


Package Files

asm.go compiler.go lexer.go


const (
    Numbers            = "1234567890"                                           // characters representing any decimal number
    HexadecimalNumbers = Numbers + "aAbBcCdDeEfF"                               // characters representing any hexadecimal
    Alpha              = "abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUWVXYZ" // characters representing alphanumeric

func Disassemble Uses

func Disassemble(script []byte) ([]string, error)

Return all disassembled EVM instructions in human-readable format.

func Lex Uses

func Lex(source []byte, debug bool) <-chan token

lex lexes the program by name with the given source. It returns a channel on which the tokens are delivered.

func NewInstructionIterator Uses

func NewInstructionIterator(code []byte) *instructionIterator

Create a new instruction iterator.

func PrintDisassembled Uses

func PrintDisassembled(code string) error

Pretty-print all disassembled EVM instructions to stdout.

type Compiler Uses

type Compiler struct {
    // contains filtered or unexported fields

Compiler contains information about the parsed source and holds the tokens for the program.

func NewCompiler Uses

func NewCompiler(debug bool) *Compiler

newCompiler returns a new allocated compiler.

func (*Compiler) Compile Uses

func (c *Compiler) Compile() (string, []error)

Compile compiles the current tokens and returns a binary string that can be interpreted by the EVM and an error if it failed.

compile is the second stage in the compile phase which compiles the tokens to EVM instructions.

func (*Compiler) Feed Uses

func (c *Compiler) Feed(ch <-chan token)

Feed feeds tokens in to ch and are interpreted by the compiler.

feed is the first pass in the compile stage as it collects the used labels in the program and keeps a program counter which is used to determine the locations of the jump dests. The labels can than be used in the second stage to push labels and determine the right position.

Package asm imports 9 packages (graph) and is imported by 6 packages. Updated 2019-12-02. Refresh now. Tools for package owners.