dart-petitparser
dart-petitparser copied to clipboard
Solving Einstein's Problem with Prolog causes a stack overflow in Dart 2.6 and later
How to solve the Einstein Problem with Prolog and Dart 2.6 or later? Should I use a file based approach for calculation e.g. SQLite?
I think the problem is the recursive use of asynchronous generators. While this yields elegant code, for some reason it also hits some rather strange limitations in the Dart VM. Not sure why it worked in earlier Dart versions? I never reported to the Dart authors, because I couldn't come up with a simple reproducible example. The problem would likely go away when rewriting the unification algorithm in a more manual way. I kept the Einstein example, because I hoped at some point the stack overflow would go away again. I didn't pursue either of the options, because the current code works well for smaller examples and the example is not meant to be a production ready Prolog implementation (that would likely require a lot more work).
Please raise this on dart-lang/sdk and cc me on the bug and I'll hassle the PM about it. This feels like a bug worth chasing