The generator language in a crawler will normally be a textual Domain-Speci?¬?c
Language, as is the case in say MERL, the MetaEdit+ Reporting Language. On the
borders between true generator languages and general purpose languages used for
generation are languages like DOME??™s Alter, which is an adaptation of Scheme. The
bene?¬?ts of a true DSL are similar to those ofDSMitself: conciseness, a higher level of
abstraction, and fewer errors.
A crawler maintains and operates on two stacks as it generates: one for model
element navigation history and another for output streams. At any time, then, there is a
current model element and a current output stream. This makes for a concise
language: rather than have ????¬?leWriter.write(this.name())??? we simply have ???name.???
The details of which element??™s name we want and which ?¬?le we want to write it to are
easily inferred from the stacks.
Similarly, crawlers can free us from error-prone explicit pushing and popping, or
assigning iterator variables, which would otherwise take up a large part of the
TYPES OF GENERATOR FACILITIES 273
generator text. Each navigation operation works like a loop, with an implicit push at
the start and pop at the end.
For instance, if we ask the crawler to navigate from the current State to each of the
States directly reachable from there, the top element on the stack will initially be the
current state.
Pages:
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505