package lrgrep

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Lrgrep_support.Code_emitterSource

Emit and link bytecode program

Sourcetype t

A code emitter.

Sourceval make : unit -> t

Create a new emitter

Sourceval position : t -> RT.program_counter

The pc of the next emitted instruction. Starts at 0.

Sourceval emit : t -> RT.program_instruction -> unit

Emit a new instruction

Sourceval emit_yield_reloc : t -> RT.program_counter Stdlib.ref -> unit

Emit a yield instruction to a target that (may) not yet be known. The reference will be read during linking.

Sourceval emit_match_reloc : t -> Lrgrep_support_packer.promise -> unit

Emit a match instruction to a vector that (may) not yet be known. The promise will be resolved during linking.

Produce a final program, with all emitted instructions at the correct positions and reading all pending relocations references.