Ideas
Here are some features that I strongly consider adding in future releases of Pegase. If they are listed here, it's mainly because I'm not so sure if they are relevant in real use cases, so I'll basically wait and see if there is enough demand before bloating the library with unused gadgets. If you're interested in one of these features, please let me know on GitHub.
- Fatal failures. Whether they're emitted in semantic actions or visitors, failures are emitted as side-effects and don't stop the current process. You could stop everything by throwing an exception, sure. But maybe fatal failures should be treated as first-class citizens. It's unclear whether Pegase should catch exceptions internally and transform them into top-priority semantic failures before short-exiting, or if emitting failures and short-exiting should remain two separate things.
- Cuts for repetitions. The idea would be to have a cut operator, similar to
^
, but to break repetitions (likea+
,a*
, etc.). A sort ofbreak
statement for peg expressions. Peg repetitions are greedy by nature, but this might not always be what you want. - Default values for captures. The syntax would be something like
<id = 0>a
,<id = ${expr}>a
(whereexpr
is a JS expression), etc. The default value would be captured asid
ifa
's value isundefined
. - Semantic predicates.