Hacker News new | ask | show | jobs
by SeriousM 75 days ago
> This is an experiment in clarifying some aspects of Ruby syntax and semantics. For that we're going to introduce an alternative Lisp-based syntax for Ruby, preserving Ruby semantics.

Lisp? Then I would use Lisp...

> The goal is to define a comprehensive, trivially-parsable and sugar-free syntax.

Ruby has syntax sugar, no need to remove the funny parts.

3 comments

> Ruby has syntax sugar, no need to remove the funny parts.

This is just an intermediate representation, it's not meant to be used directly (even though you can do that, of course).

> Lisp? Then I would use Lisp...

Lisp has completely different runtime semantics. Even the lexical scope in Ruby is extremely peculiar. One of the hard parts of writing this document was to remove the intuitive influence of Lisp because it just doesn't make sense for Ruby.

S-expression is a standard representation for syntax-free semantics. For example, PLT Redex [1] is a DSL for programming language semantics and built on top of Racket which uses S-expressions.

[1] https://redex.racket-lang.org/

Do you know if Redex could be a tool that would be useful in my situation?

Claude suggests it, but I need to learn a lot of Redex to understand how to apply it.

I have a general understanding of what operational semantics is. Or maybe, are there any Redex implementations for common programming languages? \lambda_v is a bit too abstract.

Even Ruby `parser` gem uses S-expressions in their documentation: https://github.com/whitequark/parser/blob/master/doc/AST_FOR...