maetl / calyx

A Ruby library for generating text with recursive template grammars.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tracery Support

tra38 opened this issue · comments

Should Calyx support files written in Tracery? It seems that Tracery grammars are more common lately, and Calyx should probably support them to stay relevant (especially as one of the rationales for #7 is to eventually handle Tracery grammars). There did seem to be an abortive attempt at building a gem to handle Tracery so this might be a rather ambitious project. There's also the possibility that the Tracery grammar may be so complex that it might be better to treat it as its own separate library (and to treat Calyx as a dependency of that library).

I would be interested in this. Interoperability between tools is a good goal to aim for.

I’ve already experimented with parsing the old style of Tracery grammars in Calyx and it works fine—it can be done with simple string rewriting operations. The problems here are related to native JavaScript string functions being called—for it to work as a general library, we’d need to introduce a compatibility layer that maps JavaScript to Ruby (eg: rule.toUpperCase => rule.upcase).

Also, the next version of Tracery looks like it will have a bunch of new syntax and conventions to handle. I haven’t looked into it yet, but just going by the progress @galaxykate is posting online, it looks like a greatly expanded range of features.