What shall we test?
define PROGRAM_NAME "calculus-test" enum INTERPRET_CLSW enum LOAD_CLSW
int main(int argc, char **argv) { Foundation::start(argc, argv); WordsModule::start(); SyntaxModule::start(); LexiconModule::start(); InflectionsModule::start(); LinguisticsModule::start(); KindsModule::start(); CalculusModule::start(); pathname *P = Pathnames::from_text(I"services"); P = Pathnames::down(P, I"calculus-test"); P = Pathnames::down(P, I"Tangled"); filename *S = Filenames::in(P, I"Syntax.preform"); LoadPreform::load(S, NULL); CommandLine::declare_heading( U"calculus-test: a tool for testing the calculus module\n"); CommandLine::declare_switch(LOAD_CLSW, U"load", 2, U"load kind definitions from file X"); CommandLine::declare_switch(INTERPRET_CLSW, U"interpret", 2, U"interpret REPL commands in file X"); CommandLine::read(argc, argv, NULL, &Main::respond, &Main::ignore); WordsModule::end(); SyntaxModule::end(); LexiconModule::end(); InflectionsModule::end(); LinguisticsModule::end(); KindsModule::end(); CalculusModule::end(); Foundation::end(); return 0; }
void Main::respond(int id, int val, text_stream *arg, void *state) { text_stream *save_DL = DL; DL = STDOUT; Streams::enable_debugging(DL); switch (id) { case LOAD_CLSW: NeptuneFiles::load(Filenames::from_text(arg)); break; case INTERPRET_CLSW: Declarations::load_from_file(arg); break; } DL = save_DL; } void Main::ignore(int id, text_stream *arg, void *state) { Errors::fatal("only switches may be used at the command line"); }
define DIVIDE_AT_COLON_SYNTAX_CALLBACK Main::dont
int Main::dont(int wn) { return FALSE; }
define TERM_DOMAIN_WORDING_FUNCTION Main::get_name_text define TERM_DOMAIN_FROM_KIND_FUNCTION Main::get_kind define TERM_DOMAIN_TO_KIND_FUNCTION Main::get_kind define VALUE_TO_KIND_FUNCTION Main::value_to_kind define RVALUE_TO_KIND_FUNCTION Main::value_to_kind define VALUE_TO_RELATION_FUNCTION Main::value_to_relation define NP_IS_DESCRIPTIVE Main::is_descriptive define NP_TO_PROPOSITION Main::to_proposition
wording Main::get_name_text(kind *K) { return EMPTY_WORDING; } kind *Main::get_kind(kind *K) { return K; } kind *Main::value_to_kind(parse_node *val) { return K_number; } binary_predicate *Main::value_to_relation(parse_node *val) { return NULL; } int Main::is_descriptive(parse_node *val) { return FALSE; } pcalc_prop *Main::to_proposition(parse_node *val) { return NULL; }
define EQUALITY_RELATION_NAME 0 define UNIVERSAL_RELATION_NAME 1 define POSSESSION_RELATION_NAME 2 define EMPTY_RELATION_NAME 3
<relation-names> ::= equality | universal | possession | never-holding
- This is Preform grammar, not regular C code.