# abh80/zenith architecture

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

- Interactive diagram: https://gitdiagram.com/abh80/zenith
- Repository: https://github.com/abh80/zenith

## Overview

##### Project type and purpose
- This is a compiler‐style project (a “transpiler”) written in Scala, built with sbt.
- Purpose: read source code in the new language, perform lexing and parsing into an AST, then emit equivalent code in one or more target languages.

##### File structure
- Top level:
- build.sbt and project/* → sbt build configuration
- src/main/scala → all compiler code, divided into three packages:
– ast → definitions of AST node types
– syntax → Reader, Lexer, Parser, and Context (parsing pipeline)
– util → supporting utilities (character handling, error/Problem reporting, Result wrappers)
- No codegen package yet, but the AST is defined to be a foundation for later transpilation.

##### README
- Confirms “Yet another programming language portable to other languages (Transpiler precisely).”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    CLI["CLI / Entry Point"]:::interface

    %% Parsing Pipeline
    Reader["Reader\nsrc/main/scala/syntax/Reader.scala"]:::parsing
    Lexer["Lexer\nsrc/main/scala/syntax/Lexer.scala"]:::parsing
    Parser["Parser\nsrc/main/scala/syntax/Parser.scala"]:::parsing
    Context["Context\nsrc/main/scala/syntax/Context.scala"]:::parsing
    TokenDef["Token Definitions\nsrc/main/scala/syntax/Token.scala"]:::parsing

    %% AST Module
    ASTModule["AST Module\nAst.scala, AstNode.scala,\nAstLiteral.scala, Declaration.scala,\nExpression.scala, Locations.scala"]:::ast

    %% Codegen / Transpiler
    Codegen["Codegen / Transpiler (future)"]:::codegen
    Backend1["Target Backend A"]:::codegen
    Backend2["Target Backend B"]:::codegen

    %% Output Writer
    Output["Output Writer (future)"]:::codegen

    %% Utilities
    CharsUtil["CharsUtil\nsrc/main/scala/util/CharsUtil.scala"]:::util
    LocationUtil["Location\nsrc/main/scala/util/Location.scala"]:::util
    ProblemUtil["Problem\nsrc/main/scala/util/Problem.scala"]:::util
    ResultUtil["Result\nsrc/main/scala/util/Result.scala"]:::util

    %% Data Flow
    CLI --> Reader
    Reader --> Lexer
    Lexer --> Parser
    Parser --> ASTModule
    ASTModule --> Codegen
    Codegen --> Backend1
    Codegen --> Backend2
    Backend1 --> Output
    Backend2 --> Output

    %% Utility Dependencies
    CharsUtil -.-> Reader
    CharsUtil -.-> Lexer
    LocationUtil -.-> Reader
    LocationUtil -.-> Parser
    ProblemUtil -.-> Reader
    ProblemUtil -.-> Lexer
    ProblemUtil -.-> Parser
    ProblemUtil -.-> ASTModule
    ResultUtil -.-> Parser
    ResultUtil -.-> ASTModule
    ResultUtil -.-> Codegen

    %% Click Events
    click Reader "https://github.com/abh80/zenith/blob/master/src/main/scala/syntax/Reader.scala"
    click Lexer "https://github.com/abh80/zenith/blob/master/src/main/scala/syntax/Lexer.scala"
    click Parser "https://github.com/abh80/zenith/blob/master/src/main/scala/syntax/Parser.scala"
    click Context "https://github.com/abh80/zenith/blob/master/src/main/scala/syntax/Context.scala"
    click TokenDef "https://github.com/abh80/zenith/blob/master/src/main/scala/syntax/Token.scala"
    click CharsUtil "https://github.com/abh80/zenith/blob/master/src/main/scala/util/CharsUtil.scala"
    click LocationUtil "https://github.com/abh80/zenith/blob/master/src/main/scala/util/Location.scala"
    click ProblemUtil "https://github.com/abh80/zenith/blob/master/src/main/scala/util/Problem.scala"
    click ResultUtil "https://github.com/abh80/zenith/blob/master/src/main/scala/util/Result.scala"
    click ASTModule "https://github.com/abh80/zenith/tree/master/src/main/scala/ast"

    %% Styles
    classDef parsing fill:#a2fca2,stroke:#006600,color:#000;
    classDef ast fill:#a2c5f9,stroke:#003399,color:#000;
    classDef codegen fill:#f9a02c,stroke:#994400,color:#000;
    classDef util fill:#d3d3d3,stroke:#666666,color:#000;
    classDef interface fill:#ffffff,stroke:#000000,color:#000,stroke-width:2px,stroke-dasharray: 5 5;
```
