The T compiler uses the latest version of gcc
to compile the latest version of C, but also requires doxygen
, texlive
, graphviz
, and texlive-latex-extra
to build documentation and typeset the standard.
To build the compiler, run make
(optionally with -j
to parallelize). This builds a lightly-optimized release version, and runs the tests.
The compiler follows the standard pass structure, modified to support context-sensitive parsing:
- arguments are parsed and the list of files to process is constructed
- the files are parsed into an AST without type information (see
src/main/parser/parser.c
for more details about how this is done) - the AST is traversed and type information is added
- the AST is converted into an IR
- the IR is converted into assembly
- the resulting assembly is written out
misc
contains miscellaneous filessrc
contains the source code for the compiler and its testsmain
contains the compilerarch
contains architecture-specific code in subfolders, as well as the generic interface for each architectureast
contains the definition of the abstract syntax tree, environments, symbol tables, and typesir
contains the definition of the intermediate representationlexer
contains the lexer - while this could be a subfolder ofparser
, it's usable on its own, so it remains separateoptimization
contains intermediate representation code optimizersparser
contains the parser and symbol table buildertranslation
contains the translation to IRtypechecker
contains the type checkerutil
contains various utility functionscontainer
contains data structures
test
contains tests and the test engine for the compilertests
contains the actual tests themselvesutil
contains utilities for tests
standard
contains the language standardtestFiles
contains files used for tests
The T Language Compiler uses clang-format as the code style enforcer. Your code style must match exactly with what clang-format generates. As per Google's C++ code style, indentation is in spaces, and one level of indent is two spaces. Doxygen is used to generate documentation. All header file declarations should have Doxygen documentation. Implementation file only declarations (static functions, etc.) may omit Doxygen documentation, but this is discouraged except in cases of truly trivial functions.