trealla-spin
trealla
trealla-spin | trealla | |
---|---|---|
2 | 5 | |
3 | 5 | |
- | - | |
3.0 | 10.0 | |
about 1 year ago | 11 days ago | |
Prolog | C | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
trealla-spin
-
Prolog: Writing a Server-side App in WebAssembly using Spin
This uses the amazing Prolog Spin template and the Traella Prolog interpreter. I am a huge fan of this template because, as a newcomer to Prolog, it got me started right away.
- Trealla Prolog Templates for Spin
trealla
-
Prolog: Writing a Server-side App in WebAssembly using Spin
spin_version = "1" authors = ["Matt Butcher "] description = "" name = "hello-prolog" trigger = { type = "http", base = "/" } version = "0.1.0" [[component]] id = "hello-prolog" files = [ { source = "./src", destination = "/" } ] # for outgoing HTTP (see spin:http_fetch/3) allowed_http_hosts = [] # "insecure:allow-all" is a special unsafe value to allow any host # access to key-value stores (see spin:store_* predicates) key_value_stores = ["default"] [component.source] url = "https://github.com/guregu/trealla/releases/download/v0.14.4/libtpl-spin.wasm" digest = "sha256:6adb31903bc55e2b5ef3db1619727596f0b08bb789ff6c42df458d0209228677" [component.trigger] route = "/..."
-
Why did Prolog lose steam? (2010)
I think that Prolog will rise again. If you have an hour to kill, check out this video introduction by Markus Triska about what makes Prolog unique: https://www.youtube.com/watch?v=8XUutFBbUrg
Recently I have been working on getting Trealla Prolog to run in WebAssembly. Support is quite good now, with an easy-to-use JS library[1], Go library[2], and is now one of the best-supported languages for the Spin runtime[3]. I think it's particularly nice for validations, you can write some simple Prolog rules and run the same code on the client and the server now. I would like to explore this more with a dedicated library at some point. Built-in features like DCGs make parsing/generating all kinds of data trivial. I love it.
I think the biggest barrier to Prolog adoption is that it has a really steep learning curve, and most people get burnt by half-assed introductions in college that tick the 'talked about logic programming' box in the syllabus. You really have to think in a completely different way to write a good Prolog program. But, once you get the right mindset, it makes solving complex problems incredibly easy.
I don't really buy the argument that Datalog is enough. Most Datalog implementations I've seen hack on a bunch of extensions to do things like list membership. It would be awesome to see some serious effort put into an efficient Prolog-based database. The closest thing I can think of is TerminusDB, which I've never used but I wish I could convince my company to try it out ;).
My dream is to have some kind of magical serverless persistent Prolog interpreter in the cloud. That's where I hope to take this Wasm stuff at some point. Can you imagine how powerful it would be to use Prolog instead of GraphQL or whatever? Prolog is IMO the perfect language for querying things, with a 1:1 correspondence to how you write the data. It's like SQL without all the ugly bits (I like SQL too, of course). If this sounds cool to you, check out the paper/book on Web Prolog[4] which is a fascinating dive into what a Prolog-based networked query system could look like.
[1]: http://github.com/guregu/trealla-js
[2]: http://github.com/trealla-prolog/go
[3]: https://github.com/guregu/trealla#spin-components
[4]: https://github.com/Web-Prolog/swi-web-prolog/raw/master/book...
- Trealla Prolog binary releases (Linux, MacOS, Windows, WASM)
-
Wasmer 3.0
Honestly I can't really say (I just ported it to WASM :-)), but here's more or less the start of the query loop: https://github.com/guregu/trealla/blob/main/src/query.c#L173...
I believe it's a bytecode but I know that function pointers are involved at least with the built-in predicates (see predicates.c).
-
Trealla – A compact, efficient Prolog interpreter written in plain-old C
I think it's a mistake, probably reorganizing things at the moment. You can find a slightly outdated fork here: https://github.com/guregu/trealla
What are some alternatives?
problog - ProbLog is a Probabilistic Logic Programming Language for logic programs with probabilities.
wasmer - 🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
pgsql-ivm - IVM (Incremental View Maintenance) development for PostgreSQL
go - Trealla Prolog embedded in Go using WASM
deepproblog - DeepProbLog is an extension of ProbLog that integrates Probabilistic Logic Programming with deep learning by introducing the neural predicate.