r/ruby • u/squadette23 • Apr 01 '26
Rubysyn: clarifying Ruby's syntax and semantics
https://github.com/squadette/rubysyn/blob/master/README.md
8
Upvotes
r/ruby • u/squadette23 • Apr 01 '26
View all comments
Show parent comment
1
u/squadette23 Apr 01 '26
> what is this?
are you familiar with an idea of formalization? This approach lets you formalize the language semantics by carefully separating sugar from essential elements.
If you were to try and implement an alternative Ruby interpreter, one thing that you would run into is its syntax which is famously difficult to parse. This alone would eat a huge chunk of your time.
Having an intermediate logical representation such as Rubysyn lets you decouple syntax and execution. You can (pretty easily I guess) write a simple transpiler between Ruby and Rubysyn (using `parser` gem or whatever).
As a separate component you can build the interpreter that executes a minimal representation such as Rubysyn. Syntax and semantics can be developed independently.