Paul Battley
po-ru.com · Personal blog · on HN since 2009
Paul Battley, a Ruby developer, writes about Ruby parsing quirks, Rails, and the Ruby community.
What HN saysHN commenters link his Ruby parsing ambiguities post in grammar discussions, and his post on Matz being nice in a debate over DHH's politics.
16HN people shared it
4linked it in comments
12stories submitted
145story points
2 months agolast shared
2009people per year2026
Most-shared posts
- 1It doesn't matter whether "Matz is nice"2 people · 2 points · first shared 2026 · discussion on HN
- 2Ruby parsing ambiguities2 people · first shared 2012
- 3Ruby’s magic underscore1 people · 113 points · first shared 2012 · 34 comments on HN
- 4Convert Ruby to JavaScript1 people · 15 points · first shared 2009 · 10 comments on HN
- 5Destructuring assignment in Ruby1 people · 3 points · first shared 2012 · discussion on HN
- 6IE6 D-Day, lets give IE6 a definable lifespan1 people · 2 points · first shared 2009 · discussion on HN
- 7One does not simply … (Turbolinks edition)1 people · 2 points · first shared 2013 · discussion on HN
- 8Writing Rails apps without wanting to kill everybody1 people · 2 points · first shared 2013 · discussion on HN
- 91 error(s) prevented this form from being saved1 people · 2 points · first shared 2014 · discussion on HN
- 10Get your filthy hands off my Kernel methods1 people · 1 points · first shared 2009 · discussion on HN
- 11Skimmer, deuxième partie1 people · 1 points · first shared 2015 · discussion on HN
- 12Po-ru.com: Ruby propaganda1 people · 1 points · first shared 2010 · discussion on HN
- 13Encrypted application configuration1 people · 1 points · first shared 2014 · discussion on HN
- 14Clock.js1 people · first shared 2013
- 15Getting started with treetop1 people · first shared 2012
What HN people wrote when they linked it
stcredzero · 2017-03-20
writing parsers is the least interesting part of an interpreter/compiler, and your grammar should be boring if you want your syntax to be easy to understand by humans.
In my (admittedly limited) experience, most grammars for programming languages that are supposed to be easy on humans end up being harder to parse. (See below) One notable exception is, of course, Smalltalk.
One criticism I have of this article, is that it is written in a way that obscures the fact a top-down parser is an LL(k) parser. I'd posit that sticking to an LL(1) grammar is a great way to wind up with a simpler syntax that lacks sticky syntactic sugar that will be hard to optimize and build software tool for later on. (AT least for your personal learning hobby project. But in that case, at least use a separate Lexer!)
You can't introduce bullshit ambiguous extensions to your grammar
Ruby: http://po-ru.com/diary/ruby-parsing-ambiguities/
threedaymonk · 2012-11-29
Both Ruby and Perl have the same challenge, and both solve it by treating the expression differently depending on whether f is a variable or a function/method. As it turns out, you can't actually parse Perl 5 [1], but Ruby can be statically parsed [2], and resolves this ambiguity based on context.
I don't actually know anything about CoffeeScript's parser, and I imagine that it complicates the grammar significantly, but would the same approach not be possible there?
(Personally, I'm quite happy to type parentheses in exchange for clear syntax, and it's these very aspects of CoffeeScript that put me off it: I really find it tricky to follow what's going on when function definitions, function calls, and named parameters are mingled. At least regular JavaScript is syntactically simple, even if I do have to type function more often and worry about this.)
[1] http://www.perlmonks.org/?node_id=663393
[2] http://po-ru.com/diary/ruby-parsing-ambiguities/
xavdid · 2026-08-21
I would not personally sign onto (or put money) behind a DHH-run project because of his frankly abhorrent political views:
- https://po-ru.com/2026/07/29/it-doesnt-matter-whether-matz-is-nice
- https://blogs.gnome.org/alatiera/2025/11/06/dhh-and-omarchy-midlife-cr…
edlea · 2012-02-14
This is something that the BBC did with iPlayer: http://po-ru.com/diary/device-discrimination-on-the-internet/
I've not quite worked out how to implement it though