It looks interesting, but I am more interested to what do you want to achieve? Because if it only the execution graph, there are already tools outthere to help you out (even ant -debug target will already give you very good hints). ./alex -- .w( the_mindstorm )p. On 7/22/06, Erik Veenstra <erikveen / gmail.com> wrote: > ---------------------------------------------------------------- > > ENGLISH VERSION > > http://www.erikveen.dds.nl/xml2rb/index.html > > ---------------------------------------------------------------- > > XML VERSION > > <post title="XML2RB" > author="Erik Veenstra"> > <quote src="http://www.erikveen.dds.nl/xml2rb/index.html" > author="Erik Veenstra"> > <snip comment="money"/> > <snip comment="XML-bashing"/> > <snip comment="XML is great!"/> > <snip comment="Ruby is even greater!"/> > <snip comment="XML-bashing, again"/> > <snip comment="Data and Code"/> > <snip comment="ANT-bashing"/> > <section comment="introduction"> > <text> > This week, I had to track down a bug in a set of ANT scripts. > It took me hours. I simply couldn't build a mental picture of > what was going on. I was angry. "I don't want to read XML!", I > shouted. "XML is for machines! I'm not a machine! I want to > write Ruby!" Java Joe answer: "Go write Ruby, I don't care, > but please shut up!". Just to make him happy, I immediately > started writing Ruby... > > I wrote a little script to analyze these ANT scripts. After > all, they're just XML and can be treated as data. The parts > which should be treated as code are fed to a little > interpreter, which walked through the data, step-by-step. > Something started to smell... Although I was writing Ruby, > I was still handling XML and, above all, I was still > thinking XML. > > Can't we just translate XML to Ruby code? In theory we could: > assume that we translate every tag in XML to a method call in > Ruby, than the attributes of the tag are the named parameters > of the call and the body of the tag (child tags and/or text) > is handled by the block. > </text> > > <example> > <snip comment="XML version"/> > <snip comment="Ruby version 1"/> > <snip comment="Ruby version 2"/> > </example> > > <snip comment="DSL"/> > > <text> > Instead of writing an interpreter and coding against REXML, we > only have to build the DSL. Or can it be generated?... > > Let's turn theory into practice. After all that's the best > proof of a concept. "In theory, there's no difference between > theory and practice; in practice, there is." > > This is just an experiment. Maybe, after a couple of days, I > say: "Stupid idea!" Maybe not. Let's find out... > </text> > </section> > <section title="Day One"> > <snip comment="Please it on the site"/> > </section> > <section title="Day Two"> > <!-- TODO: Not yet implemented --> > </section> > </quote> > </post> > > ---------------------------------------------------------------- > > RUBY VERSION > > post(:title=> "XML2RB", > :author=> "Erik Veenstra") { > quote(:src=> "http://www.erikveen.dds.nl/xml2rb/index.html", > :author=> "Erik Veenstra") { > snip(:comment=> "money") > snip(:comment=> "XML-bashing") > snip(:comment=> "XML is great!") > snip(:comment=> "Ruby is even greater!") > snip(:comment=> "XML-bashing, again") > snip(:comment=> "Data and Code") > snip(:comment=> "ANT-bashing") > section(:comment=> "introduction") { > text { > text! "This week, I had to track down a bug in a set of..... > } > example { > snip(:comment=> "XML version") > snip(:comment=> "Ruby version 1") > snip(:comment=> "Ruby version 2") > } > snip(:comment=> "DSL") > text { > text! "Instead of writing an interpreter and coding..... > } > } > section(:title=> "Day One") { > snip(:comment=> "Please it on the site") > } > section(:title=> "Day Two") > } > } > > ---------------------------------------------------------------- > > ENGLISH VERSION (REPEATED) > > http://www.erikveen.dds.nl/xml2rb/index.html > > ---------------------------------------------------------------- > > gegroet, > Erik V. - http://www.erikveen.dds.nl/ > > >