Module bf::peephole [] [src]

The peephole optimizer, which replaces common loop forms with single (non-Brainfuck) instructions.

In bfi, this is the default final pass if the JIT was not enabled at compile time (with --features=jit). If the JIT is present, the peephole optimizer can be selected as the final path with the --peep flag.

For example, we detect the pattern [-], which decrements the current byte until it reaches zero, and replaces it with the SetZero instruction. See the flat::Instruction enum for a list of the instructions produced by the peephole compiler.

Enums

Statement

Instructions as output by the peephole optimizer.

Functions

compile

Peephole-optimizes run-length encoded AST.

Type Definitions

Program

At this level, a program is a rose tree of statements.