Interface Kitab\Compiler\Target\Target

interface Target
{
    pub fn compile(File $file);
    pub fn assemble(array $symbols);
}

Define a compilation target.

A compilation target works in two steps:

  1. compile to compile an intermediate representation of a file into the target,
  2. assemble to assemble of the compiled files.

Methods

pub fn compile(File $file)

Compile an intermediate representation of a file into a specific target.

pub fn assemble(array $symbols)

Assemble the compiled files.

This step is important, it can enhance the result based on symbols. When compiling one intermediate representation of a file at a time, not all symbols are present due to the nature of the algorithm. Indeed, each time a file is opened, it is compiled and dropped. Only symbols are kept in a store.

The assemble step is here to complete, or enhance compiled file with the store of symbols.