Trait js::front::run::compiler::Compiler[src]

pub trait Compiler<'a, Compiled> {
    fn compile(&'a self, expr: &Expr) -> Compiled { ... }
    fn compile_unary_op(&'a self, _: UnaryOp, _: &Expr) -> Compiled { ... }
    fn compile_bin_op(&'a self, op: BinOp, left: &Expr, right: &Expr) -> Compiled { ... }
    fn compile_num_op(&'a self, _: NumOp, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_bit_op(&'a self, _: BitOp, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_comp_op(&'a self, _: CompOp, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_log_op(&'a self, _: LogOp, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_const(&'a self, _: &Const) -> Compiled { ... }
    fn compile_local(&'a self, _: String) -> Compiled { ... }
    fn compile_block(&'a self, _: Vec<Expr>) -> Compiled { ... }
    fn compile_get_const_field(&'a self, _: &Expr, _: String) -> Compiled { ... }
    fn compile_get_field(&'a self, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_call(&'a self, _: &Expr, _: Vec<Expr>) -> Compiled { ... }
    fn compile_while_loop(&'a self, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_if(&'a self, _: &Expr, _: &Expr, _: Option<Box<Expr>>) -> Compiled { ... }
    fn compile_switch(&'a self, _: &Expr, Vec<(Expr, Vec<Expr>)>, Option<Box<Expr>>) -> Compiled { ... }
    fn compile_object_decl(&'a self, &TreeMap<String, Expr>) -> Compiled { ... }
    fn compile_array_decl(&'a self, Vec<Expr>) -> Compiled { ... }
    fn compile_function_decl(&'a self, _: Option<String>, _: Vec<String>, _: &Expr) -> Compiled { ... }
    fn compile_arrow_function_decl(&'a self, _: Vec<String>, _: &Expr) -> Compiled { ... }
    fn compile_construct(&'a self, _: &Expr, _: Vec<Expr>) -> Compiled { ... }
    fn compile_return(&'a self, _: Option<Box<Expr>>) -> Compiled { ... }
    fn compile_throw(&'a self, _: &Expr) -> Compiled { ... }
    fn compile_assign(&'a self, _: &Expr, _: &Expr) -> Compiled { ... }
    fn compile_var_decl(&'a self, _: Vec<(String, Option<Expr>)>) -> Compiled { ... }
    fn compile_typeof(&'a self, _: &Expr) -> Compiled { ... }
}

A compiler that transforms expressions into their compiled form, typically through a library such as LibJIT or LLVM.

Provided Methods

fn compile(&'a self, expr: &Expr) -> Compiled

Compile an expression

fn compile_unary_op(&'a self, _: UnaryOp, _: &Expr) -> Compiled

Compile a unary operation

fn compile_bin_op(&'a self, op: BinOp, left: &Expr, right: &Expr) -> Compiled

Compile a binary operation

fn compile_num_op(&'a self, _: NumOp, _: &Expr, _: &Expr) -> Compiled

Compile a numeric operation

fn compile_bit_op(&'a self, _: BitOp, _: &Expr, _: &Expr) -> Compiled

Compile a bitwise operation

fn compile_comp_op(&'a self, _: CompOp, _: &Expr, _: &Expr) -> Compiled

Compile a comparitive operation

fn compile_log_op(&'a self, _: LogOp, _: &Expr, _: &Expr) -> Compiled

Compile a logical operation

fn compile_const(&'a self, _: &Const) -> Compiled

Compile a constant

fn compile_local(&'a self, _: String) -> Compiled

Compile a local variable

fn compile_block(&'a self, _: Vec<Expr>) -> Compiled

Compile a block of expressions

fn compile_get_const_field(&'a self, _: &Expr, _: String) -> Compiled

Compile constant field access for an object

fn compile_get_field(&'a self, _: &Expr, _: &Expr) -> Compiled

Compile field access for an object

fn compile_call(&'a self, _: &Expr, _: Vec<Expr>) -> Compiled

Compile a call to a function with some arguments

fn compile_while_loop(&'a self, _: &Expr, _: &Expr) -> Compiled

Compile a while loop

fn compile_if(&'a self, _: &Expr, _: &Expr, _: Option<Box<Expr>>) -> Compiled

Compile an if statement

fn compile_switch(&'a self, _: &Expr, Vec<(Expr, Vec<Expr>)>, Option<Box<Expr>>) -> Compiled

Compile a switch statement

fn compile_object_decl(&'a self, &TreeMap<String, Expr>) -> Compiled

Compile an object declaration

fn compile_array_decl(&'a self, Vec<Expr>) -> Compiled

Compile an array declaration

fn compile_function_decl(&'a self, _: Option<String>, _: Vec<String>, _: &Expr) -> Compiled

Compile a function declaration

fn compile_arrow_function_decl(&'a self, _: Vec<String>, _: &Expr) -> Compiled

Compile an arrow function declaration

fn compile_construct(&'a self, _: &Expr, _: Vec<Expr>) -> Compiled

Compile a construction of an object

fn compile_return(&'a self, _: Option<Box<Expr>>) -> Compiled

Compile a return expression

fn compile_throw(&'a self, _: &Expr) -> Compiled

Compile a throw expression

fn compile_assign(&'a self, _: &Expr, _: &Expr) -> Compiled

Compile an assignment

fn compile_var_decl(&'a self, _: Vec<(String, Option<Expr>)>) -> Compiled

Compile a variable declaration

fn compile_typeof(&'a self, _: &Expr) -> Compiled

Compile a typeof expression

Implementors