This post originated from an RSS feed registered with Ruby Buzz
by Red Handed.
Original Post: Wow, Do We All Get a Language?
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
We’re all having a lot of fun this year making lovely hybrid languages from Ruby syntax, be it Rails models, Rake tasks, Dwemthy. Martin Fowler is knocking out a series of articles on domain-specific languages and language workbenches, the IDE and BDUF equivalent. All the surrounding essays are really interesting, including his IDE-based metaprogramming example, which gives you an idea of how parsing and code generation is being organized into these crazy point-and-click apps with IntelliSense and stuff.
Readers of this site will particularly love the early slant of the workbench article, since he attempts to hack some C# code in meta fashion, but it can’t hold a candle to his YAML-ish custom syntax:
And, better yet, his subtle retooling into Ruby code:
mapping('SVCL', ServiceCall) do
extract 4..18, 'customer_name'
extract 19..23, 'customer_ID'
extract 24..27, 'call_type_code'
extract 28..35, 'date_of_call_string'
end
mapping('USGE', Usage) do
extract 9..22, 'customer_name'
extract 4..8, 'customer_ID'
extract 30..30, 'cycle'
extract 31..36, 'read_date'
end
I found it almost bewildering that he links to Chapter Six of the (Poignant) Guide in his discussion of Ruby metaprogramming. I mean the reference to Rails is natural, but I would hate for this cartoon book to gain credibility. He knows that I have sketches of my sister’s clones quenching their thirst with jackal’s blood, right??