separated functionality of generator state machine builders into separate classes

This commit is contained in:
Parker TenBroeck 2025-04-24 20:36:55 -04:00
parent 10d07e2c80
commit c3cb7cb884
7 changed files with 449 additions and 285 deletions

View file

@ -8,6 +8,23 @@ public class Main implements Runnable {
@Override
public void run() {
await();
// lexer();
}
void await(){
var gen = Examples.awaitTest(10);
while(true) {
var next = gen.next();
if(next instanceof Gen.Yield(var e)) System.out.println(e);
else if(next instanceof Gen.Ret(var ret)){
System.out.println(ret);
break;
}
}
}
void lexer(){
var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)");
// var gen = Examples.test(new double[]{1,2,3,4});
while(gen.next() instanceof Gen.Yield(var tok)) {