[][src]Enum passerine::compiler::ast::AST

pub enum AST {
    Symbol(String),
    Data(Data),
    Block(Vec<Spanned<AST>>),
    Form(Vec<Spanned<AST>>),
    Pattern(ASTPattern),
    ArgPat(ArgPat),
    Assign {
        pattern: Box<Spanned<ASTPattern>>,
        expression: Box<Spanned<AST>>,
    },
    Lambda {
        pattern: Box<Spanned<ASTPattern>>,
        expression: Box<Spanned<AST>>,
    },
    Composition {
        argument: Box<Spanned<AST>>,
        function: Box<Spanned<AST>>,
    },
    Print(Box<Spanned<AST>>),
    Label(StringBox<Spanned<AST>>),
    Syntax {
        arg_pat: Box<Spanned<ArgPat>>,
        expression: Box<Spanned<AST>>,
    },
}

Represents an item in a sugared AST. Which is the direct result of parsing Each syntax-level construct has it's own AST variant. When macros are added, for instance, they will be here, But not in the CST, which is the desugared syntax tree, and represents language-level constructs

Variants

Symbol(String)
Data(Data)
Block(Vec<Spanned<AST>>)
Form(Vec<Spanned<AST>>)
Pattern(ASTPattern)
ArgPat(ArgPat)
Assign

Fields of Assign

pattern: Box<Spanned<ASTPattern>>expression: Box<Spanned<AST>>
Lambda

Fields of Lambda

pattern: Box<Spanned<ASTPattern>>expression: Box<Spanned<AST>>
Composition

Fields of Composition

argument: Box<Spanned<AST>>function: Box<Spanned<AST>>
Print(Box<Spanned<AST>>)
Label(StringBox<Spanned<AST>>)
Syntax

Fields of Syntax

arg_pat: Box<Spanned<ArgPat>>expression: Box<Spanned<AST>>

Implementations

impl AST[src]

pub fn assign(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST[src]

Shortcut for creating an AST::Assign variant.

pub fn lambda(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST[src]

Shortcut for creating an AST::Lambda variant.

pub fn composition(argument: Spanned<AST>, function: Spanned<AST>) -> AST[src]

pub fn syntax(arg_pat: Spanned<ArgPat>, expression: Spanned<AST>) -> AST[src]

Shortcut for creating an AST::Syntax variant. i.e. a macro definition

Trait Implementations

impl Clone for AST[src]

impl Debug for AST[src]

impl PartialEq<AST> for AST[src]

impl StructuralPartialEq for AST[src]

impl TryFrom<AST> for ASTPattern[src]

type Error = String

The type returned in the event of a conversion error.

impl TryFrom<AST> for ArgPat[src]

type Error = String

The type returned in the event of a conversion error.

Auto Trait Implementations

impl !RefUnwindSafe for AST

impl !Send for AST

impl !Sync for AST

impl Unpin for AST

impl !UnwindSafe for AST

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.