Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. type Stack = Vec<i32>;
  2. type NativeWord = fn(&mut Stack);
  3.  
  4. enum ForthWord<'a> {
  5. NativeWord(NativeWord),
  6. CompiledWord(&'a [ForthWord<'a>])
  7. }
  8.  
  9. fn plus(stack: &mut Stack) {
  10. let a = stack.pop().unwrap();
  11. let b = stack.pop().unwrap();
  12. stack.push(a + b)
  13. }
  14.  
  15. fn push1(stack: &mut Stack) {
  16. stack.push(1)
  17. }
  18.  
  19. fn main() {
  20. let push1_word =
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement