trealla
submillisecond
trealla | submillisecond | |
---|---|---|
13 | 14 | |
232 | 898 | |
2.6% | 0.3% | |
10.0 | 4.2 | |
2 days ago | about 2 months ago | |
C | Rust | |
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
-
Trealla Prolog binary releases (Linux, MacOS, Windows, WASM)
Update: we've got official releases now! https://github.com/trealla-prolog/trealla/releases
-
PHP: Prolog Home Page
Hey, this is mine. Thanks for submitting it. I'll answer some questions.
> Why?
I ported Trealla Prolog to WASM (WASI) and I was looking for something useful to test it against. I found Spin, which can run WASM+CGI, and landed on this. Making this project exposed a number of bugs in my port that have now been fixed, so consumers of more useful projects[1][2] benefit as well. Also, PHP style templates are just fun! There's something valuable to just being able to shove a little bit of code inside some HTML and get it up on the internet.
I started my webdev journey with PHP many many years ago, and it's nice to revisit it from a different perspective. I don't use the real (elephant) PHP anymore, but I've gained a newfound appreciation for how fun its quick & dirty development style is.
I hope this project can serve as an example of how to use Prolog for fun things. It does showcase some of the cooler dynamic aspects of the language, and the PHP parsing code is like 10 lines of DCG.
> Is it a joke?
Yes and no. The name is certainly a joke. I was pondering what 'Prolog on Rails' might be and thought calling it PHP would be funny. This led to the PHP-style templates which were quick to implement and pretty powerful. Despite the humorous presentation, it does actually work.
> Can you use Prolog for web services?
Yes! For example, SWI has a mature HTTP package: https://www.swi-prolog.org/pldoc/doc_for?object=section(%27p.... It's used to power SWISH, an online Prolog code sharing thing: https://swish.swi-prolog.org/
> Next steps?
I would like to support persistence somehow. I think it'd be really cool if you could use Prolog's dynamic database[3] as a persistent store. Spin has components for Postgres and Redis so it shouldn't be too hard to implement, but I lose the WASI compatibility if I do that... which means I can't use the binary from WAPM, etc.
I would also like to experiment with running Trealla on Cloudflare Workers. I have another project, worker-prolog[4], which uses Tau Prolog (a Prolog written in Javascript) on Workers.
On a somewhat related note, I've also been playing around with Cosmopolitan libc[5]. I got Trealla to compile to an APE executable but there's some issues with the embedded Prolog libraries getting garbled, so I need to improve my GDB skills and figure out what's going on there.
Finally, I'd like to say thanks to Andrew Davison (@infradig on GitHub), the author of Trealla Prolog, for letting me add WASM support to his project and helping me with lots of things. For example, PHP led to Andrew implementing improvements for using DCGs to parse Prolog terms, which is now super fast[6]!
[1]: https://github.com/guregu/trealla-js
[2]: https://github.com/trealla-prolog/go
[3]: https://www.swi-prolog.org/pldoc/man?predicate=assertz/1
[4]: https://github.com/guregu/worker-prolog
[5]: https://justine.lol/cosmopolitan/
[6]: https://github.com/trealla-prolog/trealla/issues/53
-
Lunatic: Erlang-Inspired Runtime for WebAssembly
Are you aware trealla can already target WASI as a target? (Just fyi in case you weren't)
https://github.com/trealla-prolog/trealla#webassembly-wasi
-
Trealla – A compact, efficient Prolog interpreter written in plain-old C
Seems they just recreated the git repo to clear out ~1gb of history. https://github.com/trealla-prolog/trealla/issues/1
-
Small Prologs engine for app
There is currently no API to query results, so I would be interested in what you are doing. Contact me on github.com/infradig/trealla if you'd prefer.
-
N-Prolog version 1.8
u/mtriska inadvertently reminded me - I forgot to mention that Trealla Prolog is a small, (soon-to-be) ISO-compliant Prolog interpreter written in C. As such, it should compile to WASM.
- Trealla – compact, efficient Prolog interpreter written in plain-old C
submillisecond
-
What would you rewrite in Rust?
I believe that https://github.com/lunatic-solutions/submillisecond wants to be that.
-
From Erlang to Rust and Lunatic
Lunatic is exciting, I'm keeping an eye especially on the submillisecond web framework that targets wasm: https://github.com/lunatic-solutions/submillisecond
-
Lunatic is an Erlang-inspired runtime for WebAssembly
- https://github.com/lunatic-solutions/submillisecond/tree/mai...
-
Is Rust Ready for the Web Yet?
Lunatic runtime for Rust to avoid the async parts might become quite nice in the future: https://github.com/lunatic-solutions/submillisecond
Not sure what it might take for someone to write database connectors for it but it does look promising.
- Submillisecond: A lunatic web framework for the Rust language
-
Htmx, WebAssembly, Rust, ServiceWorker Proof of Concept
What a coincidence, I was just discussing on discord a similar approach for our Rust web framework submillisecond[0].
Submillisecond uses lunatic to run Rust code compiled to WebAssembly on the backend. We are working on a LiveView-like library now. And one thing I would love to give developers for free is an offline-first experience. You write everything in Rust, compile it to WebAssembly, run it as a regular backend on lunatic, but also allow for moving the whole server into the browser for a offline experience. If SQLite is used for the DB, it could also potentially run in the browser.
This doesn't need to move the whole app into the browser, but could do so just for more latency sensitive workloads that don't fit LiveView well. Like form validation on every keypress, etc.
[0]: https://github.com/lunatic-solutions/submillisecond
- Submillisecond Web Framework
- A lunatic web framework for the Rust language
-
Lunatic: Erlang-Inspired Runtime for WebAssembly
Web socket support was added a few days ago[0], but it's still not part of a release. I will probably push out alpha1 tomorrow including it and a few other changes.
[0]: https://github.com/lunatic-solutions/submillisecond/pull/78
What are some alternatives?
pyswip - PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
yew-beyond-hello-world - yew rust tutorial
php - Prolog Home Page
WeightTracker - Back end for saving data for weight tracker.
packages-http - The SWI-Prolog HTTP server and client libraries
wasm-service - HTMX, WebAssembly, Rust, ServiceWorkers
ciao - Ciao is a modern Prolog implementation that builds up from a logic-based simple kernel designed to be portable, extensible, and modular.
Soccer - Tracker for players play time
trealla-js - Trealla Prolog for the web
swup - Versatile and extensible page transition library for server-rendered websites 🎉
go - Trealla Prolog embedded in Go using WASM
lunatic - Lunatic is an Erlang-inspired runtime for WebAssembly