From Esolang
Jump to navigation Jump to search

AIGenLang is an esolang prompted by Mihai Popa and generated by ChatGPT (using the GPT-3.5 LLM).

Command table

This is the command table:

ADD - Add two numbers
SUB - Subtract two numbers
MUL - Multiply two numbers
DIV - Divide two numbers
PRINT - Output to the console
LOOP - Start a loop
ENDLOOP - End a loop
JUMP - Jump to a specific line
CMP - Compare two values
SET - Set a variable
GET - Get a variable value
IF - Conditional statement
ELSE - Else statement


AIGenLang supports variables that can store values for later use. Variables can be assigned and accessed using the SET and GET commands, respectively. This feature adds flexibility and enables users to work with dynamic data in their programs.

Loops and Conditions

The LOOP and ENDLOOP commands allow users to create loops in AIGenLang, enabling repetitive execution of code blocks. Additionally, the IF and ELSE commands provide conditional branching, allowing users to control the flow of their programs based on specific conditions.

Input and Output

AIGenLang provides input and output capabilities through the PRINT command, allowing users to display information on the console. Input can be obtained through external means and manipulated within the program, enhancing the interactivity of AIGenLang programs.

Error Handling

Error handling is an essential aspect of programming, and AIGenLang offers mechanisms to detect and handle errors. Users can implement error-checking routines and handle exceptions to ensure the robustness and reliability of their programs.

Advanced Features

For advanced users, AIGenLang offers features such as functions, recursion, and libraries. Functions allow users to encapsulate code for reuse, while recursion enables elegant solutions for repetitive tasks. Libraries provide pre-built functionalities that users can integrate into their programs, expanding the capabilities of AIGenLang.

This comprehensive overview highlights the key features and capabilities of AIGenLang, empowering users to explore the full potential of this innovative esolang.

Example Programs

Hello, World Program

SET msg "Hello, World!"

Cat Program (Repeats Input)

SET input GET
PRINT input

Truth Machine Program

    SET flag GET
    IF flag == 0
        PRINT 0
        PRINT 1
        SET flag 0

Fibonacci Sequence Program

SET a 0
SET b 1
    SET temp b
    SET b ADD a b
    SET a temp
    IF a < 100
        PRINT a

Factorial Program

SET n 5
SET result 1
    IF n == 0
        PRINT result
    SET result MUL result n
    SET n SUB n 1

These example programs demonstrate the versatility and functionality of AIGenLang, showcasing simple tasks like printing messages, repeating input, and computing complex sequences like Fibonacci numbers and factorials.