eatkins / tree-sitter-ebnf-generator

Convert an EBNF grammar to the tree-sitter dsl
GNU General Public License v3.0
24 stars 2 forks source link

Several errors when using tree-sitter-to-ebnf.js #3

Open mingodad opened 3 years ago

mingodad commented 3 years ago

When trying to convert all the grammars listed in https://github.com/mingodad/plgh with this patch applied I'm getting several errors see attached output. output-cvt-all.zip

Thank you for your great work !

Why not instead of converting the EBNF to grammar.js convert it directly to src/grammar.json ?

mingodad commented 3 years ago

Also why not convert to EBNF from the src/grammar.json, it seems a bit simpler than from the grammar.js ?

eatkins commented 3 years ago

Thanks for the feedback! I'm a bit wary of downloading a zip file, but it seems like you've made some progress on fixing the errors? I was motivated to convert the tree-sitter-scala grammar so I was mostly concerned with getting that translated correctly. I'm not surprised that there are edge cases that I missed.

With regards to src/grammar.json vs grammar.js. I thought about the grammar.json but it seemed like tree-sitter generate always uses grammar.js and I was trying to get something that I could actually use to write a tree-sitter grammar as quickly as possible. I agree that translating to grammar.json would be a better solution so long as it could be seamlessly integrated with the process for building parsers.