Setting up the use of this module.

§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:

define CALCULUS_MODULE TRUE

§2. This module defines the following classes:

enum i6_schema_CLASS
enum binary_predicate_CLASS
enum bp_family_CLASS
enum up_family_CLASS
enum pcalc_term_CLASS
enum pcalc_func_CLASS
enum pcalc_prop_CLASS
enum unary_predicate_CLASS
DECLARE_CLASS(binary_predicate)
DECLARE_CLASS(bp_family)
DECLARE_CLASS(up_family)
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(pcalc_func, 1000)
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(pcalc_term, 1000)
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(pcalc_prop, 1000)
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(unary_predicate, 1000)
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(i6_schema, 100)

§3. Like all modules, this one must define a start and end function:

enum PREDICATE_CALCULUS_DA
enum PREDICATE_CALCULUS_WORKINGS_DA
COMPILE_WRITER(i6_schema *, Calculus::Schemas::log)
COMPILE_WRITER(pcalc_prop *, Propositions::log)
COMPILE_WRITER(pcalc_prop *, Atoms::log)
COMPILE_WRITER(pcalc_term *, Terms::log)
COMPILE_WRITER(binary_predicate *, BinaryPredicates::log)
COMPILE_WRITER(unary_predicate *, UnaryPredicates::log)

void CalculusModule::start(void) {
    REGISTER_WRITER('D', Propositions::log);
    REGISTER_WRITER('i', Calculus::Schemas::log);
    REGISTER_WRITER('o', Atoms::log);
    REGISTER_WRITER('r', UnaryPredicates::log);
    REGISTER_WRITER('0', Terms::log);
    REGISTER_WRITER('2', BinaryPredicates::log);
    Log::declare_aspect(PREDICATE_CALCULUS_DA, U"predicate calculus", FALSE, FALSE);
    Log::declare_aspect(PREDICATE_CALCULUS_WORKINGS_DA, U"predicate calculus workings", FALSE, FALSE);
    Annotations::declare_type(subject_term_ANNOT,
        CalculusModule::write_subject_term_ANNOT);
    KindPredicates::start();
    Calculus::Equality::start();
}
void CalculusModule::end(void) {
}

§4. calculus provides one extra annotation for the syntax tree:

enum subject_term_ANNOT  pcalc_term: what the subject of the subtree was

§5.

DECLARE_ANNOTATION_FUNCTIONS(subject_term, pcalc_term)
MAKE_ANNOTATION_FUNCTIONS(subject_term, pcalc_term)

void CalculusModule::write_subject_term_ANNOT(text_stream *OUT, parse_node *p) {
    if (Node::get_subject_term(p)) {
        WRITE(" {term: ");
        Terms::write(OUT, Node::get_subject_term(p));
        WRITE("}");
    }
}

§6. We also have to make annotation functions for one special annotation needed by linguistics:

DECLARE_ANNOTATION_FUNCTIONS(relationship, binary_predicate)

§7.

MAKE_ANNOTATION_FUNCTIONS(relationship, binary_predicate)