From: Andrew Green Date: 2007-04-24T06:52:14+09:00 Subject: Re: Arrow operator with dash instead of equals (->) El mar, 24-04-2007 a las 04:31 +0900, Brian Candler escribi�: > The cleanest way I suspect would be to define a grammar for your own > language, and write a parser for it. I believe there's a Ruby parser > generator out there. > > Then you are not bound by the rules of Ruby syntax at all. Perhaps I didn't explain myself clearly... We _do_ have our own parser and grammar. The thing is that _within_ our language there are "blocks" of code that are meant to be processed by the Ruby interpreter. At the risk of being acused of going off topic, let me offer a little example: property swv:hasGivenNames minCardinality 1 maxCardinality 1 outRequirement fromPropRange property swv:hasLastNames minCardinality 1 maxCardinality 1 outRequirement fromPropRange property swv:hasParent minCardinality 2 maxCardinality 2 outRequirement fromPropRange has_parent->place_of_birth orderUsing has_last_names |{ (ROOT->has_given_names).textBPV + " " + (ROOT->has_last_names).textBPV }| defaultOrderBy has_last_names VariableDesc default ShortDesc default FullDesc default (I know, it's very ugly... In the next version we'll replace all the xml-ish tags with angle brackets and make it all much more succinct.) Anyway, all of this is processed by our own interpreter, including, for example, the rule has_parent->place_of_birth As you can see it's mainly declarative. However this part |{ (ROOT->has_given_names).textBPV + " " + (ROOT->has_last_names).textBPV }| is read by our interpreter only as a string between a |{ and a }| . That string is then passed to the Ruby interpreter and is meant to be run (from within a specific context that our interpreter determines). In these bits we don't want just our language running about, of course, we want full-blown Ruby code with extensions that allow a programmer to refer to the graph traversal rules using a syntax similar to that used in the rule definitions that appear _outside_ the Ruby code blocks. Thanks again for your advice and apologies if this is considered off-topic.