11.2.5 Generator Generators
DSM people tend to be happy with the idea of doing something on a meta level; some
even get excited about it. For such people, the idea of a generator generator is
positively intoxicating. Rather than drudge to build a generator that turns models into
code, why not write a smarter program that would build the generator for us? This can
be particularly attractive if the generator language is somewhat lacking in facilities for
handling repeated similar cases: subgenerators, parameterization, re?¬‚ection,
refactoring tools, and so on.
The overhead in building a generator generator is however substantial. First there is
the additional cognitive load of an extra meta level, and of an extra layer in which bugs
can hide. Second comes the dif?¬?culty of three levels of embedded syntax: simple
strings to be generated are ?¬?rst quoted for the actual code generator, and then the
generator script containing those is quoted for inclusion in the generator generator.
This situation is made worse when the three languages??”those of the generator
generator, the generator, and the output??”all use similar punctuation and keywords. In
the worst case, they might even be exactly the same language: at that point, nobody
can read or write without constantly losing track of which level a particular keyword
or punctuation character is on.
Pages:
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508