[−][src]Struct passerine::compiler::desugar::Transformer
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]
&mut self,
argument: Spanned<AST>,
function: Spanned<AST>
) -> Result<CST, Syntax>
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]
&mut self,
p: Spanned<ASTPattern>,
e: Spanned<AST>
) -> Result<CST, Syntax>
TODO: implement full pattern matching
pub fn lambda(
&mut self,
p: Spanned<ASTPattern>,
e: Spanned<AST>
) -> Result<CST, Syntax>
[src]
&mut self,
p: Spanned<ASTPattern>,
e: Spanned<AST>
) -> Result<CST, Syntax>
TODO: implement full pattern matching
pub fn rule(
&mut self,
arg_pat: Spanned<ArgPat>,
tree: Spanned<AST>
) -> Result<CST, Syntax>
[src]
&mut self,
arg_pat: Spanned<ArgPat>,
tree: Spanned<AST>
) -> Result<CST, Syntax>
Auto Trait Implementations
impl !RefUnwindSafe for Transformer
impl !Send for Transformer
impl !Sync for Transformer
impl Unpin for Transformer
impl !UnwindSafe for Transformer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,