* cnmaclean / hotmail.com <cnmaclean / hotmail.com> [2005-02-16 03:14:53 +0900]:

> In my company, we're looking at creating a domain-specific language.
> Instead of being a totally proprietary language, which we'd have to
> support and which would probably be limited in various ways etc., I was
> thinking about the possibility of basing it on an existing language,
> and Ruby in particular seemed to come to my attention.
> I haven't really used Ruby at all, but from what I've read, it seems
> like it could be quite suitable.
> 
> What we're trying to do in particular is define a data description
> langauge, where we can define human-readable "translations" for hex
> data.  This would be largely in a declarative style (e.g. "DataItem
> Name='My Data' Coding='Language' Length=2"); using something like Ruby
> might allow us to do the simple things (like the above) simply, but
> still keep open the possibility of using the power of a programming
> language where required - e.g. where the data structure is particularly
> dynamic.
> The other characteristic of our language is that it will probably be
> fairly hierarchically structured.  For example, we have the concept of
> translations for files, which may be contained in folders.  So we'd
> want to specify parent folders (with identifiers), and other
> files/folders as children of these folders; the "leaf" files would have
> translations etc. associated with them.
> 

Do you mean someting like:

define_data {
  data_item { |t|
    t.name "My Data"
    t.coding "Language"
    t.length 2
  }

  files "." {
    decode_with "My Data"
  }
}

-- 
Jim Freeze
Code Red. Code Ruby