# typedgrammar/typed-japanese architecture

> Architecture diagram of the GitHub repository typedgrammar/typed-japanese, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/typedgrammar/typed-japanese
- Repository: https://github.com/typedgrammar/typed-japanese

## Overview

- DSL Core – This represents the central type-level engine. It includes the core grammatical rules and type definitions (located in src/ files such as index.d.ts and the various *-types.d.ts files).
- Verb System – Covers Godan, Ichidan, and Irregular verbs. Indicate components for conjugation forms (dictionary, ます形, て形, etc.) and the underlying transformation logic (using TypeScript’s conditional and template literal types).
- Adjective System – Include components for I-Adjectives and Na-Adjectives, together with the conjugation transformations.
- Other Grammar Elements – Such as noun types, adverbs, phrases, and particles. (Note these could be grouped or placed side-by-side if needed.)
- Examples/Demonstration Module – Represented as a distinct area (src/examples) which shows example usage of the DSL. This demonstrates how developers can “write” Japanese sentences and leverage the type-checker for correctness.
- Configuration and Build Infrastructure – Although not part of the DSL per se, include components for the development environment:
- Project Configuration Files (tsconfig.json, eslint.config.js, .eslintrc, package.json, pnpm-lock.yaml)
- CI/CD Pipeline (GitHub workflows from the .github/workflows/ci.yml file)

##### Technology and Frameworks
- That the entire project leverages TypeScript’s type system (i.e., no runtime logic) and relies on Node.js and pnpm for dependency management and testing.
- Use of CI/CD workflows (GitHub actions) which are used to enforce quality via tests and linting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Typed Japanese Library"]:::library
    B["DSL Core (Type-level Engine)"]:::core
    A --> B

    subgraph "Grammar Modules"
        subgraph "Verb System"
            V1["Godan Verbs"]:::grammar
            V2["Ichidan Verbs"]:::grammar
            V3["Irregular Verbs"]:::grammar
            V4["Conjugation Logic"]:::grammar
        end
        subgraph "Adjective System"
            A1["I-Adjectives"]:::grammar
            A2["Na-Adjectives"]:::grammar
            A3["Conjugation Logic"]:::grammar
        end
        subgraph "Phrase & Sentence Composition"
            P1["Noun Types"]:::grammar
            P2["Adverbs"]:::grammar
            P3["Phrases & Particles"]:::grammar
        end
    end

    %% DSL Core consumption by Grammar Modules
    B -->|"uses"| V4
    B -->|"extends"| A3
    B -->|"types"| P3

    E["Examples Module (Usage Demonstrations)"]:::example
    E -->|"typed_with"| B

    %% Development & CI sub-components
    subgraph "Development & CI"
        D1["package.json"]:::infra
        D2["tsconfig.json"]:::infra
        D3["eslint.config.js"]:::infra
        D4["pnpm-lock.yaml"]:::infra
        D5["CI Workflow"]:::infra
    end
    D1 -->|"build_feeds"| B

    X["External AI-Language Analysis"]:::external
    X -->|"integration"| B

    %% Styles
    classDef library fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef core fill:#a9cce3,stroke:#2471a3,stroke-width:2px;
    classDef grammar fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef example fill:#f5cba7,stroke:#d35400,stroke-width:2px;
    classDef infra fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
    classDef external fill:#e8daef,stroke:#8e44ad,stroke-width:2px;

    %% Click Events
    click B "https://github.com/typedgrammar/typed-japanese/blob/main/src/index.d.ts"
    click V4 "https://github.com/typedgrammar/typed-japanese/blob/main/src/verb-types.d.ts"
    click A3 "https://github.com/typedgrammar/typed-japanese/blob/main/src/adjective-types.d.ts"
    click P1 "https://github.com/typedgrammar/typed-japanese/blob/main/src/noun-types.d.ts"
    click P2 "https://github.com/typedgrammar/typed-japanese/blob/main/src/adverb-types.d.ts"
    click P3 "https://github.com/typedgrammar/typed-japanese/blob/main/src/phrase-types.d.ts"
    click E "https://github.com/typedgrammar/typed-japanese/tree/main/src/examples"
    click D1 "https://github.com/typedgrammar/typed-japanese/blob/main/package.json"
    click D2 "https://github.com/typedgrammar/typed-japanese/blob/main/tsconfig.json"
    click D3 "https://github.com/typedgrammar/typed-japanese/blob/main/eslint.config.js"
    click D4 "https://github.com/typedgrammar/typed-japanese/blob/main/pnpm-lock.yaml"
    click D5 "https://github.com/typedgrammar/typed-japanese/blob/main/.github/workflows/ci.yml"
```
