I’ve been reading quite a bit about parsing and templating in ruby as I attempt to port a templating engine from JavaScript to Ruby. Here are some scattered links:

Jison

Jison is a parser generator for JavaScript that has separate lex and bnf definitions. It’s used by Handlebars.js.

Repositoryjison
Ownerzaach

Treetop

Treetop is a parser generator for Ruby. It’s installed with Ruby On Rails, through the mail gem which is installed by ActionMailer.

Repositorytreetop

Citrus

Citrus is another promising parsing gem for Ruby. It seems to be very easy to get started with, and I like many of the design decisions.

Repositorycitrus

Temple

Temple is a templating-specific library that helps with a lot of the AST transformation. It doesn’t seem to have a CFG syntax so it seems that using treetop or citrus would make sense for complex grammars. Otherwise, strscan could be used.

Repositorytemple
Ownerjudofyr

temple-mustache

This is an implementation of a mustache renderer in . It uses strscan to generate the initial parse tree, and Temple to generate the ruby code. It supports mustache sections.

Repositorytemple-mustache
Ownerminad

Slim

Slim is a Haml-like templating library for Ruby that’s used in production by many. It uses Temple, with a line-based parser, which works well because it uses significant indentation for nesting.

Repositoryslim
Ownerstonean

I like seeing URLs, whether in the link text or by hovering over a link. They are often truer to their content than what the person adding the link writes. I always have the status bar turned on in my browsers. It annoys me that there is no status bar on the iPad. It pleases me that Chrome shows URLs without taking up space for a status bar, by fading them in when hovering over a link. But a significant percentage of URLs aren’t worth a whole lot. They are either too long, or contain nothing identifying but numbers.

Some say that URLs will go away. But do they have to? If people still care about them, I don’t think so. That’s why we need URLs worth caring about. Just like we need buildings worth caring about, and neighborhoods worth caring about:

So how ’bout it?

(Yes, I realize that this blog’s urls suck, and don’t have to. I plan to change that soon.)