# Project Overview

- This project implements clingo 6, a reimplementation of clingo 5.
- The notes below might help with code contributions and probably also code
  generated by LLMs.

# Coding Style Guide

## Language and Formatting

- Use C++20.
- Use `clang-format` for automatic code formatting and indentation.
- Prefer brace initialization:
  - Example: `auto vec = std::vector<int>{1, 2, 3}`
  - Example: `auto cls = Class{x, y}`

## Naming Conventions

- Types use CamelCase, except for STL-like types.
- Variables and functions use snake_case.
- Private member variables end with an underscore (`_`).

## Type Usage

- Prefer `auto var = expression` where possible.
  - Exception: Use explicit types for numeric expressions if `static_cast`
    would be cumbersome.
  - Good: `auto const *x = "abc"`
  - Good: `int64_t x = 5`
  - Bad: `auto x = static_cast<int64_t>(5)`
- Place `const` after the type.
- Use `std::string_view` instead of `char const *` when possible (not strictly enforced).
- Be explict checking whether a pointer or unique_ptr is nullptr:
  - Good: `if (ptr != nullptr)`
  - Bad: `if (ptr)`
- Be explict checking whether an optional is empty:
  - Good: `if (opt.has_value())`
  - Good: `if (auto opt = expression; opt.has_value())`
  - Bad: `if (opt)`
  - Bad: `if (auto opt = expression)`

## Algorithms and Ranges

- Use range-based algorithms when possible.
  - Example: `std::ranges::sort(vec)`

## Class and Interface Design

- Use virtual private template methods named `do_<name>`, called by public
  interface methods.

## Documentation

- Use Doxygen comments with `//!` as the marker.
  - Start with a brief, one-line summary.
  - Add an extended description on the next line for complex functions.
  - Document parameters with `//! @param name description` (description should
    be brief, not a full sentence).
  - Document return values with `//! @return description` (brief, not a full
    sentence).
  - In C header files, mark parameters as `in`, `out`, or `inout` for public
    API clarity.
  - Document enumeration values and sometimes member variables inline using `//!<`.
  - Manually reflow long documentation lines for readability.
  - Logical blocks should be separated by a blank line including the parameter list.

## Notes

- `std::format` is currently not used.
