[−][src]Struct dark_vm::vm::VM
Fields
operand_stack: Stack<Rc<Value>>
Implementations
impl VM
[src]
pub fn new(tokens: VecDeque<Token>) -> Result<VM, Error>
[src]
Constructs a new VM with the specified tokens. The tokens are usually generated through the lexer. Internally, the tokens are converted to different values by the code object.
Arguments
tokens
- The tokens produced by the lexer.
pub fn repl() -> Result<VM, Error>
[src]
Creates a VM in REPL mode.
pub fn load_tokens(&mut self, tokens: VecDeque<Token>) -> Result<(), Error>
[src]
Loads the given tokens into the VM. This function does not change the operand stack or the call stack. This function can be used with the REPL mode to help facilitate a proper REPL experience.
Arguments
tokens
- The tokens to load.
pub fn run(&mut self) -> Result<Option<Rc<Value>>, Error>
[src]
Runs the VM until the end of the code. This function may return an optionally value, representing the value of the last expression. It may also prematurely return an error. This may be updated to return a vector of errors.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for VM
impl !Send for VM
impl !Sync for VM
impl Unpin for VM
impl !UnwindSafe for VM
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,
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.
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>,