|
Cthulhu
0.2.10
Cthulhu compiler collection
|
data - various data filesdocs - documentationmeson - cross files for various platformsscripts - automation for arduous setup taskssrc - all source codecommon - common code. Common libraryarena - memory allocation arenas. Arena memory allocationbacktrace - backtrace retrieval. Stacktrace librarybase - base utils. Base libraryconfig - configuration values. Configurationcore - header only compiler specific code. Header only coreendian - endian handling, byteswaps. Endianess and byte swappingfs - filesystem abstraction. Filesystem abstractioninterop - flex & bison helper functions. Flex/Bison interop utilsio - file io abstraction. IO stream interfacenotify - error reporting tools. Compiler message notificationos - platform detail wrappers. Platform abstraction layerscan - flex & bison scanning tools. Source location trackingstd - collections and data structures. Standard librarycthulhu - compiler framework library. Compiler runtimebroker - common module communication setup. Compiler runtime mediatorcheck - validates state for various structures. Tree form validationemit - ssa emitter. emitevents - shared compiler events between languages. Compiler eventsmemory - global arena allocator. Global memory allocationssa - tree to ssa transformation. SSA form IRtree - common typed ast. Tree intermediate formutil - common utilities. Driver utility functionsfrontend - user facing components used to interact with drivers and the collectioncli - command line user interfaceexample - example usage of the runtimegui - graphical user interface built with imgui (partial)language - language frontendsdriver - language helper library. Driver helperc - C11 frontend (skeleton)pre - C preprocessorlang - C language driverctu - cthulhu language frontend (beta)example - example frontendjvm - jvm classfile consumer (skeleton)oberon - oberon-2 frontend (partial support)pl0 - pl0 frontend, good for referencing how to use the runtime (dare I say production ready)loader - language module enumeration and loadingsupport - support library for frontends and interating with the broker. Module loaderplugins - compiler pluginssupport - utility libraries. Support libraries for languages, plugins, and frontendsargparse - command line argument parsing. Command line argument parsingdriver - support library for creating language drivers. Driver helperformat - text formatting for displaying to a user. User facing text formatting librarygluon - small build system implementation, similar to meson (skeleton)json - json parsing library, does not currently support writing. JSON parsingmeta - dsl for generating compiler data structuressetup - default options for command line tools. setuptoml - toml parser (TODO)target - codegen target librariescfamily - C and C++ codegendebug - debug outputhlsl - hlsl shader targettools - supporting tools and test utilitiesdiagnostic - diagnostic listing and querying tooldisplay - example config displayerror - test tool for examining stacktracesharness - test harness for end to end language testsmeson_ctu - an implementation of meson that is aware of cthulhunotify - testing notification formattingsubprojects - dependenciesmini-gmp - fallback gmp library if system gmp isnt installedtests - testslang - language specific testsunit - compiler code unit testsWhen adding a new module consider how much of the compiler needs access to it. Treat levels of access as if they were permission levels, with Common library being the highest level. If a library will only ever be used by a user facing tool, it should be part of the Support libraries for languages, plugins, and frontends set of modules. When a module needs to be available to drivers it should be in Compiler runtime, the core compiler set. And if a module is going to be used extensively, and perhaps outside of the cthulhu project it should be placed in Common library.
_impl and namespace themio_buffer_impl_t instead of buffer_tos_read_impl instead of inner_readCthulhu aims to be usable as a library in embedded systems (read as: places without global malloc). As such we aim to only use user provided allocators, and to not use any global mechanisms for allocation.
In order of importance:
<type>_new and need a arena_t as the last parameter.map_new, vector_new, set_new etc<type>_init function should be provided when construction requires logicdelete function unless very necessary<type>_init function should be provided_new and _make functions may also be good depending on how commonly the type is used_init functions logicCthulhu also aims to be easy to port to more "exotic" systems, as such avoid relying on things that are not totally garunteed by the C specification.
[u]int_fastNN_t or [u]int_leastNN_t over [u]intNN_t as both the former types are always presentgmp or mpfr as they have consistent rounding rulessize_t and ptrdiff_t over fixed width types when managing sizesuintptr_t which is required to build the compiler, if or when its possible to remove this I willCTCTU_CTX_Source files contents should be layed out in the following order
const whenever its easy to do so#pragma once over include guards#define for constant unrelated values in headersstatic const for constant values in source filesenum for defining related constant valuesalloca, hard to debug, causes crashes very easilyvolatile, it doesnt do what you think it doessnake_case for rules<rule>_seq<rule>_list