feat: DSL parser, eval system, and project structure

- Hand-written lexer + recursive-descent parser for .kap package definitions
- Package constructs: const, license, provides, outputs, patches, depends
  (version-constrained, feature-gated, output-targeted), features (enabled/
  forced/flag), config files (default/replace/merge with cfg interpolation),
  env (?= soft-set), prepare/build/check/install phases
- Evaluator: recursive  resolver for prefix, jobopts, destdir, userargs,
  cfg.*, feature.*, package vars
- Comments: // single-line, /* */ multi-line
- /kappa/{bin,temp,db,system,system/builds} path layout
- Clang 22, C++23, CMake + vcpkg (tomlplusplus)
- .clangd + .clang-tidy configured
This commit is contained in:
2026-07-29 22:16:16 -04:00
parent 6fd31b694b
commit a8b53681fc
20 changed files with 1282 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "kappa/dsl/ast.hpp"
#include <string>
#include <string_view>
#include <unordered_map>
namespace kappa::eval {
enum class VarKind {
Unknown,
Builtin, // ${prefix}, ${jobs}, ${jobopts}, ${userargs}
Package, // ${version}, ${name}, ${source}
Config, // ${cfg.key}
Feature, // ${feature.key} → expanded flag or ""
};
struct ResolvedVar {
std::string value;
VarKind kind = VarKind::Unknown;
};
struct Scope {
std::unordered_map<std::string, std::string> builtins;
std::unordered_map<std::string, std::string> config;
std::unordered_map<std::string, dsl::FeatureDef> features;
std::unordered_map<std::string, std::string> package;
};
Scope make_default_scope();
ResolvedVar resolve(std::string_view name, const Scope& scope);
std::string interpolate(std::string_view input, const Scope& scope);
} // namespace kappa::eval