Files @ b4a9c41d70da
Branch filter:

Location: CSY/reowolf/src/protocol/eval/mod.rs

b4a9c41d70da 1.3 KiB application/rls-services+xml Show Annotation Show as Raw Download as Raw
MH
Initial casting implementation

Explicit casts can be performed with the syntax 'cast<type>(input)'
and implicit casts can be performed with the syntax 'cast(input)'
where the output type is determined by inference.

To prevent casting shenanigans we only allow casting of primitive
types and of types to themselves (essentially creating a copy).
/// eval
///
/// Evaluator of the generated AST. Note that we use some misappropriated terms
/// to describe where values live and what they do. This is a temporary
/// implementation of an evaluator until some kind of appropriate bytecode or
/// machine code is generated.
///
/// Code is always executed within a "frame". For Reowolf the first frame is
/// usually an executed component. All subsequent frames are function calls.
/// Simple values live on the "stack". Each variable/parameter has a place on
/// the stack where its values are stored. If the value is not a primitive, then
/// its value will be stored in the "heap". Expressions are treated differently
/// and use a separate "stack" for their evaluation.
///
/// Since this is a value-based language, most values are copied. One has to be
/// careful with values that reside in the "heap" and make sure that copies are
/// properly removed from the heap..
///
/// Just to reiterate: this is a temporary wasteful implementation. A proper
/// implementation would fully fill out the type table with alignment/size/
/// offset information and lay out bytecode.

pub(crate) mod value;
pub(crate) mod store;
pub(crate) mod executor;
pub(crate) mod error;

pub use error::EvalError;
pub use value::{Value, ValueGroup};
pub(crate) use store::{Store};
pub use executor::{EvalContinuation, Prompt};