Misaki Shioi
Misaki Shioi
  • @coe401_

Web application developer. Rubyist. Member of Asakusa.rb & Fukuoka.rb.

Implementing "++" operator, stepping into parse.y

The fact that there is no increment/decrement operator in Ruby is known to many Rubyists. Currently, if you try to write code like i = 0; i++ in Ruby, MRI's parser considers it syntactically invalid.

Still, if we want them that means adding a new syntax for ++ operator to Ruby. This seems like a simple syntax at first glance, but to achieve this we need to dig a little deeper into MRI, and explore parse.y - the parser file called "魔窟" (the maze), and consider the compatibility with existing specifications of Ruby.

This talk will show you some ideas to obtain ++ with the trial-and-error process of a programmer who is not an expert in a parser, thereby making the interesting topics, lexical analysis, and parsing more familiar to you.

Presentation Material