From: Clifford Heath Date: 2008-08-05T12:58:36+09:00 Subject: Re: State of the Onion David Masover wrote: > Has anyone actually done the equivalent of Acme::Lingua::Pirate::Perl for > Ruby? If so, how much work was it? How hackish was it? I'm not familiar with Acme::..., but the right answer for Ruby is to use a composable grammar for its compiler (such as, but not necessarily, the ones emitted by Treetop), and then to simply support the "grammar" block ala Treetop where you can define new syntax rules. Any time a new grammar rule fires, the syntax may include as much or as little of the general Ruby syntax as the rules decide to call. When a grammar rule replaces a built-in one, it's able to use "super" to call the original rule, as in Treetop... If you can also associate a grammar rule as thej top rule of a filetype extension for a file loaded from require (the way my Polyglot gem does), you can require files in any language for which you have a grammar. This is an amazingly powerful concept... someone will do it sooner or later. Clifford Heath.