separated state machine generation into an abstract class

This commit is contained in:
ParkerTenBroeck 2025-04-25 17:03:46 -04:00
parent c3532507f3
commit 9b0a9b7ad2
12 changed files with 379 additions and 286 deletions

View file

@ -1,6 +1,8 @@
import generator.RT;
import generator.gen.Gen;
import java.util.function.Supplier;
public class Main implements Runnable {
public static void main(String[] args) {
RT.runWithGeneratorSupport(Main.class);
@ -10,6 +12,23 @@ public class Main implements Runnable {
public void run() {
// await();
lexer();
// lambda();
}
void lambda(){
var gen = ((Supplier<Gen<Integer, String>>)() -> {
Gen.yield(12);
return Gen.ret("hello");
}).get();
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 await(){
@ -22,8 +41,11 @@ public class Main implements Runnable {
break;
}
}
Runnable meow = () -> {};
}
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});