# parser-core

**Kind:** Module

**Source:** [`parser-core`](https://github.com/sherkety/atloria/blob/main/parser-core#L1)

.NET project in solution

## Description

`parser-core` is a .NET project that provides the core parsing functionality used by the solution. It is responsible for transforming raw input into structured results that can be consumed by higher-level services, applications, or integration layers.

## Diagram

```mermaid
graph TD
    A[Raw Input] --> B[parser-core]
    B --> C[Tokenization / Validation]
    C --> D[Parsed Models]
    D --> E[Consumer Applications]
```

## Usage Example

```ts
import { execFile } from "node:child_process";
import { promisify } from "node:util";

const execFileAsync = promisify(execFile);

async function parseInput(inputFile: string) {
  const { stdout, stderr } = await execFileAsync(
    "dotnet",
    ["run", "--project", "parser-core", "--", inputFile],
  );

  if (stderr) {
    console.warn(stderr);
  }

  return JSON.parse(stdout);
}

const result = await parseInput("./input.txt");
console.log(result);
```

## AI Coding Instructions

- Keep parsing rules and domain parsing models inside `parser-core`; avoid duplicating parsing logic in consuming projects.
- Validate input early and return actionable parsing errors rather than allowing malformed input to reach downstream consumers.
- Preserve stable output models and error behavior, since other projects may depend on the parser's results.
- When adding syntax or input formats, add representative valid, invalid, and edge-case tests alongside the parser changes.
- Ensure consuming JavaScript or TypeScript integrations invoke the .NET project with the expected arguments and handle non-zero process exits.

## Referenced By

- `atloria` (MODULE_DECLARES)
