You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is gomme suited to parse indentation-based non context-free languages like YAML ?
The round-trip refers to the fact that I would like to keep full layout information in the AST, so that if I change a node or a comment or whitespace, the resulting diff is minimal. The use case would be to present the diff to a human being, who wants to keep the file "hand formatted".
thanks!
The text was updated successfully, but these errors were encountered:
I believe you should be able to build a YAML parser with Gomme indeed. Parser combinators are generally suited to build parsers for almost any format I can think of (but I'm sure there are exceptions). But I offer no guarantees on that front, not having built one myself for this specific format yet. If you go ahead and attempt building one, I'd be really eager to get your feedback and input 🤝
In general, I don't see on top of my head why indentation would be an issue, and you can perfectly fit your matches into an AST, by using the Assign and Map combinators.
With a few caveats though:
Gomme is not fully finished yet. Although you can perfectly build pretty thorough parsers with it already, we haven't reached a major version yet, and some combinators might be missing still, some others might change, and although I want the API to remain somewhat stable, there will be changes in the future.
The error management is not yet as good as I would want it to be. I'm actively working on it, but this might take a bit of time to get right, so that parsers can specifically pin-point where in the input, and why, a failure happen.
I'm currently working on the next minor version of Gomme which will include more examples, with a JSON parser example, for instance, you might find out useful. If that's okay with you, I'll ping you when it's out 👍🏻
hello @oleiade,
thanks for the quick and complete answer :-)
I understand that gomme is still being developed. A JSON parser would be a very good example indeed.
Another idea is to port some of the examples from participle, that would also allow to compare approaches. I wrote a round-trip INI file parser/writer with participle, and I think that will be my first comparison.
If that's okay with you, I'll ping you when it's out
Hello,
I have two questions:
thanks!
The text was updated successfully, but these errors were encountered: