aragon / radspec

🤘 Radspec is a safe interpreter for Ethereum's NatSpec
MIT License
141 stars 36 forks source link

Peg.js ? #28

Closed verdverm closed 4 years ago

verdverm commented 6 years ago

I've used peg.js and the golang implementation of PEG. They make it easier to modify the grammer and output than anything else I've used (lowers the barrier to enhancements). It might resolve a number of the other open issues as well.

Something to consider?

https://pegjs.org/ https://github.com/mna/pigeon

onbjerg commented 6 years ago

Thank you for your issue! 🥇

I considered it initially, but I opted to not use Peg.js for more control, and also I have no experience using Peg.js, so it would increase development time for the proof-of-concept.

Do you have some particular thoughts on why you prefer Peg.js vs something like nearley.js?

verdverm commented 6 years ago

Peg.js is more "end-to-end" than just a parser. There is a basic example here: https://github.com/pegjs/pegjs/tree/master/docs/grammar

You can see the rules have the "evaluation" or usage of the language as JS function bodies at the end of each rule.

Generally, PEG has made my life waaaay easier! You only have to write the one file (can split into multiple files) and it is far easier to reason about, and write, the language.

sohkai commented 4 years ago

Closing; we will evaluate other parsers in the future (e.g. nearly, peg).