Data Engineering Manager of Applications Backend CRuby committer, mainly develop parser generator and parser Lrama LALR (1) parser generator (2023, Ruby 3.3) Love LR parser
Okinawa, Japan The Bison Slayer The parser monster The world is now in the great age of parsers. People are setting sail into the vast sea of parsers. - RubyKaigi 2023 LT- Yuichiro Kaneko https://twitter.com/kakutani/status/1657762294431105025/ NEW !!!
information from the parser with event- based style Abstract syntax trees Simple lexical analysis https://github.com/ruby/ruby/blob/v3_3_0/ext/ripper/lib/ripper.rb
+, 2 are reduced to arg Arguments are “count 1”, :+ and “count 5” Returned values are passed to another method call 1 (“count 1”) 2 (“count 5”) + arg (“count 6”) 1 (“count 1”) 2 (“count 5”) + on_binary("count 1", :+, "count 5") is called and “count 6” is returned
of NODE_BLOCK_PASS and NODE_ITER Ripper can’t do the check because it doesn’t have nodes primary method_call brace_block NODE_FCALL NODE_ITER block_dup_check Stack to manage Node NODE_BLOCK_ PASS
Objects arg 1 2 + NODE_INTEGE R NODE_INTEGE R NODE_OPCAL L NODE_INTEGE R NODE_INTEGE R Stack to manage Node “count 1” “count 5” “count 6” #on_binary Stack to manage Ruby Object Call #on_binary method Return value
on the stack, like $1 $:n is expanded to minus index integer 1 2 + NODE_INTEGER NODE_INTEGER “count 1” “count 2” $1 $3 ary[$:1] => ary[-3] ary[$:3] => ary[-1]
ripper Because the type of semantic value was different It was too difficult… https://github.com/ruby/ruby/blob/v3_3_0/parse.y Parser Ripper NODE NODE VALUE VALUE