pub struct Compiler<'src> { /* private fields */ }Expand description
A compiler for the dice syntax tree, capable of walking the syntax tree and generating intermediate representation (IR) code. The IR code represents the body of a single function.
Implementations§
Trait Implementations§
Source§impl SyntaxTreeVisitor<()> for Compiler<'_>
impl SyntaxTreeVisitor<()> for Compiler<'_>
Source§fn visit_function(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_function(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “function” node in the syntax tree. Read more
Source§fn visit_parameters(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_parameters(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “parameters” node in the syntax tree. Read more
Source§fn visit_parameter(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_parameter(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “parameter” node in the syntax tree. Read more
Source§fn visit_variable(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_variable(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “variable” node in the syntax tree. Read more
Source§fn visit_group(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_group(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “group” node in the syntax tree. Read more
Source§fn visit_range(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_range(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “range” node in the syntax tree. Read more
Source§fn visit_standard_dice(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_standard_dice(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “standard_dice” node in the syntax tree. Read more
Source§fn visit_custom_dice(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_custom_dice(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “custom_dice” node in the syntax tree. Read more
Source§fn visit_custom_faces(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_custom_faces(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “custom_faces” node in the syntax tree. Read more
Source§fn visit_drop_lowest(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_drop_lowest(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “custom_face” node in the syntax tree. Read more
Source§fn visit_drop_highest(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_drop_highest(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “drop_highest” node in the syntax tree. Read more
Source§fn visit_add(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_add(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “add” node in the syntax tree. Read more
Source§fn visit_sub(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_sub(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “sub” node in the syntax tree. Read more
Source§fn visit_mul(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_mul(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “mul” node in the syntax tree. Read more
Source§fn visit_div(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_div(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “div” node in the syntax tree. Read more
Source§fn visit_mod(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_mod(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “mod” node in the syntax tree. Read more
Source§fn visit_exp(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_exp(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit an “exp” node in the syntax tree. Read more
Source§fn visit_neg(&mut self, node: &Node<'_>) -> Result<(), ()>
fn visit_neg(&mut self, node: &Node<'_>) -> Result<(), ()>
Visit a “neg” node in the syntax tree. Read more
Auto Trait Implementations§
impl<'src> Freeze for Compiler<'src>
impl<'src> RefUnwindSafe for Compiler<'src>
impl<'src> Send for Compiler<'src>
impl<'src> Sync for Compiler<'src>
impl<'src> Unpin for Compiler<'src>
impl<'src> UnwindSafe for Compiler<'src>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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