How Inform extends and annotates the syntax tree.


§1. Nodes. The syntax tree is managed by the syntax services module, which defines the most basic node types, which are enumerated by constants in the form *_NT.

define MORE_NODE_METADATA_SETUP_SYNTAX_CALLBACK CoreSyntax::create_node_types
void CoreSyntax::create_node_types(void) {
    Create additional level 3 structural nodes1.2;
    Create the code nodes1.4;
    Create the rvalue nodes1.6;
    Create the lvalue nodes1.8;
    Create the condition nodes1.10;
}

§1.1.

enum ALLOWED_NT                    "an animal is allowed to have a description"
enum EVERY_NT                      "every container"
enum ACTION_NT                     "taking something closed"
enum ADJECTIVE_NT                  "open"
enum PROPERTYCALLED_NT             "a man has a number called age"
enum CREATED_NT                    "a vehicle called Sarah Jane's car"
enum TOKEN_NT                      used for tokens in grammar

§1.2. Create additional level 3 structural nodes1.2 =

    NodeType::new(ALLOWED_NT, I"ALLOWED_NT",               1, 1,     L3_NCAT, ASSERT_NFLAG);
    NodeType::new(EVERY_NT, I"EVERY_NT",                   0, INFTY, L3_NCAT, ASSERT_NFLAG);
    NodeType::new(ACTION_NT, I"ACTION_NT",                 0, INFTY, L3_NCAT, ASSERT_NFLAG);
    NodeType::new(ADJECTIVE_NT, I"ADJECTIVE_NT",           0, INFTY, L3_NCAT, ASSERT_NFLAG);
    NodeType::new(PROPERTYCALLED_NT, I"PROPERTYCALLED_NT", 2, 2,     L3_NCAT, 0);
    NodeType::new(TOKEN_NT, I"TOKEN_NT",                   0, INFTY, L3_NCAT, 0);
    NodeType::new(CREATED_NT, I"CREATED_NT",               0, 0,     L3_NCAT, ASSERT_NFLAG);

§1.3.

enum CODE_NCAT
enum INVOCATION_LIST_NT            Single invocation of a (possibly compound) phrase
enum CODE_BLOCK_NT                 Holds a block of source material
enum INVOCATION_LIST_SAY_NT        Single thing to be said
enum INVOCATION_NT                 Usage of a phrase
enum VOID_CONTEXT_NT               When a void phrase is required
enum RVALUE_CONTEXT_NT             Arguments, in effect
enum LVALUE_CONTEXT_NT             Named storage location
enum LVALUE_TR_CONTEXT_NT          Table reference
enum SPECIFIC_RVALUE_CONTEXT_NT    Argument must be an exact value
enum MATCHING_RVALUE_CONTEXT_NT    Argument must match a description
enum NEW_LOCAL_CONTEXT_NT          Argument which creates a local
enum LVALUE_LOCAL_CONTEXT_NT       Argument which names a local
enum CONDITION_CONTEXT_NT          Used for "now" conditions

§1.4. Create the code nodes1.4 =

    NodeType::new(INVOCATION_LIST_NT, I"INVOCATION_LIST_NT",                0, INFTY,   CODE_NCAT, 0);
    NodeType::new(CODE_BLOCK_NT, I"CODE_BLOCK_NT",	       					0, INFTY,	CODE_NCAT, 0);
    NodeType::new(INVOCATION_LIST_NT, I"INVOCATION_LIST_NT",		   		0, INFTY,	CODE_NCAT, 0);
    NodeType::new(INVOCATION_LIST_SAY_NT, I"INVOCATION_LIST_SAY_NT",		0, INFTY,	CODE_NCAT, 0);
    NodeType::new(INVOCATION_NT, I"INVOCATION_NT",		   					0, INFTY,	CODE_NCAT, 0);
    NodeType::new(VOID_CONTEXT_NT, I"VOID_CONTEXT_NT", 						0, INFTY,	CODE_NCAT, 0);
    NodeType::new(RVALUE_CONTEXT_NT, I"RVALUE_CONTEXT_NT", 					0, INFTY,	CODE_NCAT, 0);
    NodeType::new(LVALUE_CONTEXT_NT, I"LVALUE_CONTEXT_NT", 					0, INFTY,	CODE_NCAT, 0);
    NodeType::new(LVALUE_TR_CONTEXT_NT, I"LVALUE_TR_CONTEXT_NT", 			0, INFTY,	CODE_NCAT, 0);
    NodeType::new(SPECIFIC_RVALUE_CONTEXT_NT, I"SPECIFIC_RVALUE_CONTEXT_NT",	0, INFTY,	CODE_NCAT, 0);
    NodeType::new(MATCHING_RVALUE_CONTEXT_NT, I"MATCHING_RVALUE_CONTEXT_NT",	0, INFTY,	CODE_NCAT, 0);
    NodeType::new(NEW_LOCAL_CONTEXT_NT, I"NEW_LOCAL_CONTEXT_NT",			0, INFTY,	CODE_NCAT, 0);
    NodeType::new(LVALUE_LOCAL_CONTEXT_NT, I"LVALUE_LOCAL_CONTEXT_NT",		0, INFTY,	CODE_NCAT, 0);
    NodeType::new(CONDITION_CONTEXT_NT, I"CONDITION_CONTEXT_NT",			0, INFTY,	CODE_NCAT, 0);

§1.5. The first specification nodes are the rvalues. These express run-time values — numbers, objects, text and so on — but cannot be assigned to, so that in an assignment of the form "change L to R" they can be used only as R, not L. This is not the same thing as a constant: for instance, "location of the player" evaluates differently at different times, but cannot be changed in an assignment.

enum RVALUE_NCAT
enum CONSTANT_NT                   "7", "the can't lock a locked door rule", etc.
enum PHRASE_TO_DECIDE_VALUE_NT     "holder of the black box"

§1.6. Create the rvalue nodes1.6 =

    NodeType::new(CONSTANT_NT, I"CONSTANT_NT", 								0, 0,		RVALUE_NCAT, 0);
    NodeType::new(PHRASE_TO_DECIDE_VALUE_NT, I"PHRASE_TO_DECIDE_VALUE_NT",	1, 1,		RVALUE_NCAT, PHRASAL_NFLAG);

§1.7. Lvalue nodes represent stored data at run-time, which means that they can be assigned to. (The traditional terms "lvalue" and "rvalue" refer to the left and right hand side of assignment statements written A = B.) For instance, a table entry qualifies as an lvalue because it can be both read and changed. To qualify as an lvalue, text must exactly specify the storage location referred to: "Table of Corvettes" only indicates a table, not an entry in a table, so is merely an rvalue. Similarly, "carrying capacity" (as a property name not indicating an owner) is a mere rvalue.

enum LVALUE_NCAT
enum LOCAL_VARIABLE_NT             "the running total", say
enum NONLOCAL_VARIABLE_NT          "the location"
enum PROPERTY_VALUE_NT             "the carrying capacity of the cedarwood box"
enum TABLE_ENTRY_NT                "tonnage in row X of the Table of Corvettes"
enum LIST_ENTRY_NT                 "item 4 in L"

§1.8. Create the lvalue nodes1.8 =

    NodeType::new(LOCAL_VARIABLE_NT, I"LOCAL_VARIABLE_NT", 					0, 0,		LVALUE_NCAT, 0);
    NodeType::new(NONLOCAL_VARIABLE_NT, I"NONLOCAL_VARIABLE_NT", 			0, 0,		LVALUE_NCAT, 0);
    NodeType::new(PROPERTY_VALUE_NT, I"PROPERTY_VALUE_NT", 					2, 2,		LVALUE_NCAT, 0);
    NodeType::new(TABLE_ENTRY_NT, I"TABLE_ENTRY_NT", 						1, 4,		LVALUE_NCAT, 0);
    NodeType::new(LIST_ENTRY_NT, I"LIST_ENTRY_NT", 							2, 2,		LVALUE_NCAT, 0);

§1.9. Condition nodes represent atomic conditions, and also Boolean operations on them. It's convenient to represent these operations as nodes in their own right rather than as (for example) phrases: this reduces parsing ambiguities, but also makes it easier for us to manipulate the results.

enum COND_NCAT
enum LOGICAL_NOT_NT                "not A"
enum LOGICAL_TENSE_NT              in the past, A
enum LOGICAL_AND_NT                "A and B"
enum LOGICAL_OR_NT                 "A or B"
enum TEST_PROPOSITION_NT           if "the cat is on the mat"
enum TEST_PHRASE_OPTION_NT         "giving full details", say
enum TEST_VALUE_NT                 when a value is used as a condition

§1.10. Create the condition nodes1.10 =

    NodeType::new(LOGICAL_NOT_NT, I"LOGICAL_NOT_NT", 						1, 1,		COND_NCAT, 0);
    NodeType::new(LOGICAL_TENSE_NT, I"LOGICAL_TENSE_NT", 					1, 1,		COND_NCAT, 0);
    NodeType::new(LOGICAL_AND_NT, I"LOGICAL_AND_NT", 						2, 2,		COND_NCAT, 0);
    NodeType::new(LOGICAL_OR_NT, I"LOGICAL_OR_NT", 							2, 2,		COND_NCAT, 0);
    NodeType::new(TEST_PROPOSITION_NT, I"TEST_PROPOSITION_NT", 				0, 0,		COND_NCAT, 0);
    NodeType::new(TEST_PHRASE_OPTION_NT, I"TEST_PHRASE_OPTION_NT", 			0, 0, 		COND_NCAT, 0);
    NodeType::new(TEST_VALUE_NT, I"TEST_VALUE_NT", 							1, 1,		COND_NCAT, 0);

§2. Level 4 structural nodes can only be children of RULE_NT nodes (level 2) or of each other, and their children are otherwise specifications.

Specification nodes can only have each other as children.

define PARENTAGE_PERMISSIONS_SYNTAX_CALLBACK CoreSyntax::write_parentage_permissions
void CoreSyntax::write_parentage_permissions(void) {
    NodeType::allow_parentage_for_categories(L2_NCAT, CODE_NCAT);
    NodeType::allow_parentage_for_categories(CODE_NCAT, CODE_NCAT);
    NodeType::allow_parentage_for_categories(CODE_NCAT, LVALUE_NCAT);
    NodeType::allow_parentage_for_categories(CODE_NCAT, RVALUE_NCAT);
    NodeType::allow_parentage_for_categories(CODE_NCAT, COND_NCAT);
    NodeType::allow_parentage_for_categories(CODE_NCAT, UNKNOWN_NCAT);

    NodeType::allow_parentage_for_categories(COND_NCAT, COND_NCAT);
    NodeType::allow_parentage_for_categories(COND_NCAT, LVALUE_NCAT);
    NodeType::allow_parentage_for_categories(COND_NCAT, RVALUE_NCAT);
    NodeType::allow_parentage_for_categories(COND_NCAT, UNKNOWN_NCAT);
    NodeType::allow_parentage_for_categories(LVALUE_NCAT, COND_NCAT);
    NodeType::allow_parentage_for_categories(LVALUE_NCAT, LVALUE_NCAT);
    NodeType::allow_parentage_for_categories(LVALUE_NCAT, RVALUE_NCAT);
    NodeType::allow_parentage_for_categories(LVALUE_NCAT, UNKNOWN_NCAT);
    NodeType::allow_parentage_for_categories(RVALUE_NCAT, COND_NCAT);
    NodeType::allow_parentage_for_categories(RVALUE_NCAT, LVALUE_NCAT);
    NodeType::allow_parentage_for_categories(RVALUE_NCAT, RVALUE_NCAT);
    NodeType::allow_parentage_for_categories(RVALUE_NCAT, UNKNOWN_NCAT);
}

§3. Annotations. Itemising the baubles on a Christmas tree...

define ANNOTATION_PERMISSIONS_SYNTAX_CALLBACK CoreSyntax::write_permissions
void CoreSyntax::write_permissions(void) {
    Annotations::allow_for_category(L1_NCAT, clears_pronouns_ANNOT);
    Annotations::allow(HEADING_NT, embodying_heading_ANNOT);
    Annotations::allow(HEADING_NT, inclusion_of_extension_ANNOT);
    Annotations::allow(HEADING_NT, interpretation_of_subject_ANNOT);
    Annotations::allow(HEADING_NT, suppress_heading_dependencies_ANNOT);
    Annotations::allow(HEADING_NT, implied_heading_ANNOT);
    Annotations::allow_for_category(L1_NCAT, unit_ANNOT);

    Annotations::allow_for_category(L2_NCAT, clears_pronouns_ANNOT);
    Annotations::allow_for_category(L2_NCAT, interpretation_of_subject_ANNOT);
    Annotations::allow_for_category(L2_NCAT, verb_problem_issued_ANNOT);
    Annotations::allow(RULE_NT, indentation_level_ANNOT);
    Annotations::allow(SENTENCE_NT, implicit_in_creation_of_ANNOT);
    Annotations::allow(SENTENCE_NT, implicitness_count_ANNOT);
    Annotations::allow(SENTENCE_NT, you_can_ignore_ANNOT);
    Annotations::allow(SENTENCE_NT, classified_ANNOT);
    Annotations::allow_for_category(L2_NCAT, unit_ANNOT);
    LOOP_OVER_ENUMERATED_NTS(t)
        if (NodeType::has_flag(t, ASSERT_NFLAG))
            Annotations::allow(t, refined_ANNOT);

    Annotations::allow_for_category(L3_NCAT, unit_ANNOT);
    Annotations::allow_for_category(L3_NCAT, creation_proposition_ANNOT);
    Annotations::allow_for_category(L3_NCAT, evaluation_ANNOT);
    Annotations::allow_for_category(L3_NCAT, subject_ANNOT);
    Annotations::allow_for_category(L3_NCAT, explicit_gender_marker_ANNOT);
    Annotations::allow(ACTION_NT, action_meaning_ANNOT);
    Annotations::allow(ADJECTIVE_NT, predicate_ANNOT);
    Annotations::allow(VERB_NT, category_of_I6_translation_ANNOT);
    Annotations::allow(VERB_NT, rule_placement_sense_ANNOT);
    Annotations::allow(COMMON_NOUN_NT, action_meaning_ANNOT);
    Annotations::allow(COMMON_NOUN_NT, creation_site_ANNOT);
    Annotations::allow(COMMON_NOUN_NT, multiplicity_ANNOT);
    Annotations::allow(COMMON_NOUN_NT, quant_ANNOT);
    Annotations::allow(COMMON_NOUN_NT, quantification_parameter_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, predicate_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, creation_site_ANNOT);
    Annotations::allow(UNPARSED_NOUN_NT, defn_language_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, defn_language_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, lpe_options_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, multiplicity_ANNOT);
    Annotations::allow(UNPARSED_NOUN_NT, new_relation_here_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, new_relation_here_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, nowhere_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, quant_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, quantification_parameter_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, row_amendable_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, slash_dash_dash_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, table_cell_unspecified_ANNOT);
    Annotations::allow(PROPER_NOUN_NT, turned_already_ANNOT);
    Annotations::allow(TOKEN_NT, grammar_token_literal_ANNOT);
    Annotations::allow(TOKEN_NT, grammar_token_relation_ANNOT);
    Annotations::allow(TOKEN_NT, grammar_value_ANNOT);
    Annotations::allow(TOKEN_NT, slash_class_ANNOT);

    Annotations::allow_for_category(CODE_NCAT, colon_block_command_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, control_structure_used_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, end_control_structure_used_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, evaluation_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, indentation_level_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, kind_of_new_variable_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, kind_required_by_context_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, results_from_splitting_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, token_as_parsed_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, token_check_to_do_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, token_to_be_parsed_against_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, verb_problem_issued_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, problem_falls_under_ANNOT);
    Annotations::allow_for_category(CODE_NCAT, unit_ANNOT);
    Annotations::allow(INVOCATION_LIST_NT, from_text_substitution_ANNOT);
    Annotations::allow(INVOCATION_LIST_SAY_NT, suppress_newlines_ANNOT);
    Annotations::allow(INVOCATION_NT, epistemological_status_ANNOT);
    Annotations::allow(INVOCATION_NT, kind_resulting_ANNOT);
    Annotations::allow(INVOCATION_NT, kind_variable_declarations_ANNOT);
    Annotations::allow(INVOCATION_NT, modal_verb_ANNOT);
    Annotations::allow(INVOCATION_NT, phrase_invoked_ANNOT);
    Annotations::allow(INVOCATION_NT, phrase_options_invoked_ANNOT);
    Annotations::allow(INVOCATION_NT, say_adjective_ANNOT);
    Annotations::allow(INVOCATION_NT, say_verb_ANNOT);
    Annotations::allow(INVOCATION_NT, say_verb_negated_ANNOT);
    Annotations::allow(INVOCATION_NT, ssp_closing_segment_wn_ANNOT);
    Annotations::allow(INVOCATION_NT, ssp_segment_count_ANNOT);
    Annotations::allow(INVOCATION_NT, suppress_newlines_ANNOT);
    Annotations::allow(INVOCATION_NT, save_self_ANNOT);
    Annotations::allow(INVOCATION_NT, unproven_ANNOT);

    CoreSyntax::allow_annotation_to_specification(meaning_ANNOT);
    CoreSyntax::allow_annotation_to_specification(converted_SN_ANNOT);
    CoreSyntax::allow_annotation_to_specification(subject_term_ANNOT);
    CoreSyntax::allow_annotation_to_specification(epistemological_status_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_action_name_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_action_pattern_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_activity_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_binary_predicate_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_constant_phrase_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_enumeration_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_equation_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_grammar_verb_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_instance_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_named_action_pattern_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_named_rulebook_outcome_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_number_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_property_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_rule_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_rulebook_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_scene_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_table_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_table_column_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_text_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_use_option_ANNOT);
    Annotations::allow(CONSTANT_NT, constant_verb_form_ANNOT);
    Annotations::allow(CONSTANT_NT, explicit_literal_ANNOT);
    Annotations::allow(CONSTANT_NT, grammar_token_code_ANNOT);
    Annotations::allow(CONSTANT_NT, kind_of_value_ANNOT);
    Annotations::allow(CONSTANT_NT, nothing_object_ANNOT);
    Annotations::allow(CONSTANT_NT, property_name_used_as_noun_ANNOT);
    Annotations::allow(CONSTANT_NT, proposition_ANNOT);
    Annotations::allow(CONSTANT_NT, response_code_ANNOT);
    Annotations::allow(CONSTANT_NT, self_object_ANNOT);
    Annotations::allow(CONSTANT_NT, text_unescaped_ANNOT);
    Annotations::allow(LOCAL_VARIABLE_NT, constant_local_variable_ANNOT);
    Annotations::allow(LOCAL_VARIABLE_NT, kind_of_value_ANNOT);
    Annotations::allow(LOGICAL_TENSE_NT, condition_tense_ANNOT);
    Annotations::allow(LOGICAL_TENSE_NT, tense_marker_ANNOT);
    Annotations::allow(NONLOCAL_VARIABLE_NT, constant_nonlocal_variable_ANNOT);
    Annotations::allow(NONLOCAL_VARIABLE_NT, kind_of_value_ANNOT);
    Annotations::allow(PROPERTY_VALUE_NT, record_as_self_ANNOT);
    Annotations::allow(TEST_PHRASE_OPTION_NT, phrase_option_ANNOT);
    Annotations::allow(TEST_PROPOSITION_NT, proposition_ANNOT);
    Annotations::allow(UNKNOWN_NT, preposition_ANNOT);
    Annotations::allow(UNKNOWN_NT, verb_ANNOT);
}
void CoreSyntax::allow_annotation_to_specification(int annot) {
    Annotations::allow(UNKNOWN_NT, annot);
    Annotations::allow_for_category(LVALUE_NCAT, annot);
    Annotations::allow_for_category(RVALUE_NCAT, annot);
    Annotations::allow_for_category(COND_NCAT, annot);
}

§4.

define PARENTAGE_EXCEPTIONS_SYNTAX_CALLBACK CoreSyntax::parentage_exceptions
int CoreSyntax::parentage_exceptions(node_type_t t_parent, int cat_parent,
    node_type_t t_child, int cat_child) {
    if ((t_parent == PHRASE_TO_DECIDE_VALUE_NT) &&
        (t_child == INVOCATION_LIST_NT)) return TRUE;
    return FALSE;
}

§5.

define IMMUTABLE_NODE CoreSyntax::immutable
int CoreSyntax::immutable(node_type_t t) {
    if (t == UNKNOWN_NT) return FALSE;
    node_type_metadata *metadata = NodeType::get_metadata(t);
    if ((metadata) &&
        ((metadata->category == RVALUE_NCAT) ||
        (metadata->category == LVALUE_NCAT) ||
        (metadata->category == COND_NCAT))) return TRUE;
    return FALSE;
}

§6.

define IS_SENTENCE_NODE_SYNTAX_CALLBACK CoreSyntax::second_level
int CoreSyntax::second_level(node_type_t t) {
    node_type_metadata *metadata = NodeType::get_metadata(t);
    if ((metadata) && (metadata->category == L2_NCAT)) return TRUE;
    return FALSE;
}

§7.

enum action_meaning_ANNOT  action_pattern: meaning in parse tree when used as noun
enum predicate_ANNOT  unary_predicate: which adjective is asserted
enum category_of_I6_translation_ANNOT  int: what sort of "translates into I6" sentence this is
enum classified_ANNOT  int: this sentence has been classified
enum clears_pronouns_ANNOT  int: this sentence erases the current value of "it"
enum colon_block_command_ANNOT  int: this COMMAND uses the ":" not begin/end syntax
enum condition_tense_ANNOT  time_period: for specification nodes
enum constant_action_name_ANNOT  action_name: for constant values
enum constant_action_pattern_ANNOT  action_pattern: for constant values
enum constant_activity_ANNOT  activity: for constant values
enum constant_binary_predicate_ANNOT  binary_predicate: for constant values
enum constant_constant_phrase_ANNOT  constant_phrase: for constant values
enum constant_enumeration_ANNOT  int: which one from an enumerated kind
enum constant_equation_ANNOT  equation: for constant values
enum constant_grammar_verb_ANNOT  grammar_verb: for constant values
enum constant_instance_ANNOT  instance: for constant values
enum constant_local_variable_ANNOT  local_variable: for constant values
enum constant_named_action_pattern_ANNOT  named_action_pattern: for constant values
enum constant_named_rulebook_outcome_ANNOT  named_rulebook_outcome: for constant values
enum constant_nonlocal_variable_ANNOT  nonlocal_variable: for constant values
enum constant_number_ANNOT  int: which integer this is
enum constant_property_ANNOT  property: for constant values
enum constant_rule_ANNOT  rule: for constant values
enum constant_rulebook_ANNOT  rulebook: for constant values
enum constant_scene_ANNOT  scene: for constant values
enum constant_table_ANNOT  table: for constant values
enum constant_table_column_ANNOT  table_column: for constant values
enum constant_text_ANNOT  text_stream: for constant values
enum constant_use_option_ANNOT  use_option: for constant values
enum constant_verb_form_ANNOT  verb_form: for constant values
enum control_structure_used_ANNOT  control_structure_phrase: for CODE BLOCK nodes only
enum converted_SN_ANNOT  int: marking descriptions
enum creation_proposition_ANNOT  pcalc_prop: proposition which newly created value satisfies
enum creation_site_ANNOT  int: whether an instance was created from this node
enum defn_language_ANNOT  inform_language: what language this definition is in
enum end_control_structure_used_ANNOT  control_structure_phrase: for CODE BLOCK nodes only
enum epistemological_status_ANNOT  int: a bitmap of results from checking an ambiguous reading
enum evaluation_ANNOT  parse_node: result of evaluating the text
enum explicit_iname_ANNOT  inter_name: is this value explicitly an iname?
enum explicit_literal_ANNOT  int: my value is an explicit integer or text
enum from_text_substitution_ANNOT  int: whether this is an implicit say invocation
enum explicit_gender_marker_ANNOT   int: used by PROPER NOUN nodes for evident genders
enum grammar_token_code_ANNOT  int: used to identify grammar tokens
enum grammar_token_literal_ANNOT  int: for grammar tokens which are literal words
enum grammar_token_relation_ANNOT  binary_predicate: for relation tokens
enum grammar_value_ANNOT  parse_node: used as a marker when evaluating Understand grammar
enum implicit_in_creation_of_ANNOT  inference_subject: for assemblies
enum implicitness_count_ANNOT  int: keeping track of recursive assemblies
enum indentation_level_ANNOT  int: for routines written with Pythonesque indentation
enum interpretation_of_subject_ANNOT  inference_subject: subject, during passes
enum is_phrase_option_ANNOT  int: this unparsed text is a phrase option
enum kind_of_new_variable_ANNOT  kind: what if anything is returned
enum kind_of_value_ANNOT  kind: for specification nodes
enum kind_required_by_context_ANNOT  kind: what if anything is expected here
enum kind_resulting_ANNOT  kind: what if anything is returned
enum kind_variable_declarations_ANNOT  kind_variable_declaration: and of these
enum rule_placement_sense_ANNOT  int: are we listing a rule into something, or out of it?
enum lpe_options_ANNOT  int: options set for a literal pattern part
enum modal_verb_ANNOT  verb_conjugation: relevant only for that: e.g., "might"
enum multiplicity_ANNOT  int: e.g., 5 for "five gold rings"
enum new_relation_here_ANNOT  binary_predicate: new relation as subject of "relates" sentence
enum nothing_object_ANNOT  int: this represents nothing at run-time
enum nowhere_ANNOT  int: used by the spatial plugin to show this represents "nowhere"
enum phrase_invoked_ANNOT  phrase: the phrase believed to be invoked...
enum phrase_option_ANNOT  int: \(2^i\) where \(i\) is the option number, \(0\leq i<16\)
enum phrase_options_invoked_ANNOT  invocation_options: details of any options used
enum property_name_used_as_noun_ANNOT  int: in ambiguous cases such as "open"
enum proposition_ANNOT  pcalc_prop: for specification nodes
enum quant_ANNOT  quantifier: for quantified excerpts like "three baskets"
enum quantification_parameter_ANNOT  int: e.g., 3 for "three baskets"
enum record_as_self_ANNOT  int: record recipient as self when writing this
enum refined_ANNOT  int: this subtree has had its nouns parsed
enum response_code_ANNOT  int: for responses only
enum results_from_splitting_ANNOT  int: node in a routine's parse tree from comma block notation
enum row_amendable_ANNOT  int: a candidate row for a table amendment
enum save_self_ANNOT  int: this invocation must save and preserve self at run-time
enum say_adjective_ANNOT  adjective: ...or the adjective to be agreed with by "say"
enum say_verb_ANNOT  verb_conjugation: ...or the verb to be conjugated by "say"
enum say_verb_negated_ANNOT  relevant only for that
enum self_object_ANNOT  int: this represents self at run-time
enum slash_class_ANNOT  int: used when partitioning grammar tokens
enum slash_dash_dash_ANNOT  int: used when partitioning grammar tokens
enum ssp_closing_segment_wn_ANNOT  int: identifier for the last of these, or -1
enum ssp_segment_count_ANNOT  int: number of subsequent complex-say phrases in stream
enum subject_ANNOT  inference_subject: what this node describes
enum suppress_newlines_ANNOT  int: whether the next say term runs on
enum table_cell_unspecified_ANNOT  int: used to mark table entries as unset
enum tense_marker_ANNOT  grammatical_usage: for specification nodes
enum text_unescaped_ANNOT  int: flag used only for literal texts
enum token_as_parsed_ANNOT  parse_node: what if anything is returned
enum token_check_to_do_ANNOT  parse_node: what if anything is returned
enum token_to_be_parsed_against_ANNOT  parse_node: what if anything is returned
enum turned_already_ANNOT  int: aliasing like "player" to "yourself" performed already
enum unit_ANNOT  compilation_unit: set only for headings, routines and sentences
enum unproven_ANNOT  int: this invocation needs run-time typechecking
enum verb_problem_issued_ANNOT  int: has a problem message about the primary verb been issued already?
enum you_can_ignore_ANNOT  int: for assertions now drained of meaning
DECLARE_ANNOTATION_FUNCTIONS(constant_activity, activity)
DECLARE_ANNOTATION_FUNCTIONS(constant_binary_predicate, binary_predicate)
DECLARE_ANNOTATION_FUNCTIONS(constant_constant_phrase, constant_phrase)
DECLARE_ANNOTATION_FUNCTIONS(constant_equation, equation)
DECLARE_ANNOTATION_FUNCTIONS(constant_instance, instance)
DECLARE_ANNOTATION_FUNCTIONS(constant_local_variable, local_variable)
DECLARE_ANNOTATION_FUNCTIONS(constant_named_rulebook_outcome, named_rulebook_outcome)
DECLARE_ANNOTATION_FUNCTIONS(constant_nonlocal_variable, nonlocal_variable)
DECLARE_ANNOTATION_FUNCTIONS(constant_property, property)
DECLARE_ANNOTATION_FUNCTIONS(constant_rule, rule)
DECLARE_ANNOTATION_FUNCTIONS(constant_rulebook, rulebook)
DECLARE_ANNOTATION_FUNCTIONS(constant_table_column, table_column)
DECLARE_ANNOTATION_FUNCTIONS(constant_table, table)
DECLARE_ANNOTATION_FUNCTIONS(constant_text, text_stream)
DECLARE_ANNOTATION_FUNCTIONS(constant_use_option, use_option)
DECLARE_ANNOTATION_FUNCTIONS(constant_verb_form, verb_form)

DECLARE_ANNOTATION_FUNCTIONS(condition_tense, time_period)
DECLARE_ANNOTATION_FUNCTIONS(control_structure_used, control_structure_phrase)
DECLARE_ANNOTATION_FUNCTIONS(creation_proposition, pcalc_prop)
DECLARE_ANNOTATION_FUNCTIONS(defn_language, inform_language)
DECLARE_ANNOTATION_FUNCTIONS(end_control_structure_used, control_structure_phrase)
DECLARE_ANNOTATION_FUNCTIONS(evaluation, parse_node)
DECLARE_ANNOTATION_FUNCTIONS(grammar_token_relation, binary_predicate)
DECLARE_ANNOTATION_FUNCTIONS(grammar_value, parse_node)
DECLARE_ANNOTATION_FUNCTIONS(implicit_in_creation_of, inference_subject)
DECLARE_ANNOTATION_FUNCTIONS(interpretation_of_subject, inference_subject)
DECLARE_ANNOTATION_FUNCTIONS(kind_of_new_variable, kind)
DECLARE_ANNOTATION_FUNCTIONS(kind_of_value, kind)
DECLARE_ANNOTATION_FUNCTIONS(kind_required_by_context, kind)
DECLARE_ANNOTATION_FUNCTIONS(kind_resulting, kind)
DECLARE_ANNOTATION_FUNCTIONS(kind_variable_declarations, kind_variable_declaration)
DECLARE_ANNOTATION_FUNCTIONS(explicit_iname, inter_name)
DECLARE_ANNOTATION_FUNCTIONS(modal_verb, verb_conjugation)
DECLARE_ANNOTATION_FUNCTIONS(new_relation_here, binary_predicate)
DECLARE_ANNOTATION_FUNCTIONS(phrase_invoked, phrase)
DECLARE_ANNOTATION_FUNCTIONS(phrase_options_invoked, invocation_options)
DECLARE_ANNOTATION_FUNCTIONS(predicate, unary_predicate)
DECLARE_ANNOTATION_FUNCTIONS(proposition, pcalc_prop)
DECLARE_ANNOTATION_FUNCTIONS(quant, quantifier)
DECLARE_ANNOTATION_FUNCTIONS(say_adjective, adjective)
DECLARE_ANNOTATION_FUNCTIONS(say_verb, verb_conjugation)
DECLARE_ANNOTATION_FUNCTIONS(subject, inference_subject)
DECLARE_ANNOTATION_FUNCTIONS(tense_marker, grammatical_usage)
DECLARE_ANNOTATION_FUNCTIONS(token_as_parsed, parse_node)
DECLARE_ANNOTATION_FUNCTIONS(token_check_to_do, parse_node)
DECLARE_ANNOTATION_FUNCTIONS(token_to_be_parsed_against, parse_node)
DECLARE_ANNOTATION_FUNCTIONS(unit, compilation_unit)

§8. So we itemise the pointer-valued annotations below, and the macro expands to provide their get and set functions:

MAKE_ANNOTATION_FUNCTIONS(constant_activity, activity)
MAKE_ANNOTATION_FUNCTIONS(constant_binary_predicate, binary_predicate)
MAKE_ANNOTATION_FUNCTIONS(constant_constant_phrase, constant_phrase)
MAKE_ANNOTATION_FUNCTIONS(constant_equation, equation)
MAKE_ANNOTATION_FUNCTIONS(constant_instance, instance)
MAKE_ANNOTATION_FUNCTIONS(constant_local_variable, local_variable)
MAKE_ANNOTATION_FUNCTIONS(constant_named_rulebook_outcome, named_rulebook_outcome)
MAKE_ANNOTATION_FUNCTIONS(constant_nonlocal_variable, nonlocal_variable)
MAKE_ANNOTATION_FUNCTIONS(constant_property, property)
MAKE_ANNOTATION_FUNCTIONS(constant_rule, rule)
MAKE_ANNOTATION_FUNCTIONS(constant_rulebook, rulebook)
MAKE_ANNOTATION_FUNCTIONS(constant_table_column, table_column)
MAKE_ANNOTATION_FUNCTIONS(constant_table, table)
MAKE_ANNOTATION_FUNCTIONS(constant_text, text_stream)
MAKE_ANNOTATION_FUNCTIONS(constant_use_option, use_option)
MAKE_ANNOTATION_FUNCTIONS(constant_verb_form, verb_form)

MAKE_ANNOTATION_FUNCTIONS(condition_tense, time_period)
MAKE_ANNOTATION_FUNCTIONS(control_structure_used, control_structure_phrase)
MAKE_ANNOTATION_FUNCTIONS(creation_proposition, pcalc_prop)
MAKE_ANNOTATION_FUNCTIONS(defn_language, inform_language)
MAKE_ANNOTATION_FUNCTIONS(end_control_structure_used, control_structure_phrase)
MAKE_ANNOTATION_FUNCTIONS(evaluation, parse_node)
MAKE_ANNOTATION_FUNCTIONS(grammar_token_relation, binary_predicate)
MAKE_ANNOTATION_FUNCTIONS(grammar_value, parse_node)
MAKE_ANNOTATION_FUNCTIONS(implicit_in_creation_of, inference_subject)
MAKE_ANNOTATION_FUNCTIONS(interpretation_of_subject, inference_subject)
MAKE_ANNOTATION_FUNCTIONS(kind_of_new_variable, kind)
MAKE_ANNOTATION_FUNCTIONS(kind_of_value, kind)
MAKE_ANNOTATION_FUNCTIONS(kind_required_by_context, kind)
MAKE_ANNOTATION_FUNCTIONS(kind_resulting, kind)
MAKE_ANNOTATION_FUNCTIONS(kind_variable_declarations, kind_variable_declaration)
MAKE_ANNOTATION_FUNCTIONS(modal_verb, verb_conjugation)
MAKE_ANNOTATION_FUNCTIONS(new_relation_here, binary_predicate)
MAKE_ANNOTATION_FUNCTIONS(phrase_invoked, phrase)
MAKE_ANNOTATION_FUNCTIONS(phrase_options_invoked, invocation_options)
MAKE_ANNOTATION_FUNCTIONS(predicate, unary_predicate)
MAKE_ANNOTATION_FUNCTIONS(proposition, pcalc_prop)
MAKE_ANNOTATION_FUNCTIONS(quant, quantifier)
MAKE_ANNOTATION_FUNCTIONS(say_adjective, adjective)
MAKE_ANNOTATION_FUNCTIONS(say_verb, verb_conjugation)
MAKE_ANNOTATION_FUNCTIONS(subject, inference_subject)
MAKE_ANNOTATION_FUNCTIONS(tense_marker, grammatical_usage)
MAKE_ANNOTATION_FUNCTIONS(token_as_parsed, parse_node)
MAKE_ANNOTATION_FUNCTIONS(token_check_to_do, parse_node)
MAKE_ANNOTATION_FUNCTIONS(token_to_be_parsed_against, parse_node)

§9. And we have declare all of those:

void CoreSyntax::declare_annotations(void) {
    Annotations::declare_type(constant_activity_ANNOT, NULL);
    Annotations::declare_type(constant_binary_predicate_ANNOT, NULL);
    Annotations::declare_type(constant_constant_phrase_ANNOT, NULL);
    Annotations::declare_type(constant_equation_ANNOT, NULL);
    Annotations::declare_type(constant_instance_ANNOT,
        CoreSyntax::write_constant_instance_ANNOT);
    Annotations::declare_type(constant_local_variable_ANNOT,
        CoreSyntax::write_constant_local_variable_ANNOT);
    Annotations::declare_type(constant_named_rulebook_outcome_ANNOT, NULL);
    Annotations::declare_type(constant_nonlocal_variable_ANNOT,
        CoreSyntax::write_constant_nonlocal_variable_ANNOT);
    Annotations::declare_type(constant_property_ANNOT, NULL);
    Annotations::declare_type(constant_rule_ANNOT, NULL);
    Annotations::declare_type(constant_rulebook_ANNOT, NULL);
    Annotations::declare_type(constant_table_ANNOT, NULL);
    Annotations::declare_type(constant_table_column_ANNOT, NULL);
    Annotations::declare_type(constant_text_ANNOT, NULL);
    Annotations::declare_type(constant_use_option_ANNOT, NULL);
    Annotations::declare_type(constant_verb_form_ANNOT, NULL);
    #ifdef IF_MODULE
    IFModule::declare_annotations();
    #endif
    Annotations::declare_type(action_meaning_ANNOT, NULL);
    Annotations::declare_type(predicate_ANNOT, NULL);
    Annotations::declare_type(category_of_I6_translation_ANNOT, NULL);
    Annotations::declare_type(classified_ANNOT, NULL);
    Annotations::declare_type(clears_pronouns_ANNOT, NULL);
    Annotations::declare_type(colon_block_command_ANNOT, NULL);
    Annotations::declare_type(condition_tense_ANNOT,
        CoreSyntax::write_condition_tense_ANNOT);
    Annotations::declare_type(constant_enumeration_ANNOT, NULL);
    Annotations::declare_type(constant_number_ANNOT, NULL);
    Annotations::declare_type(control_structure_used_ANNOT,
        CoreSyntax::write_control_structure_used_ANNOT);
    Annotations::declare_type(converted_SN_ANNOT, NULL);
    Annotations::declare_type(creation_proposition_ANNOT,
        CoreSyntax::write_creation_proposition_ANNOT);
    Annotations::declare_type(creation_site_ANNOT,
        CoreSyntax::write_creation_site_ANNOT);
    Annotations::declare_type(defn_language_ANNOT,
        CoreSyntax::write_defn_language_ANNOT);
    Annotations::declare_type(end_control_structure_used_ANNOT, NULL);
    Annotations::declare_type(epistemological_status_ANNOT, NULL);
    Annotations::declare_type(evaluation_ANNOT,
        CoreSyntax::write_evaluation_ANNOT);
    Annotations::declare_type(explicit_iname_ANNOT, NULL);
    Annotations::declare_type(explicit_literal_ANNOT, NULL);
    Annotations::declare_type(from_text_substitution_ANNOT, NULL);
    Annotations::declare_type(explicit_gender_marker_ANNOT, NULL);
    Annotations::declare_type(grammar_token_code_ANNOT, NULL);
    Annotations::declare_type(grammar_token_literal_ANNOT, NULL);
    Annotations::declare_type(grammar_token_relation_ANNOT, NULL);
    Annotations::declare_type(grammar_value_ANNOT, NULL);
    Annotations::declare_type(implicit_in_creation_of_ANNOT, NULL);
    Annotations::declare_type(implicitness_count_ANNOT, NULL);
    Annotations::declare_type(indentation_level_ANNOT,
        CoreSyntax::write_indentation_level_ANNOT);
    Annotations::declare_type(interpretation_of_subject_ANNOT, NULL);
    Annotations::declare_type(is_phrase_option_ANNOT, NULL);
    Annotations::declare_type(kind_of_new_variable_ANNOT,
        CoreSyntax::write_kind_of_new_variable_ANNOT);
    Annotations::declare_type(kind_of_value_ANNOT,
        CoreSyntax::write_kind_of_value_ANNOT);
    Annotations::declare_type(kind_required_by_context_ANNOT,
        CoreSyntax::write_kind_required_by_context_ANNOT);
    Annotations::declare_type(kind_resulting_ANNOT, NULL);
    Annotations::declare_type(kind_variable_declarations_ANNOT, NULL);
    Annotations::declare_type(rule_placement_sense_ANNOT, NULL);
    Annotations::declare_type(lpe_options_ANNOT, NULL);
    Annotations::declare_type(modal_verb_ANNOT, NULL);
    Annotations::declare_type(multiplicity_ANNOT,
        CoreSyntax::write_multiplicity_ANNOT);
    Annotations::declare_type(new_relation_here_ANNOT, NULL);
    Annotations::declare_type(nothing_object_ANNOT,
        CoreSyntax::write_nothing_object_ANNOT);
    Annotations::declare_type(nowhere_ANNOT, NULL);
    Annotations::declare_type(phrase_invoked_ANNOT, NULL);
    Annotations::declare_type(phrase_option_ANNOT, NULL);
    Annotations::declare_type(phrase_options_invoked_ANNOT, NULL);
    Annotations::declare_type(property_name_used_as_noun_ANNOT, NULL);
    Annotations::declare_type(proposition_ANNOT,
        CoreSyntax::write_proposition_ANNOT);
    Annotations::declare_type(quant_ANNOT, NULL);
    Annotations::declare_type(quantification_parameter_ANNOT, NULL);
    Annotations::declare_type(record_as_self_ANNOT, NULL);
    Annotations::declare_type(refined_ANNOT, NULL);
    Annotations::declare_type(response_code_ANNOT, NULL);
    Annotations::declare_type(results_from_splitting_ANNOT, NULL);
    Annotations::declare_type(row_amendable_ANNOT, NULL);
    Annotations::declare_type(save_self_ANNOT, NULL);
    Annotations::declare_type(say_adjective_ANNOT, NULL);
    Annotations::declare_type(say_verb_ANNOT, NULL);
    Annotations::declare_type(say_verb_negated_ANNOT, NULL);
    Annotations::declare_type(self_object_ANNOT,
        CoreSyntax::write_self_object_ANNOT);
    Annotations::declare_type(slash_class_ANNOT,
        CoreSyntax::write_slash_class_ANNOT);
    Annotations::declare_type(slash_dash_dash_ANNOT,
        CoreSyntax::write_slash_dash_dash_ANNOT);
    Annotations::declare_type(ssp_closing_segment_wn_ANNOT, NULL);
    Annotations::declare_type(ssp_segment_count_ANNOT, NULL);
    Annotations::declare_type(subject_ANNOT, NULL);
    Annotations::declare_type(suppress_newlines_ANNOT, NULL);
    Annotations::declare_type(table_cell_unspecified_ANNOT, NULL);
    Annotations::declare_type(tense_marker_ANNOT, NULL);
    Annotations::declare_type(text_unescaped_ANNOT, NULL);
    Annotations::declare_type(token_as_parsed_ANNOT, NULL);
    Annotations::declare_type(token_check_to_do_ANNOT, NULL);
    Annotations::declare_type(token_to_be_parsed_against_ANNOT, NULL);
    Annotations::declare_type(turned_already_ANNOT, NULL);
    Annotations::declare_type(unit_ANNOT, NULL);
    Annotations::declare_type(unproven_ANNOT, NULL);
    Annotations::declare_type(verb_problem_issued_ANNOT, NULL);
    Annotations::declare_type(you_can_ignore_ANNOT, NULL);
}

§10.

void CoreSyntax::write_action_meaning_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_predicate_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_category_of_I6_translation_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_classified_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_clears_pronouns_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_colon_block_command_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_condition_tense_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_condition_tense(p)) {
        WRITE(" {condition tense: ");
        Occurrence::log(OUT, Node::get_condition_tense(p));
        WRITE("}");
    }
}
void CoreSyntax::write_constant_action_name_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_action_pattern_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_activity_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_binary_predicate_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_constant_phrase_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_enumeration_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_equation_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_grammar_verb_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_instance_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_constant_instance(p)) {
        WRITE(" {instance: ");
        Instances::write(OUT, Node::get_constant_instance(p));
        WRITE("}");
    }
}
void CoreSyntax::write_constant_local_variable_ANNOT(text_stream *OUT, parse_node *p) {
    local_variable *lvar = Node::get_constant_local_variable(p);
    if (lvar) {
        WRITE(" {local: ");
        LocalVariables::write(OUT, lvar);
        WRITE(" ");
        Kinds::Textual::write(OUT, LocalVariables::unproblematic_kind(lvar));
        WRITE("}");
    }
}
void CoreSyntax::write_constant_named_action_pattern_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_named_rulebook_outcome_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_nonlocal_variable_ANNOT(text_stream *OUT, parse_node *p) {
    nonlocal_variable *q = Node::get_constant_nonlocal_variable(p);
    if (q) {
        WRITE(" {nonlocal: ");
        NonlocalVariables::write(OUT, q);
        WRITE("}");
    }
}
void CoreSyntax::write_constant_number_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_property_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_rule_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_rulebook_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_scene_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_table_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_table_column_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_text_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_use_option_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_constant_verb_form_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_control_structure_used_ANNOT(text_stream *OUT, parse_node *p) {
    control_structure_phrase *csp = Node::get_control_structure_used(p);
    if (csp) {
        WRITE(" {"); ControlStructures::log(OUT, csp); WRITE("}");
    }
}
void CoreSyntax::write_converted_SN_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_creation_proposition_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_creation_proposition(p))
        WRITE(" {creation: $D}", Node::get_creation_proposition(p));
}
void CoreSyntax::write_creation_site_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, creation_site_ANNOT))
        WRITE(" {created here}");
}
void CoreSyntax::write_defn_language_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_defn_language(p))
        WRITE(" {language: %J}", Node::get_defn_language(p));
}
void CoreSyntax::write_end_control_structure_used_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_epistemological_status_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_evaluation_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_evaluation(p))
        WRITE(" {eval: $P}", Node::get_evaluation(p));
}
void CoreSyntax::write_explicit_iname_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_explicit_literal_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_from_text_substitution_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_explicit_gender_marker_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_grammar_token_code_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_grammar_token_literal_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_grammar_token_relation_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_grammar_value_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_implicit_in_creation_of_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_implicitness_count_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_indentation_level_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, indentation_level_ANNOT) > 0)
        WRITE(" {indent: %d}", Annotations::read_int(p, indentation_level_ANNOT));
}
void CoreSyntax::write_interpretation_of_subject_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_is_phrase_option_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_kind_of_new_variable_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_kind_of_new_variable(p)) {
        WRITE(" {new var: ");
        Kinds::Textual::write(OUT, Node::get_kind_of_new_variable(p));
        WRITE("}");
    }
}
void CoreSyntax::write_kind_of_value_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_kind_of_value(p)) {
        WRITE(" {kind: ");
        Kinds::Textual::write(OUT, Node::get_kind_of_value(p));
        WRITE("}");
    }
}
void CoreSyntax::write_kind_required_by_context_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_kind_required_by_context(p)) {
        WRITE(" {required: ");
        Kinds::Textual::write(OUT, Node::get_kind_required_by_context(p));
        WRITE("}");
    }
}
void CoreSyntax::write_kind_resulting_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_kind_variable_declarations_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_rule_placement_sense_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_lpe_options_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_modal_verb_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_multiplicity_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, multiplicity_ANNOT))
        WRITE(" {multiplicity %d}", Annotations::read_int(p, multiplicity_ANNOT));
}
void CoreSyntax::write_new_relation_here_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_nothing_object_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, nothing_object_ANNOT)) LOG(" {nothing}");
}
void CoreSyntax::write_nowhere_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_phrase_invoked_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_phrase_option_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_phrase_options_invoked_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_property_name_used_as_noun_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_proposition_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_proposition(p)) {
        WRITE(" {proposition: ");
        Propositions::write(OUT, Node::get_proposition(p));
        WRITE("}");
    }
}
void CoreSyntax::write_quant_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_quantification_parameter_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_record_as_self_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_refined_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_response_code_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_results_from_splitting_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_row_amendable_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_save_self_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_say_adjective_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_say_verb_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_say_verb_negated_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_self_object_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, self_object_ANNOT)) LOG(" {self}");
}
void CoreSyntax::write_slash_class_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, slash_class_ANNOT) > 0)
        WRITE(" {slash: %d}", Annotations::read_int(p, slash_class_ANNOT));
}
void CoreSyntax::write_slash_dash_dash_ANNOT(text_stream *OUT, parse_node *p) {
    if (Annotations::read_int(p, slash_dash_dash_ANNOT) > 0)
        WRITE(" {slash-dash-dash: %d}", Annotations::read_int(p, slash_dash_dash_ANNOT));
}
void CoreSyntax::write_ssp_closing_segment_wn_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_ssp_segment_count_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_subject_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_subject(p))
        WRITE(" {refers: $j}", Node::get_subject(p));
}
void CoreSyntax::write_suppress_newlines_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_table_cell_unspecified_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_tense_marker_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_text_unescaped_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_token_as_parsed_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_token_check_to_do_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_token_to_be_parsed_against_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_turned_already_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_unit_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_unproven_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_verb_problem_issued_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}
void CoreSyntax::write_you_can_ignore_ANNOT(text_stream *OUT, parse_node *p) {
    WRITE("{}", Annotations::read_int(p, heading_level_ANNOT));
}

§11.

define ANNOTATION_COPY_SYNTAX_CALLBACK CoreSyntax::copy_annotations
void CoreSyntax::copy_annotations(parse_node_annotation *to, parse_node_annotation *from) {
    if (from->annotation_id == proposition_ANNOT)
        to->annotation_pointer =
            STORE_POINTER_pcalc_prop(
                Propositions::copy(
                    RETRIEVE_POINTER_pcalc_prop(
                        from->annotation_pointer)));
}