previous up contents next
Left: File header Up: Style sheet for DATR Right: Code style

Opening declarations

  A general rule: declarations that relate to the way the theory provides theorems (e.g., # show and # hide in those implementations that support them) should appear at the end of the file; all other declarations should normally appear at the top of the file, immediately following the header and any general comment that the file includes. Implementations vary as to the declarations they permit, but all the following (if they are allowed at all) should normally appear immediately before any node definitions:

# load 'estonia2.dtr'.
# reset.
# vars $vowel: a e i o u.
# atom T F.
# node top.

Rationale: the reader needs to know what these declarations are in order to make sense of the code that follows. For example, they will assume that T and F are nodes unless they have seen the # atom declaration, and

top:
    <> == undef.

will look like it includes a typo unless the reader has seen the relevant # node declaration. However, it may sometimes make sense to locate a declaration lower in the file. For example, if the only code to make use of a variable is that for a finite state transducer defined near the end of the file, then it may well be more perspicuous to locate the variable declaration immediately above the transducer node definitions.

If you use # load then you should include a comment that indicates what it is that is being loaded.

---------------------------------------------------------

previous up contents next
Left: File header Up: Style sheet for DATR Right: Code style
Copyright © Roger Evans, Gerald Gazdar & Bill Keller, Tuesday 10 November 1998