17 #include "ctu_bison.h"
29 if (ast == NULL) {
return mod_basename(fp, arena); }
33 : mod_basename(fp, arena);
46 [eCtuTagValues] = len,
48 [eCtuTagFunctions] = len,
49 [eCtuTagModules] = len,
51 [eCtuTagAttribs] = len,
52 [eCtuTagSuffixes] = len,
58 #define NEW_EVENT(name, ...) const diagnostic_t kEvent_##name = __VA_ARGS__;
62 #define NEW_EVENT(name, ...) &kEvent_##name,
66 static const char *
const kLangNames[] =
CT_LANG_EXTS(
"ct",
"ctu",
"cthulhu");
71 [eCtuTagFunctions] = 1,
75 [eCtuTagSuffixes] = 1,
79 #define DECL_TAG(id, val, name) [id] = (name),
89 .desc =
"Cthulhu language driver",
90 .author =
"Elliot Haisley",
95 .diagnostics = kDiagnosticTable,
96 .count =
sizeof(kDiagnosticTable) /
sizeof(
diagnostic_t*),
109 .ast_size =
sizeof(
ctu_t),
113 .fn_postparse = ctu_postparse,
114 .scanner = &kCallbacks,
#define CT_TEXT_VIEW(str)
create a text view from a string literal
CT_NODISCARD CT_PUREFN CT_SCAN_API const char * scan_path(const scan_t *scan)
get the path of a scanner
CT_BROKER_API void lang_add_unit(language_runtime_t *runtime, unit_id_t id, const node_t *node, void *ast, const size_t *sizes, size_t count)
all runtime apis
#define CT_LANG_EXTS(...)
CT_BROKER_API text_view_t build_unit_id(const vector_t *parts, arena_t *arena)
#define CT_NEW_VERSION(major, minor, patch)
creates a new ctu_version_t from major, minor and patch
#define CT_LANG_EXPORT(mod)
declares the entry point for a language driver module
#define CTASSERT(expr)
assert a condition, prints the condition as a message
CT_NODISCARD CT_STD_API char * str_basename(const char *path, arena_t *arena)
get the filename from a path
CT_NODISCARD CT_STD_API vector_t * vector_init(void *value, arena_t *arena)
create a new vector with a single initial value
CT_NODISCARD CT_PUREFN CT_STD_API size_t vector_len(const vector_t *vector)
get the length of a vector
void ctu_forward_decls(language_runtime_t *runtime, compile_unit_t *unit)
void ctu_process_imports(language_runtime_t *runtime, compile_unit_t *unit)
void ctu_init(language_runtime_t *runtime, tree_t *root)
CT_CALLBACKS(kCallbacks, ctu)
CT_DRIVER_API const language_t kCtuModule
arena_t * arena
default memory arena
a language driver support capabilities
module_info_t info
common information about the language
const char * id
unique id for the module
a generic vector of pointers