-
Notifications
You must be signed in to change notification settings - Fork 35
How does csly compare
Olivier Duhart edited this page Aug 15, 2023
·
2 revisions
There are many parser generators available for C#. Here is how csly compares to some common libraries. Remember this comparison is strongly biased. It simply reflects the motivations behind csly.
ANTLR is the reference for parser generators. It can generate fast parsers for languages ranging from simple DSLs to full-featured languages. Compared to csly:
Pros:
- Powerful and capable: some features have no equivalent in csly.
- It is fast, maybe the fastest!
- Grammar is clearly decoupled and readable.
Cons:
- An extra build step is needed, complicating setup.
- It is not strongly typed, at least as strongly as csly.
Pros:
- Embeddable, you don't need an extra build step.
Cons:
- Despite Linq expressions being similar to (E)BNF syntax, grammar is not as easily readable.
- Monadic parsers may be difficult to grok.
OK that's not a library, but you often find some really simple languages parsed with handmade parsers.
Pros:
- Embedded by nature and no dependencies.
- Really flexible error reporting.
Cons:
- Repetitive code.
- Left recursion:
- Handling right associative expressions may be cumbersome.
- Quickly become difficult to maintain as the grammar grows (very quickly in fact).