"first" -> joy_first stack expression
"pop" -> joy_pop stack expression
"rest" -> joy_rest stack expression
+ "stack" -> joy_stack stack expression
+ "swaack" -> joy_swaack stack expression
_ -> Err ("Unknown word: " ++ symbol)
Err msg -> Err msg
+joy_stack : JList -> JList -> Result String (JList, JList)
+joy_stack stack expression =
+ Ok ((push_list stack stack), expression)
+
+
+joy_swaack : JList -> JList -> Result String (JList, JList)
+joy_swaack stack expression =
+ case pop_list(stack) of
+ Ok (s, s0) -> Ok ((push_list s0 s), expression)
+ Err msg -> Err msg
+
+
push_int : Int -> JList -> JList
push_int i stack = (JoyInt i) :: stack