How scrossuk/locic works
Project Type and Purpose
• This is a language compiler toolchain (“Loci Compiler Tools”). It’s a multi-stage compiler for the Loci programming language, built in C++ and relying on LLVM as a backend. Additionally it bundles:
• A standard library (stdlib/) and runtime support (runtime/) in Loci itself.
• Example programs (examples/) to illustrate language features.
• Documentation (docs/) describing language design and user guides.
• Tests (test/, unittests/) and utilities (utils/) to verify correctness of the compiler.
Top-Level Architecture
• Build system (CMake + submodules)
• Compiler driver (tools/locic.cpp, tools/loci-vtable.cpp)
• Compiler core subdivided into phases:
1. Lexical Analysis (locic/Lex)
2. Parsing (locic/Parser) → AST (locic/AST)
3. Semantic Analysis (locic/SemanticAnalysis)
4. Code Generation (locic/CodeGen) → LLVM IR + object code
• Linking with:
• Loci runtime library (runtime/)
• Loci standard library (stdlib/)
• 3rd-party API stubs (3rdparty/Qt, 3rdparty/SFML) for binding example GUIs.
• Tools & Tests:
• FileCheck utility (utils/FileCheck)
• Googletest harness (utils/googletest)
• Unit tests and integration tests (unittests/, test/)
Build & Deployment
• CMakeLists.txt and cmake/** configure build targets: compiler executable(s), runtime library, stdlib modules, tools, tests.
• External submodules (Qt, SFML) are integrated via CMake modules under 3rdparty/.
• Continuous integration configured in .travis.yml.
Diagramming Conventions
• Blue for compiler phases (frontend, semantic, codegen)
• Green for libraries (runtime, stdlib, 3rd-party)
• Orange for tools & tests
• Gray for build system
• Rectangles for modules/projects
• Parallelograms for data artifacts (source files, IR, binaries)