Project

General

Profile

Actions

Feature #8892

closed

Documentation of Ruby at the level of S-expressions.

Added by Anonymous over 10 years ago. Updated over 10 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:57123]

Description

Being a non-expert, I understood that Ruby is parsed into something like S-expressions. I am happy that Ruby allows me not to write in sexps. This buys ergonomy (code readability). I am also happy that Ruby allows me to write in sexps and even convert the sexp code to standard Ruby with tools such as Jim Weirich's Sorcerer. However, it seems to me that at the level of sexps, Ruby is underdocumented for us average users. I can only guess what :program, :stmts, :@int, :@float, :@ident etc. in Ripper.sexp output mean. Why not make the Ruby sexp documentation public?

Updated by naruse (Yui NARUSE) over 10 years ago

  • Status changed from Open to Rejected

Why Ruby doesn't documantate its sexp is because we don't limit Ruby's future by its compatibility.

For version compatibility, Ruby's abstract syntax tree is internal expression and it may be changed suddenly.
If the syntax tree is published, people want the compatibility and it will limit future implementation.

For implementation compatibility, other than CRuby can use another internal expression for AST.
If the tree is published, the compatibility will disturb new parser implementations.

Anyway people can use AST as sexp with some gems or tools at their own risk.
This is considered the best situation.

Updated by yorickpeterse (Yorick Peterse) over 10 years ago

If you want to use a parser with a stable and documented API use this
instead: https://github.com/whitequark/parser. Ripper isn't exactly a
breeze to work with.

Yorick

Updated by Anonymous over 10 years ago

@naruse (Yui NARUSE): I see.
@yorickpeterse (Yorick Peterse): Looks awesome. I hope it won't disappoint me. That whitequark guy looks amazing, too. Thanks for enlightening me.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0