FUNCTIONS ^

This file contains emit functions. Depending on the requested output, the appropriate emit functions are used. Options are:

 -p     for PASM output
 -b     for bytecode output
void print_key(key *k)

Print the key k. The total key is enclosed in square brackets, and different key elements are separated by semicolons. Example:

 ["hi";42]
has two elements: "hi" and 42.

void print_target(target *const t)

Print the target t; if t has a key, that key is printed as well. Examples:

 S1, P1[42]
void print_constant(constant *c)

Print the value of constant c.

void print_expr(lexer_state *const lexer, expression *const expr)

Print the expression expr.

void print_expressions(expression *const expr)

Print the list of expressions pointed to by expr, if expr is not NULL. Expressions are separated by commas.

void print_subs(struct lexer_state *const lexer)

static void emit_pbc_const_arg(lexer_state *const lexer, constant *const c)

Emit a constant argument into the bytecode. An integer is emitted inline in the bytecode; other types are stored in the constant table, and their index in the constant table is emitted into the bytecode.

static void emit_pbc_target_arg(lexer_state *const lexer, target *const t)

Emit the assigned register of target t. The assigned register is stored in the color field, of either the pir_reg or symbol structure, depending on whether t is a register or a symbol, respectively.

static void emit_pbc_label_arg(lexer_state *const lexer, label *const l)

Emit the value of the label offset of label l.

static void emit_pbc_instr(lexer_state *const lexer, instruction *const instr)

Emit PBC for one instruction.

static void emit_pbc_sub(lexer_state *const lexer, subroutine *const sub)

Emit bytecode for the subroutine sub.

void emit_pbc(lexer_state *const lexer)

Generate Parrot Byte Code from the abstract syntax tree. This is the top-level function.


parrot