# zvnoob/at architecture

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

- Interactive diagram: https://gitdiagram.com/zvnoob/at
- Repository: https://github.com/zvnoob/at

## Overview

##### Project type and purpose
- From the README and file tree, this is a small prototype compiler/interpreter for a new language “AT.”
- Key features: no reserved keywords, simple syntax for declarations, assignments, arrays, and built-in operations.

##### File structure
- Top‐level sources:
- main.cpp – the CLI entry point
- lexer.cpp/.hpp – the scanner
- parser.y, parser.cpp/.hpp, parser_helper.cpp/.hpp – the Bison/Yacc parser and helpers
- error.cpp/.hpp, location.hh – error reporting and token locations
- Runtime & object model under objects/ (callable, container, primitives, scope, type)
- Arbitrary‐precision arithmetic under type/ (bigint, bigfraction)

##### Detailed elements
- Component names (e.g., “Lexer (lexer.cpp/.hpp)”)
- Notes on cross‐cutting modules (Error Reporter used by all phases)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Compile-time Phases
    subgraph "Compile-time Phases"
        FE["Front-end\n(main.cpp)"]:::compile
        Lex["Scanner\n(lexer.cpp/.hpp)"]:::compile
        subgraph "Parser"
            P_y["parser.y"]:::compile
            P_cpp["parser.cpp"]:::compile
            P_hpp["parser.hpp"]:::compile
            PH_cpp["parser_helper.cpp"]:::compile
            PH_hpp["parser_helper.hpp"]:::compile
        end
    end

    %% Runtime & Object Model
    subgraph "Runtime / Interpreter"
        Interp["Interpreter"]:::runtime
        subgraph "Object Model"
            ObjCore["Core Types & Scope\n(object.hpp, variable.hpp, type.hpp,\n scope.cpp/.hpp)"]:::runtime
            subgraph "Callables"
                CallInt["internal_func.hpp"]:::runtime
                CallTyCpp["typed_func.cpp"]:::runtime
                CallTyHpp["typed_func.hpp"]:::runtime
                CallBase["callable.hpp"]:::runtime
            end
            subgraph "Containers"
                ContArrCpp["array.cpp"]:::runtime
                ContArrHpp["array.hpp"]:::runtime
                ContTupCpp["tuple.cpp"]:::runtime
                ContTupHpp["tuple.hpp"]:::runtime
            end
            subgraph "Primitives"
                PrimIntCpp["integer.cpp"]:::runtime
                PrimIntHpp["integer.hpp"]:::runtime
                PrimFrCpp["fraction.cpp"]:::runtime
                PrimFrHpp["fraction.hpp"]:::runtime
                PrimStrCpp["string.cpp"]:::runtime
                PrimStrHpp["string.hpp"]:::runtime
            end
        end
    end

    %% Libraries
    subgraph "Libraries"
        TypesysBig["bigint.hpp"]:::library
        TypesysFrac["bigfraction.hpp"]:::library
        subgraph "Error Reporter"
            ErrCpp["error.cpp"]:::library
            ErrHpp["error.hpp"]:::library
            LocHh["location.hh"]:::library
        end
    end

    %% Data Flow
    FE -->|"feed source text"| Lex
    Lex -->|"tokens"| P_y
    P_y --> P_cpp
    P_cpp --> P_hpp
    P_hpp --> PH_cpp
    PH_cpp --> PH_hpp
    PH_hpp -->|"AST / parse tree"| Interp

    Interp -->|"bigint/fraction ops"| TypesysBig
    Interp -->|"bigint/fraction ops"| TypesysFrac
    Interp -->|"create & manipulate objects"| ObjCore
    ObjCore --> CallBase
    ObjCore --> ContArrCpp
    ObjCore --> PrimIntCpp

    %% Cross-cutting Error Reporter
    FE -->|"report errors"| ErrCpp
    Lex -->|"report errors"| ErrCpp
    P_y -->|"report errors"| ErrCpp
    Interp -->|"report errors"| ErrCpp

    %% Click Events
    click FE "https://github.com/zvnoob/at/blob/main/main.cpp"
    click Lex "https://github.com/zvnoob/at/blob/main/lexer.cpp"
    click Lex "https://github.com/zvnoob/at/blob/main/lexer.hpp"
    click P_y "https://github.com/zvnoob/at/blob/main/parser.y"
    click P_cpp "https://github.com/zvnoob/at/blob/main/parser.cpp"
    click P_hpp "https://github.com/zvnoob/at/blob/main/parser.hpp"
    click PH_cpp "https://github.com/zvnoob/at/blob/main/parser_helper.cpp"
    click PH_hpp "https://github.com/zvnoob/at/blob/main/parser_helper.hpp"
    click ErrCpp "https://github.com/zvnoob/at/blob/main/error.cpp"
    click ErrHpp "https://github.com/zvnoob/at/blob/main/error.hpp"
    click LocHh "https://github.com/zvnoob/at/blob/main/location.hh"
    click TypesysBig "https://github.com/zvnoob/at/blob/main/type/bigint.hpp"
    click TypesysFrac "https://github.com/zvnoob/at/blob/main/type/bigfraction.hpp"
    click ObjCore "https://github.com/zvnoob/at/blob/main/objects/object.hpp"
    click ObjCore "https://github.com/zvnoob/at/blob/main/objects/variable.hpp"
    click ObjCore "https://github.com/zvnoob/at/blob/main/objects/type.hpp"
    click ObjCore "https://github.com/zvnoob/at/blob/main/objects/scope.cpp"
    click ObjCore "https://github.com/zvnoob/at/blob/main/objects/scope.hpp"
    click CallBase "https://github.com/zvnoob/at/blob/main/objects/callable/callable.hpp"
    click CallInt "https://github.com/zvnoob/at/blob/main/objects/callable/internal_func.hpp"
    click CallTyCpp "https://github.com/zvnoob/at/blob/main/objects/callable/typed_func.cpp"
    click CallTyHpp "https://github.com/zvnoob/at/blob/main/objects/callable/typed_func.hpp"
    click ContArrCpp "https://github.com/zvnoob/at/blob/main/objects/container/array.cpp"
    click ContArrHpp "https://github.com/zvnoob/at/blob/main/objects/container/array.hpp"
    click ContTupCpp "https://github.com/zvnoob/at/blob/main/objects/container/tuple.cpp"
    click ContTupHpp "https://github.com/zvnoob/at/blob/main/objects/container/tuple.hpp"
    click PrimIntCpp "https://github.com/zvnoob/at/blob/main/objects/primitives/integer.cpp"
    click PrimIntHpp "https://github.com/zvnoob/at/blob/main/objects/primitives/integer.hpp"
    click PrimFrCpp "https://github.com/zvnoob/at/blob/main/objects/primitives/fraction.cpp"
    click PrimFrHpp "https://github.com/zvnoob/at/blob/main/objects/primitives/fraction.hpp"
    click PrimStrCpp "https://github.com/zvnoob/at/blob/main/objects/primitives/string.cpp"
    click PrimStrHpp "https://github.com/zvnoob/at/blob/main/objects/primitives/string.hpp"

    %% Styles
    classDef compile fill:#cce5ff,stroke:#004085,color:#004085;
    classDef runtime fill:#d4edda,stroke:#155724,color:#155724;
    classDef library fill:#fff3cd,stroke:#856404,color:#856404;
```
