Friday, December 28, 2007

DOM, take two

Last night at Too Damn Late[TM], I got some really good ideas which amount to a refactoring of the DOM.

  • The accessors should be smart get/set types
  • VERBATIM chunks should be containers in the manner of TRIGGERS rather than special cases of TEXT chunks
  • I was misusing the 0E0 value; it should be replaced with 'undef'
  • Now that both the DOM tree and the text stowage structure are arrays instead of hashes, their additive methods can be rewritten with simple push()es instead of index accesses
  • ...and the associated node tracking scalars can be gotten rid of
And then a lot of little things auxilliary to these points. And rewrites of the POD to match it all. And a likely painful overhaul of the test suite.

Oh well. That's progress. The Grammarian and its Handlers follow this.

Tuesday, December 25, 2007

Grammarian flowcharts

Last night, as I finished up porting issues from the old Trac install to googlecode, I began pondering one of them, and ended up with some really good ideas. It was all about the Grammarian, and the new strategy of it doing its work through independent modules rather than a giant wodge of code in the Grammarian module itself.

Basically the Grammarian acts as a traffic cop and crossing guard for the Lexer and DOM while a series of Handler modules hands off the heavy lifting between themselves. I sat there, into the wee hours of Xmas morning, drawing revision after revision of a logic flowchart for the design. It seems like pretty good stuff at this point -- now I just have to get the DOM back on its feet so I can move on to this work.

And after that, it'll finally be possible to show off a Carrot validator!

Sunday, December 23, 2007

DBM::Deep

It turns out that NDBM key/value pairs can have a maximum length of 1023 characters, combined. This is, to say the least, unsuitable for my purposes, as I had been using NDBM for storage of document text chunks.

I asked for alternatives a while ago on #perl, and one person mentioned DBD::Deep. At the time I was leaning towards SQLite or a custom tie() job, but decided to give D::D a look before making a decision. I'm glad I did. Today I'm refactoring the DOM to use it instead of NDBM (which only ever worked because the Lexer and DOM test files are so minimal).

Friday, December 21, 2007

Yay!

I've been awarded the project name "carrot" over at googlecode, and now things are ready to roll.

Here we go!