# theprocyon/inha_202402_ice4004_001_assembler architecture

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

- Interactive diagram: https://gitdiagram.com/theprocyon/inha_202402_ice4004_001_assembler
- Repository: https://github.com/theprocyon/inha_202402_ice4004_001_assembler

## Overview

Key Components to Include:

##### Input Processing Layer
- Input text file reader
- Parsing of assembly instructions (DataParser.cs)

##### Core Processing Layer
- OPCODE handling and validation (OPCODE.cs)
- Instruction encoding logic

##### Output Generation Layer
- Binary code generation
- Output file writing (OutFile.cs)

##### Main Flow Components (Left to Right)
- It to a "Data Parser" component
- To "Instruction Processor" in the middle
- To "Binary Encoder"
- End with "Output File (.txt)" on the right

##### Core Components (Center)
- Connection to the instruction processing pipeline
- A reference to the supported instruction set

##### Processing States
- Instruction Parsing
- OPCODE Validation
- Binary Encoding
- Error Handling

- The linear transformation pipeline from text to binary
- The validation process using OPCODE.cs
- Error handling for invalid instructions
- The clear separation between input processing, instruction validation, and output generation

Key Relationships to Show:

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        InputFile[("Input File (.txt)")]:::file
        click InputFile "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/example/Input.txt"
    end

    subgraph "Processing Pipeline"
        Parser["Data Parser"]:::processor
        click Parser "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/src/CAAssembler/DataParser.cs"
        
        subgraph "Core Processing"
            OPValidator["OPCODE Validator"]:::validator
            click OPValidator "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/src/CAAssembler/OPCODE.cs"
            InstProcessor["Instruction Processor"]:::processor
            click InstProcessor "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/src/CAAssembler/Program.cs"
            BinaryEncoder["Binary Encoder"]:::processor
        end
    end

    subgraph Output
        OutputFile[("Output File (.txt)")]:::file
        click OutputFile "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/example/output.txt"
        OutFileHandler["Output File Handler"]:::processor
        click OutFileHandler "https://github.com/Theprocyon/INHA_202402_ICE4004_001_Assembler/blob/master/src/CAAssembler/OutFile.cs"
    end

    InputFile --> |"Assembly Instructions\n(One per line)"| Parser
    Parser --> InstProcessor
    InstProcessor --> |"Instruction Validation"| OPValidator
    OPValidator --> |"Valid"| BinaryEncoder
    OPValidator --> |"Invalid"| OutFileHandler
    BinaryEncoder --> |"32-bit Binary"| OutFileHandler
    OutFileHandler --> OutputFile

    classDef file fill:#B3E0FF,stroke:#333,stroke-width:2px
    classDef processor fill:#90EE90,stroke:#333,stroke-width:2px
    classDef validator fill:#FFE5B4,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[("File")]:::file
        L2["Processor"]:::processor
        L3["Validator"]:::validator
    end
```
