pub struct VM {
pub operand_stack: Stack<Rc<Value>>,
/* private fields */
}
Fields§
§operand_stack: Stack<Rc<Value>>
Implementations§
Source§impl VM
impl VM
Sourcepub fn new(tokens: VecDeque<Token>) -> Result<VM, Error>
pub fn new(tokens: VecDeque<Token>) -> Result<VM, Error>
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.
Sourcepub fn load_tokens(&mut self, tokens: VecDeque<Token>) -> Result<(), Error>
pub fn load_tokens(&mut self, tokens: VecDeque<Token>) -> Result<(), Error>
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VM
impl !RefUnwindSafe for VM
impl !Send for VM
impl !Sync for VM
impl Unpin for VM
impl !UnwindSafe for VM
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