Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Ruby yacc file is scary to look at. 13+ thousand lines in a single file.

Would it be better with hand rolled and they could have abstracted and organized somethings or does it all make sense in its current format if you are familiar with it?

https://github.com/ruby/ruby/blob/v3_0_2/parse.y



I have a PhD in compiling Ruby and I struggle to read and modify that file.


Ruby is very flexible. Is that the issue?

I suspect not, because Scala is super flexible and probably more difficult to parse, but has a better organized parser.


The language is just quite large and quite complex to parse - context-sensitive and requires interaction back and forth with the lexer as it parses. TreeSitter seems to have a much simpler Ruby parser - but I believe it ignores the context-sensitive parts of Ruby.


Ruby's syntactic flexibility is definitely a big factor in it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: