vinipsmaker
return return 1;
return itself isn't an expression (it's a statement) so it can't be used in places that expect expressions (such as the "argument" to return itself).However extending Pratt parsing to handle this case is trivial: https://vinipsmaker.github.io/blog/article/statements-in-pra...
It's still an extension so not really pure Pratt parsing IMO (other practitioners of Pratt parsing disagree with me).
This is more of a question language than a parser language. If you have a language that requires a Turing-complete parser than you gave up on grammar. You can use Pratt to parse languages that have grammars.
The language that I'm implementing has procedural macros (hence the parser is Turing-complete). However it has some "structure" that I can port to a tree-sitter parser. The tree-sitter parser for my language won't be 100% accurate, but it'll capture the most important structures.
I was using Pratt parsing for almost a year in a macro-heavy language that I've been developing before finally sitting down on my chair to write my thoughts on Pratt parsing. Code is closed right now because I don't want LLMs training on my code before 0.1, but I'll open source it again later.
Happy to answer questions.
Pratt parsing is a black box
I've tried my best to make the text hopefully useful to programmers from any language so the few Lua samples in the article are only there to illustrate the concepts. Some of the topics found in the article:
* UNIX basics focusing on Linux and FreeBSD. * General sandboxing concepts and how to apply them in Linux and FreeBSD. * The actor model and capability-based security (and how to combine them). * Oblivious sandboxing to run/reuse unmodified code within sandboxes. * Threat models. * Seccomp, Landlock, Capsicum, ... * A few guidelines for the C programmer.
• I was developing an example Telegram client where components would run on sandboxes to dodge some attacks (such as the recent bug found on WebP that is used for Telegram stickers).
• Creating sandboxes using Linux namespaces (available from emilua 0.4) proved to be too cumbersome.
• I'm developing support for new sandboxing technologies that I hope to be easier to use.
•• Landlock (Linux): already usable from branch 0.5.
•• Capsicum (FreeBSD): in development.
• The lack of an (emilua) ecosystem is a real problem for new (emilua) programs, so I'll develop something like <http://lua-users.org/wiki/LunaticPython> that also translates Python promises from Python3's asyncio to fiber suspension/wakeup in Lua land and customizes the Python3's asyncio event loop to use the same Boost.Asio instances. This support will depend on <https://lwn.net/Articles/941090/> as there would be 1 Python subinterpreter for each Lua VM.
• I plan to do something similar to the previous item to NodeJS as well.
• Version 0.5 is mostly ready and I expect a release by December. The focus of this release is refactoring stuff to make it easier to develop a package manager for emilua.