[][src]Struct passerine::compiler::desugar::Transformer

pub struct Transformer { /* fields omitted */ }

Applies compile-time transformations to the AST

Implementations

impl Transformer[src]

pub fn new() -> Transformer[src]

pub fn walk(&mut self, ast: Spanned<AST>) -> Result<Spanned<CST>, Syntax>[src]

desugars an AST into a CST This function will become more complicated later on once macros are introduced, but right now it's basically a 1 to 1 translation

pub fn symbol(&mut self, ast: Spanned<AST>) -> Result<CST, Syntax>[src]

pub fn call(&mut self, f: Vec<Spanned<AST>>) -> Result<CST, Syntax>[src]

Recursively build up a call from a flat form. Basically turns (a b c d) into (((a b) c) d).

pub fn form(&mut self, form: Vec<Spanned<AST>>) -> Result<CST, Syntax>[src]

pub fn composition(
    &mut self,
    argument: Spanned<AST>,
    function: Spanned<AST>
) -> Result<CST, Syntax>
[src]

Desugar a function composition. A composition takes the form c |> b |> a and is left-associative (c |> b) |> a. When desugared, the above is equivalent to the call a b c.

pub fn block(&mut self, b: Vec<Spanned<AST>>) -> Result<CST, Syntax>[src]

pub fn assign(
    &mut self,
    p: Spanned<ASTPattern>,
    e: Spanned<AST>
) -> Result<CST, Syntax>
[src]

TODO: implement full pattern matching

pub fn lambda(
    &mut self,
    p: Spanned<ASTPattern>,
    e: Spanned<AST>
) -> Result<CST, Syntax>
[src]

TODO: implement full pattern matching

pub fn rule(
    &mut self,
    arg_pat: Spanned<ArgPat>,
    tree: Spanned<AST>
) -> Result<CST, Syntax>
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.