pub enum Expr {
Const(Array, Span),
Param(usize, Span),
Name(String, Span),
Assign {
name: String,
value: Box<Expr>,
scope: Scope,
span: Span,
},
AmendIndex {
name: String,
slots: Vec<Option<Expr>>,
value: Box<Expr>,
origin: i64,
scope: Scope,
span: Span,
},
Control(Box<Control>, Span),
Monad {
verb: Verb,
y: Box<Expr>,
span: Span,
},
Dyad {
verb: Verb,
x: Box<Expr>,
y: Box<Expr>,
span: Span,
},
PrintPass {
value: Box<Expr>,
span: Span,
},
Fused {
kernel: FusedKernel,
inputs: Vec<Expr>,
orig: Box<Expr>,
span: Span,
},
Elided {
orig: Vec<Expr>,
span: Span,
},
VerbDef {
name: String,
verb: Verb,
span: Span,
},
}Variants§
Const(Array, Span)
Param(usize, Span)
A bound parameter, by position in Program::params.
Name(String, Span)
A name assigned earlier in the same program.
Assign
Yields the assigned value in expression position; a whole sentence that is an assignment displays nothing at the top level.
AmendIndex
APL A[i;j]←v: the named value with the part the brackets select
replaced. The name is read, a copy is written, and the copy takes
the name’s place. An elided slot selects its whole axis.
Control(Box<Control>, Span)
A control-flow sentence (J’s control words, APL’s :If family).
Its value is the value of the last sentence the branch it chose
executed. Only an explicit definition’s body holds one: neither
language allows a control word outside a definition.
Monad
Dyad
PrintPass
APL ⎕← expr: print, pass the value through.
Fused
A chain of elementwise verbs evaluated in one blockwise pass (see
crate::fuse). inputs are the subtrees the chain reads; orig
is the chain itself, which runs whenever the kernel declines.
Elided
A marker the fusion pass leaves when it has rewritten the program
across sentence boundaries: it does nothing and yields nothing, and
carries the sentences the program was compiled from so that
crate::fuse::unfused can rebuild them.
VerbDef
A sentence that named a verb (J mean =. +/ % #). The frontend has
already substituted the verb into the later sentences that use the
name, so nothing runs here; the node is kept so that the sentence
still yields no value, and so that Program::explain can show it.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Expr
impl !UnwindSafe for Expr
impl Freeze for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more