# configuration/constants/grammar.constants.ts

> 120 lines of code and 7 definitions.

Tree: Site tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/tree#file-configuration-constants-grammar-constants-ts
Source text: https://banes-lab.com/assets/sources/source.fd1dddf248337ee3dc3a5139f69fe301e32eb0f1f1ca3c2e19af3fc6613de27e.generated.txt

## Definitions

- `NARRATIVE` (lexical_declaration, line 39)
- `PAG_SEED` (lexical_declaration, line 40)
- `INTRODUCTION_GRAPH_SECTIONS` (lexical_declaration, line 42)
- `GUIDE_GRAPH_SECTIONS` (lexical_declaration, line 60)
- `REFERENCE_GRAPH_SECTIONS` (lexical_declaration, line 97)
- `VALIDATION_GRAPH_SECTIONS` (lexical_declaration, line 102)
- `GRAMMAR_GRAPH` (lexical_declaration, line 115, exported)

## Source

```typescript
import {
    AMBIGUITY_CONCEPT,
    CONSTRAINT_CONCEPT,
    DECLARATION_CONCEPT,
    DIRECTIVE_CONCEPT,
    GATE_SHAPE_CONCEPT,
    INSTRUCTION_CONTRACT_CONCEPT,
    INSTRUMENT_CONCEPT,
    LIMIT_CONCEPT,
    LOOP_CONCEPT,
    OPERATION_CONCEPT,
    PHASE_CONCEPT,
    UNKNOWN_CONCEPT,
    WELLFORMED_CONCEPT,
} from "#core/ids/concept.ids";
import {
    BNF_SECTION_ID,
    DEFINITION_SECTION_ID,
    INVOCATION_SECTION_ID,
    KEYWORD_SECTION_ID,
    LIMITATION_SECTION_ID,
    METHOD_SECTION_ID,
    PHASE_SECTION_ID,
    RATIONALE_SECTION_ID,
    START_SECTION_ID,
    STRUCTURE_SECTION_ID,
    VALIDATION_SECTION_ID,
    WELLFORMED_SECTION_ID,
    WRITING_SECTION_ID,
} from "#core/ids/grammar.ids";
import type { ContentGraph, GraphSection } from "#types/methodology.types";
import {
    ORCHESTRATION_GRAPH_SECTIONS,
    PATTERN_GRAPH_SECTIONS,
    TEMPLATE_GRAPH_SECTIONS,
} from "#configuration/constants/grammar.fragment.constants";
import { GRAMMAR_PAGE } from "#core/ids/page.ids";

const NARRATIVE: GraphSection = { narrative: true, requires: [], teaches: [], traces: [] };
const PAG_SEED = "pag-instruction-concern";

const INTRODUCTION_GRAPH_SECTIONS: Readonly<Record<string, GraphSection>> = {
    [DEFINITION_SECTION_ID]: {
        requires: [LOOP_CONCEPT],
        teaches: [INSTRUCTION_CONTRACT_CONCEPT],
        traces: [PAG_SEED, "descriptive_is_not_full_shaped"],
    },
    [RATIONALE_SECTION_ID]: {
        requires: [INSTRUCTION_CONTRACT_CONCEPT],
        teaches: [AMBIGUITY_CONCEPT],
        traces: [PAG_SEED, "uncertainty_is_stated"],
    },
    [METHOD_SECTION_ID]: {
        requires: [AMBIGUITY_CONCEPT],
        teaches: [INSTRUMENT_CONCEPT],
        traces: ["claims_are_lies", "one_entry_point_staged_pipeline", "report_is_the_state"],
    },
};

const GUIDE_GRAPH_SECTIONS: Readonly<Record<string, GraphSection>> = {
    [START_SECTION_ID]: {
        requires: [INSTRUCTION_CONTRACT_CONCEPT],
        teaches: [DIRECTIVE_CONCEPT],
        traces: [PAG_SEED, "schema_declared_structure"],
    },
    [STRUCTURE_SECTION_ID]: {
        requires: [DIRECTIVE_CONCEPT],
        teaches: [DECLARATION_CONCEPT],
        traces: [PAG_SEED, "type_assignment_is_spine"],
    },
    [INVOCATION_SECTION_ID]: {
        requires: [DIRECTIVE_CONCEPT],
        teaches: [OPERATION_CONCEPT],
        traces: [
            "slots_resolve_through_the_adapter",
            "slot_absence_is_honoured",
            "mechanism_transfers_catalogs_rederive",
        ],
    },
    [PHASE_SECTION_ID]: {
        requires: [DECLARATION_CONCEPT],
        teaches: [PHASE_CONCEPT],
        traces: [PAG_SEED, "severity_routes_never_orders"],
    },
    [WRITING_SECTION_ID]: {
        requires: [PHASE_CONCEPT],
        teaches: [CONSTRAINT_CONCEPT],
        traces: [PAG_SEED, "gate_constructs_not_literals"],
    },
    [WELLFORMED_SECTION_ID]: {
        requires: [CONSTRAINT_CONCEPT],
        teaches: [WELLFORMED_CONCEPT],
        traces: [PAG_SEED, "no_regex", "derived_not_heuristic"],
    },
};

const REFERENCE_GRAPH_SECTIONS: Readonly<Record<string, GraphSection>> = {
    [KEYWORD_SECTION_ID]: NARRATIVE,
    [BNF_SECTION_ID]: NARRATIVE,
};

const VALIDATION_GRAPH_SECTIONS: Readonly<Record<string, GraphSection>> = {
    [VALIDATION_SECTION_ID]: {
        requires: [PHASE_CONCEPT, UNKNOWN_CONCEPT],
        teaches: [GATE_SHAPE_CONCEPT],
        traces: [PAG_SEED, "findings_are_machine_actionable", "no_silent"],
    },
    [LIMITATION_SECTION_ID]: {
        requires: [OPERATION_CONCEPT],
        teaches: [LIMIT_CONCEPT],
        traces: ["slot_absence_is_honoured", "no_fallback", "no_hidden_nondeterminism"],
    },
};

export const GRAMMAR_GRAPH: ContentGraph = {
    page: GRAMMAR_PAGE,
    sections: {
        ...INTRODUCTION_GRAPH_SECTIONS,
        ...GUIDE_GRAPH_SECTIONS,
        ...ORCHESTRATION_GRAPH_SECTIONS,
        ...PATTERN_GRAPH_SECTIONS,
        ...REFERENCE_GRAPH_SECTIONS,
        ...VALIDATION_GRAPH_SECTIONS,
        ...TEMPLATE_GRAPH_SECTIONS,
    },
};
```
