Paradigm Tree Project

Python Code Visualizer

import csv
import os

def csv_to_list(file_path):
    """
    Reads a CSV file and returns its contents as a list of lists.
    Each inner list represents a row in the CSV.
    """
    # Validate file existence
    if not os.path.isfile(file_path):
        raise FileNotFoundError(f"File not found: {file_path}")

    data = []
    try:
        with open(file_path, mode='r', newline='', encoding='utf-8') as file:
            reader = csv.reader(file)
            for row in reader:
                data.append(row)  # Each row is a list of strings
    except csv.Error as e:
        raise ValueError(f"Error reading CSV file: {e}")

    return data


class Stack:
    def __init__(self):
        self.stacklist = []

    def add(self, v):
        self.stacklist.append(v)

    def pop(self):
        if len(self.stacklist) > 0:
            self.stacklist.pop()
        else:
            print("Stack already empty!")
    
    def clearStack(self):
        for a in range(len(self.stacklist)):
            self.stacklist.pop()

    def printStack(self):
        print(self.stacklist)
        
    def returnTop(self):
        if len(self.stacklist) > 0:
            return self.stacklist[len(self.stacklist)-1]
        else:
            print("Stack already empty!")
            return None
        

class DataTable:
    def __init__(self, dataV, stack):
        self.dataV = dataV
        self.stack = stack
        self.branchNum = 1


    def printDefOptions(self):
        print("[Z] Return to Start")
        print("[A] Back 1 Branch")
        print("[Q] Exit Program")

    def printWithNumTag(self, arr, oldOpt, type3 = False):
        if type3 == False:
            for a in range(len(arr)):
                print("[%s] %s" % (str(a+1), arr[a]))
                oldOpt.append(a+1)
        else:
            for a in range(len(arr)):
                print("[%s] %s - %s" % (str(a+1), arr[a][0], arr[a][1]))
                oldOpt.append(a+1)


    def prompt(self):
        if self.branchNum == 1:
            options = self.printType1()
        elif self.branchNum == 2:
            options = self.printType2()
        elif self.branchNum == 3:
            options = self.printType3()
        
        while True:
            userIn = input("> ")
            if userIn.isdigit():
                userIn = int(userIn)
            elif userIn in ["A", "Z","Q"]:
                userIn = userIn.lower()
            if userIn in options[0]:
                break
            else:
                print("Error! Invalid Input")

        if userIn == "a":
            self.stack.pop()
            self.branchNum -= 1
            return True
        
        elif userIn == "z":
            self.stack.clearStack()
            self.branchNum = 1
            return True

        elif userIn == "q":
            return False
            
        else:
            if self.branchNum == 1:
                self.stack.add(options[1][userIn-1])
                self.branchNum = 2
                
                print("=== %s ===" % options[1][userIn-1])
                print("--------------------------------")

            elif self.branchNum == 2:
                self.stack.add(options[1][userIn-1])
                self.branchNum = 3
                
                print("=== %s ===" % options[1][userIn-1])
                for a in self.dataV:
                    if a[1] == options[1][userIn-1]:
                        print("Description: %s" % a[2])
                        break
                print("--------------------------------")

            elif self.branchNum == 3:                
                print("=== %s - %s ===" % (options[1][userIn-1][0], options[1][userIn-1][1]))
                for a in self.dataV:
                    if a[4] == options[1][userIn-1][1]:
                        print("Year Created: %s" % a[5])
                        print("Genealogy: %s" % a[6])
                        print("Environment: %s" % a[7])
                        print("Activity Status: %s" % a[8])
                        print("Career Note: %s" % a[9])
                        break
                print("--------------------------------")
            return True


    def printType1(self):
        optLi = [1,2,"q","Q"]
        print("[1] Declarative")
        print("[2] Imperative")
        print("[Q] Exit Program")
        print("--------------------------------")
        return [optLi, ["Declarative", "Imperative"]]

    def printType2(self):
        dataLi = []
        for a in self.dataV:
            if self.stack.stacklist[0] == a[0] and (not a[1] in dataLi):
                dataLi.append(a[1])

        optLi = ["A","Z","Q","a","z","q"]
        self.printWithNumTag(dataLi, optLi)
        self.printDefOptions()
        print("--------------------------------")
        return [optLi,dataLi]

    def printType3(self):
        dataLi = []
        for a in self.dataV:
            if self.stack.stacklist[0] == a[0] and self.stack.stacklist[1] == a[1] and (not a[1] in dataLi):
                dataLi.append([a[3],a[4]])

        optLi = ["A","Z","Q","a","z","q"]
        self.printWithNumTag(dataLi, optLi, True)
        self.printDefOptions()
        print("--------------------------------")
        return [optLi,dataLi]




    






if __name__ == "__main__":
    file = "treeData.csv"

    data = csv_to_list(file)
    


    ptvStack = Stack()
    ptv = DataTable(data, ptvStack)

    while True:
        continueA = ptv.prompt()
        if continueA == False:
            break










    # 0 - Declarative / Imperative
    # 1 - Branch name [20]
    # 2 - Branch explanation
    # 3 - Language Category [3]
    # 4 - Language Name
    # 5 - Year
    # 6 - Genealogy
    # 7 - Environment
    # 8 - Activity Status
    # 9 - Career Note









    



    
    



Data Table

Imperative

Procedural

Sequence of commands and function calls.

The Originator

Fortran

1957

First High-Level

Native / High-Perf

The Titan of Science.

Climate Modeling / Physics.

Imperative

Procedural

Sequence of commands and function calls.

The Industry Titan

C

1972

B/BCPL

Native / OS-independent

The Titan of systems.

OS Development / Embedded.

Imperative

Procedural

Sequence of commands and function calls.

The Neonate

Zig

2016

C-family

Native / Self-hosted

Neonate Systems Leader.

Low-level Tooling / Embedded.

Imperative

Object-Oriented (OOP)

Interaction between “objects” containing data and methods.

The Originator

Simula 67

1967

Algol-derivative

Mainframes / Workstations

Legacy; OOP Originator.

Simulation / Software Design.

Imperative

Object-Oriented (OOP)

Interaction between “objects” containing data and methods.

The Industry Titan

Java

1995

C++ / Smalltalk

JVM

The Enterprise Titan.

Android / Corporate Backend.

Imperative

Object-Oriented (OOP)

Interaction between “objects” containing data and methods.

The Neonate

Mojo

2023

Python / C++ blend

Modular AI Runtime

Neonate (AI Leader).

AI / Machine Learning Infra.

Declarative

Functional

Evaluation of mathematical functions; avoids changing state.

The Originator

Lisp

1958

IPL-derivative

Native / Interpreted

The Functional Originator.

AI research / Symbolic Logic.

Declarative

Functional

Evaluation of mathematical functions; avoids changing state.

The Industry Titan

Haskell

1990

Miranda / ML

Native (GHC)

The Titan of Functional.

Compilers / Blockchain.

Declarative

Functional

Evaluation of mathematical functions; avoids changing state.

The Neonate

Gleam

2019

ML-derivative

BEAM / JS

Neonate (v1.0 in 2024).

Web Services / Distributed Apps.

Declarative

Logic

Based on formal logic and “fact/rule” matching.

The Originator

Prolog

1972

Formal Logic

WAM (Warren Machine)

The Logic Originator.

NLP / Knowledge Representation.

Declarative

Logic

Based on formal logic and “fact/rule” matching.

The Industry Titan

Prolog

1972

Formal Logic

WAM (Warren Machine)

The Logic Originator.

NLP / Knowledge Representation.

Declarative

Logic

Based on formal logic and “fact/rule” matching.

The Neonate

Picat

2013

Logic / Constraint

B-Prolog engine

Active research.

Planning / Scheduling AI.

Declarative

Constraint

Relations between variables are stated in the form of constraints.

The Originator

Sketchpad

1963

Graphical Constraint

TX-2 Computer

Dead (Ancestor).

GUI / CAD history.

Declarative

Constraint

Relations between variables are stated in the form of constraints.

The Industry Titan

MiniZinc

2007

Constraint-based

Solvers (Gecode)

Active standard.

Logistics / Optimization.

Declarative

Constraint

Relations between variables are stated in the form of constraints.

The Neonate

Scryer Prolog

2018

Prolog / Rust

Rust / Wasm

Neonate Logic system.

Formal Verification / Web AI.

Declarative

Database/Data-driven

Focusing on the data itself and its movement (e.g., SQL).

The Originator

IDS

1963

Network DB

Mainframe (GE-225)

Legacy (Pre-Relational).

Historical Database Admin.

Declarative

Database/Data-driven

Focusing on the data itself and its movement (e.g., SQL).

The Industry Titan

SQL

1974

Relational Calculus

RDBMS Engines

The Data Titan.

Database Management.

Declarative

Database/Data-driven

Focusing on the data itself and its movement (e.g., SQL).

The Neonate

EdgeDB

2019

SQL / GraphQL-desc.

Server / Cloud

Active; “Graph-Relational”.

Full-stack Web Development.

Declarative

Reactive

Asynchronous data streams and the propagation of change.

The Originator

Smalltalk

1972

Lisp / Simula

VM-based

Active / Influential.

Live Coding / Dynamic Systems.

Declarative

Reactive

Asynchronous data streams and the propagation of change.

The Industry Titan

JavaScript

1995

Self / Scheme / Java

Browsers / V8 / Node

The Web Titan.

Frontend / Full-stack Web.

Declarative

Reactive

Asynchronous data streams and the propagation of change.

The Neonate

Eff

2012

ML-derivative

Interpreted / OCaml

Active research.

Academic Algebraic Effects.

Imperative

Scripting

Automating tasks that could alternatively be executed by a human.

The Originator

JOSS

1963

Algol / Interactive

JOHNNIAC / PDP-6

Dead (Historical).

Scientific Computing history.

Imperative

Scripting

Automating tasks that could alternatively be executed by a human.

The Industry Titan

Python

1991

ABC / C-derivative

CPython / Interpreted

The Generalist Titan.

AI / Data Science / Scripting.

Imperative

Scripting

Automating tasks that could alternatively be executed by a human.

The Neonate

Janet

2017

Lisp-derivative

Native / C-interop

Active / Lightweight.

Game Scripting / Tooling.

Imperative

Event-driven

Flow is determined by events (user actions, sensor outputs).

The Originator

Simula 67

1967

Algol-derivative

Mainframes / Workstations

Legacy; OOP Originator.

Simulation / Software Design.

Imperative

Event-driven

Flow is determined by events (user actions, sensor outputs).

The Industry Titan

JavaScript

1995

Self / Scheme / Java

Browsers / V8 / Node

The Web Titan.

Frontend / Full-stack Web.

Imperative

Event-driven

Flow is determined by events (user actions, sensor outputs).

The Neonate

Grain

2020

ML-derivative

WebAssembly (Wasm)

Active / Emerging.

Wasm / Browser-side Logic.

Imperative

Concurrent

Executing multiple computations during overlapping time periods.

The Originator

CSP

1978

Formal Logic

Theoretical (Occam/Go)

Active as a model (Go/Rust).

Cloud Infrastructure.

Imperative

Concurrent

Executing multiple computations during overlapping time periods.

The Industry Titan

Go

2009

C-family / CSP

Native / Cloud-native

The Titan of Cloud.

Backend Services / K8s.

Imperative

Concurrent

Executing multiple computations during overlapping time periods.

The Neonate

Pony

2015

Actor-model

Native (LLVM)

Active maintenance.

High-Concurrency systems.

Imperative

Parallel

Dividing a large problem into smaller ones solved simultaneously.

The Originator

Fortran

1957

First High-Level

Native / High-Perf

The Titan of Science.

Climate Modeling / Physics.

Imperative

Parallel

Dividing a large problem into smaller ones solved simultaneously.

The Industry Titan

C++

1985

C / Simula influence

Native (LLVM/GCC)

The Titan of performance.

Game Dev / High-Freq Trading.

Imperative

Parallel

Dividing a large problem into smaller ones solved simultaneously.

The Neonate

Futhark

2014

ML / Functional

GPU (OpenCL/CUDA)

Active maintenance.

Quantitative Finance / GPGPU.

Imperative

Aspect-Oriented

Separating cross-cutting concerns (like logging) from main logic.

The Originator

AspectJ

2001

Java Extension

JVM (Java Virtual Machine)

Active; standard for AOP.

Enterprise Java (Spring).

Imperative

Aspect-Oriented

Separating cross-cutting concerns (like logging) from main logic.

The Industry Titan

Java

1995

C++ / Smalltalk

JVM

The Enterprise Titan.

Android / Corporate Backend.

Imperative

Aspect-Oriented

Separating cross-cutting concerns (like logging) from main logic.

The Neonate

Koin

2017

Kotlin DSL

Kotlin Multiplatform

Active (DI / AOP-lite).

Android App Architecture.

Imperative

Generic

Writing code in a way that is independent of specific types.

The Originator

CLU

1974

Algol-derivative

Historic (influenced Java)

Legacy; teaching tool.

Software Engineering concepts.

Imperative

Generic

Writing code in a way that is independent of specific types.

The Industry Titan

Rust

2010

C++ / ML

Native (LLVM)

The Titan of Memory Safety.

Security Infrastructure / Web3.

Imperative

Generic

Writing code in a way that is independent of specific types.

The Neonate

Carbon

2022

C++ Successor

LLVM / C++ Interop

Experimental (Google-led).

System Infrastructure migration.

Imperative

Reflective

Ability of a program to observe and modify its own structure.

The Originator

3-Lisp

1982

Lisp-derivative

Research / Interpreted

Legacy; academic interest.

Used in Reflective AI research.

Imperative

Reflective

Ability of a program to observe and modify its own structure.

The Industry Titan

Java

1995

C++ / Smalltalk

JVM

The Enterprise Titan.

Android / Corporate Backend.

Imperative

Reflective

Ability of a program to observe and modify its own structure.

The Neonate

Zig

2016

C-family

Native / Self-hosted

Neonate Systems Leader.

Low-level Tooling / Embedded.

Imperative

Metaprogramming

Programs that write or manipulate other programs as data.

The Originator

Lisp

1958

IPL-derivative

Native / Interpreted

The Functional Originator.

AI research / Symbolic Logic.

Imperative

Metaprogramming

Programs that write or manipulate other programs as data.

The Industry Titan

Rust

2010

C++ / ML

Native (LLVM)

The Titan of Memory Safety.

Security Infrastructure / Web3.

Imperative

Metaprogramming

Programs that write or manipulate other programs as data.

The Neonate

Mojo

2023

Python / C++ blend

Modular AI Runtime

Neonate (AI Leader).

AI / Machine Learning Infra.

Declarative

Rule-based

Execution based on a set of “If-Then” rules (Expert Systems).

The Originator

OPS5

1977

Rete-algorithm

Lisp / Mainframes

Legacy; Rule-based root.

Expert Systems (Historical).

Declarative

Rule-based

Execution based on a set of “If-Then” rules (Expert Systems).

The Industry Titan

Drools

2001

Java / Rule-based

JVM

Active industry standard.

Fintech / Insurance Logic.

Declarative

Rule-based

Execution based on a set of “If-Then” rules (Expert Systems).

The Neonate

Clara

2014

Clojure / Rete

JVM (Clojure-based)

Active maintenance.

Complex Event Processing.

Declarative

Flow-based

Applications defined as networks of “black box” processes.

The Originator

FBP

1970s

Component-based

Runtime-specific

Active via Node-RED/NoFlo.

IoT / Factory Automation.

Declarative

Flow-based

Applications defined as networks of “black box” processes.

The Industry Titan

Node-RED

2013

JS / Flow-based

Node.js / Browser

Active (IBM-led).

IoT / Smart Home / Industry 4.0.

Declarative

Flow-based

Applications defined as networks of “black box” processes.

The Neonate

Enso

2020

Haskell / Visual

Polyglot (GraalVM)

Active; Visual/Textual.

Data Science / Data Pipelines.

Declarative

Array/Vector

Operations apply to entire sets of values at once.

The Originator

APL

1962

Mathematical Notation

Mainframes / Cross-platform

Active (via Dyalog APL).

Finance and high-density math.

Declarative

Array/Vector

Operations apply to entire sets of values at once.

The Industry Titan

Python

1991

ABC / C-derivative

CPython / Interpreted

The Generalist Titan.

AI / Data Science / Scripting.

Declarative

Array/Vector

Operations apply to entire sets of values at once.

The Neonate

Bend

2024

HVM-native

HVM2 (Massive Parallelism)

Neonate; emerging.

High-Perf Computing (GPU/CPU).

Imperative

Distributed

Components located on networked computers communicate via messages.

The Originator

Erlang

1986

Prolog-influenced

BEAM VM

The Titan of Distributed.

Telecom / Messaging (WhatsApp).

Imperative

Distributed

Components located on networked computers communicate via messages.

The Industry Titan

Go

2009

C-family / CSP

Native / Cloud-native

The Titan of Cloud.

Backend Services / K8s.

Imperative

Distributed

Components located on networked computers communicate via messages.

The Neonate

Unison

2019

Haskell / Content-ID

Unison Cloud

Neonate (Distributed).

Cloud-native computing.

Imperative

Automata-based

Program logic is defined via state machines and transitions.

The Originator

Esterel

1982

Synchronous Logic

Compiled to C / Hardware

Active in safety-critical.

Avionics / Control Systems.

Imperative

Automata-based

Program logic is defined via state machines and transitions.

The Industry Titan

C

1972

B/BCPL

Native / OS-independent

The Titan of systems.

OS Development / Embedded.

Imperative

Automata-based

Program logic is defined via state machines and transitions.

The Neonate

XState

2015

Automata-based

JavaScript / TS

Active / Visual tool.

Frontend UX / State Machines.