Feature #8892

Documentation of Ruby at the level of S-expressions.

Added by Anonymous about 7 years ago. Updated about 7 years ago.

Target version:


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) about 7 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) about 7 years ago

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


Updated by Anonymous about 7 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.

Also available in: Atom PDF