# rottytooth/intercal72 architecture

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

- Interactive diagram: https://gitdiagram.com/rottytooth/intercal72
- Repository: https://github.com/rottytooth/intercal72

## Overview

##### Project type and purpose
- This repository is a restored, runnable version of the original 1972 Princeton INTERCAL compiler, implemented in SPITBOL. Its goal is to take an INTERCAL source file (.ical), run it through the SPITBOL‐based compiler (ical.sbl), and produce either SPITBOL output or native behavior under SPITBOLx64. It also preserves the original scanner images and includes sample programs.

##### File structure
- Top-level:
- ical.sbl   – the “live” SPITBOL compiler source
- readme.md  – this project’s high-level description
- scans/    – original scanned pages of the 1972 manual
- restored/:
- ical.sbl   – reformatted SPITBOL source adapted to SPITBOLx64
- hello.ical, test.ical – sample INTERCAL programs to compile
- README.md  – notes on running under SPITBOLx64
- No separate build scripts: compilation happens by invoking the SPITBOL interpreter directly on the .sbl files.

##### README for additional insights
- The README highlights that SPITBOLx64 is the execution environment and that the restored compiler must be fed INTERCAL code to produce an output. There are no web services or databases—this is purely a compiler pipeline.

##### Final advice
- Be exhaustive in capturing every logical piece: the user, the .ical files, each compiler phase, the interpreter, sample tests, and the documentation scans.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    Developer["Developer / User"]:::user

    %% Input Layer
    subgraph "Source Inputs" 
        direction TB
        Source["INTERCAL Source (.ical)"]:::input
        Hello["hello.ical"]:::input
        TestProg["test.ical"]:::input
        Source -- "sample harness" --> Hello
        Source -- "sample harness" --> TestProg
    end

    %% Documentation Layer
    subgraph "Documentation & Config" 
        direction TB
        ReadmeTop["readme.md"]:::doc
        GitTop[".gitignore"]:::doc
        Scans["scans/"]:::doc
        ReadmeRest["restored/README.md"]:::doc
        GitRest["restored/.gitignore"]:::doc
    end

    %% Runtime Environment
    Interpreter["SPITBOLx64 Interpreter"]:::runtime

    %% Compiler Scripts
    OriginalScript["ical.sbl"]:::internal
    RestoredScript["restored/ical.sbl"]:::internal

    %% Compiler Pipeline
    subgraph "Compiler Pipeline" 
        direction TB
        Lex["Lexical Analysis"]:::internal
        Par["Parsing"]:::internal
        Sem["Semantic Checks"]:::internal
        CG["Code Generation"]:::internal
        Lex --> Par --> Sem --> CG
    end

    %% Output
    Generated["Generated SPITBOL Code / Native Behavior"]:::output

    %% Relationships
    Developer --> Source
    Hello --> Interpreter
    TestProg --> Interpreter
    Source --> Interpreter
    Interpreter --> OriginalScript
    Interpreter --> RestoredScript
    OriginalScript --> Lex
    RestoredScript --> Lex
    CG --> Generated
    Generated --> Interpreter

    %% Click Events
    click OriginalScript "https://github.com/rottytooth/intercal72/blob/main/ical.sbl"
    click RestoredScript "https://github.com/rottytooth/intercal72/blob/main/restored/ical.sbl"
    click Hello "https://github.com/rottytooth/intercal72/blob/main/restored/hello.ical"
    click TestProg "https://github.com/rottytooth/intercal72/blob/main/restored/test.ical"
    click Scans "https://github.com/rottytooth/intercal72/tree/main/scans/"
    click ReadmeTop "https://github.com/rottytooth/intercal72/blob/main/readme.md"
    click ReadmeRest "https://github.com/rottytooth/intercal72/blob/main/restored/README.md"
    click GitTop "https://github.com/rottytooth/intercal72/blob/main/.gitignore"
    click GitRest "https://github.com/rottytooth/intercal72/blob/main/restored/.gitignore"

    %% Styles
    classDef user fill:#D0E6FF,stroke:#1E70BF,color:#1E70BF;
    classDef input fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32;
    classDef internal fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00;
    classDef runtime fill:#E3F2FD,stroke:#1976D2,color:#1976D2;
    classDef output fill:#F3E5F5,stroke:#8E24AA,color:#8E24AA;
    classDef doc fill:#ECEFF1,stroke:#546E7A,color:#546E7A;
```
