# `Ksc`
[🔗](https://github.com/PJUllrich/ksc/blob/v0.1.0/lib/ksc.ex#L1)

Kaitai Struct Compiler for Elixir.

Compiles .ksy files into Elixir modules that can parse binary data.

# `compile`

Compile a .ksy file into an Elixir source code string.

Options:
  - `:namespace` — module namespace prefix to apply to all generated modules

# `compile_and_load`

Compile a .ksy file and load the resulting module into the VM.
Returns {:ok, module_atom} on success.

Options:
  - `:namespace` — module namespace prefix to apply to all generated modules

# `compile_string_and_load`

Compile a KSY YAML string and load the resulting module.

Options:
  - `:namespace` — module namespace prefix to apply to the generated module

# `compile_to_files`

Compile one or more .ksy files and write each top-level module as a separate .ex file.

- `input_path` — a single `.ksy` file or a directory containing `.ksy` files
- `output_dir` — directory where `.ex` files are written (created if it doesn't exist)
- `opts` — keyword list of options:
  - `:namespace` — module namespace prefix (default: `"Ksc.Compiled"`)

Returns `{:ok, [written_file_paths]}` or `{:error, reason}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
