kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.57k stars 231 forks source link

`row -> row | row newline rows` vs `rows -> row (newline row):*` #610

Open SevenOutman opened 2 years ago

SevenOutman commented 2 years ago

Hi, thanks for this tool! I was wondering if there's any difference (in performance or semantic) between these two ways of declaring repeating items (e.g. rows in csv)?

rows -> row
      | row newline rows

# vs

rows -> row (newline row):*

I was writing a grammar and got some performance issue. I used the second approach all the way, don't know if it slows things down.