The Squirrel interpreter. See http://www.squirrel-lang.org/

Dependents:   Squirrel

Committer:
jhnwkmn
Date:
Tue Dec 16 11:39:42 2014 +0000
Revision:
3:7268a3ceaffc
Parent:
0:97a4f8cc534c
Accepts \r as line terminator as well.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhnwkmn 0:97a4f8cc534c 1 function state1()
jhnwkmn 0:97a4f8cc534c 2 {
jhnwkmn 0:97a4f8cc534c 3 ::suspend("state1");
jhnwkmn 0:97a4f8cc534c 4 return state2();
jhnwkmn 0:97a4f8cc534c 5 }
jhnwkmn 0:97a4f8cc534c 6
jhnwkmn 0:97a4f8cc534c 7 function state2()
jhnwkmn 0:97a4f8cc534c 8 {
jhnwkmn 0:97a4f8cc534c 9 ::suspend("state2");
jhnwkmn 0:97a4f8cc534c 10 return state3();
jhnwkmn 0:97a4f8cc534c 11 }
jhnwkmn 0:97a4f8cc534c 12
jhnwkmn 0:97a4f8cc534c 13 function state3()
jhnwkmn 0:97a4f8cc534c 14 {
jhnwkmn 0:97a4f8cc534c 15 ::suspend("state3");
jhnwkmn 0:97a4f8cc534c 16 return state1();
jhnwkmn 0:97a4f8cc534c 17 }
jhnwkmn 0:97a4f8cc534c 18
jhnwkmn 0:97a4f8cc534c 19 local statethread = ::newthread(state1)
jhnwkmn 0:97a4f8cc534c 20
jhnwkmn 0:97a4f8cc534c 21 ::print(statethread.call()+"\n");
jhnwkmn 0:97a4f8cc534c 22
jhnwkmn 0:97a4f8cc534c 23 for(local i = 0; i < 10000; i++)
jhnwkmn 0:97a4f8cc534c 24 ::print(statethread.wakeup()+"\n");