3 ms·
bison should be compared to https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/grammar.json https://github.com/tree-sitter/tree-sitter-ruby/blob/ma
by codesnik 6y ago
bison should be compared to https://github.com/tree-sitter/tree-sitter-ruby/blob/master/src/grammar.json https://github.com/tree-sitter/tree-sitter-ruby/blob/master/... probably?
- chrisseaton 6y agoNo the JSON file there is generated (I believe?) from the JavaScript I linked, while the Bison file is hand-written. With tree-sitter you're hand-writing a 1k file. With Bison you're hand-writing a 13k file.
- tclem 6y ago@chrisseaton you are correct, the JSON file is generated. The handwritten parts are: - https://github.com/tree-sitter/tree-sitter-ruby/blob/32cd5a04adb4accb0c121f037ab59df3c3488228/grammar.js https://github.com/tree-sitter/tree-sitter-ruby/blob/32cd5a0... - https://github.com/tree-sitter/tree-sitter-ruby/blob/32cd5a04adb4accb0c121f037ab59df3c3488228/src/scanner.cc https://github.com/tree-sitter/tree-sitter-ruby/blob/32cd5a0... So about 2k loc. The trickiest (and most verbose) parts of the external scanner have to do with heredocs and the various ways to declare literals (strings, symbols, regexes, etc).