Skip to content

Ingenious-c0der/Beluga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beluga

logo

Beluga Language is an esoteric programming language based on fundamental implementations of a turing machine. Check the commits for latest updates, as of now the language can accomodate simulation of infinite tapes for turing machines and many more features with it.

You now have the power to directly write and run turing machines!

Sample Beluga Code (According to current design decisions)

first.beluga

 machine (beluga) => {
    consumes : (null)
    tape : ({t0,abbb^bab^bab},{t1,abbb^bbedr^})
    def: (
            {q0,q1} /* finite set of states */
            {a,b} /* finite set of input symbols */
            {
                (q0,a,q0,a,->,t0,t0), /* transition */
                (q0,b,q0,b,<-,t0,t1), /* transition */
                (q0,^,q1,^,->,t0,t1), /* transition */
                (q1,a,q1,a,->,t1,t1), /* transition */
                (q1,b,q1,b,->,t1,t1), /* transition */
                (q1,^,q1,^,->,t0,t0), /* transition */
             } /* finite set of transitions */
            (q0) /* initial state  */
            (^) /* blank symbol  */
            (q1) /* final states */
         ) /* tuple of 6 entities  */
    ignoreUnknowns : (accept) /* ignore unknown tape symbols, basic booleans are accept (true) and reject (false) */
    relay : {
        onAccept: (console) /* available relays are console, null,turing Machine(pipelined) */
        onReject: (null) /* available relays are console, null,turing Machine (pipelined) */
    }
}

helloworld.beluga

machine (helloWorld!) => {
    consumes : (null)
    tape : ({outputTape,^HelloWorld!^})
    def: (
            {q0,exit} /* finite set of states */
            {H,e,l,o,W,o,r,d,!} /* finite set of input symbols */
            {
                (q0,l,q0,l,->,outputTape,outputTape), /* transition */
                (q0,^,q0,^,->,outputTape,outputTape), /* transition */
                (q0,H,q0,H,->,outputTape,outputTape), /* transition */
                (q0,e,q0,e,->,outputTape,outputTape), /* transition */
                (q0,o,q0,o,->,outputTape,outputTape), /* transition */
                (q0,W,q0,W,->,outputTape,outputTape), /* transition */
                (q0,r,q0,r,->,outputTape,outputTape), /* transition */
                (q0,d,q0,d,->,outputTape,outputTape), /* transition */
                (q0,!,exit,!,->,outputTape,outputTape) /* transition */
            } /* finite set of transitions */
            (q0) /* initial state  */
            (^) /* blank symbol  */
            (exit) /* final states */
         ) /* tuple of 6 entities  */
    ignoreUnknowns : (accept) /* ignore unknown tape symbols, basic booleans are accept (true) and reject (false) */
    relay : {
        onAccept: (console) /* available relays are console, null,turing Machine(pipelined) */
        onReject: (console) /* available relays are console, null,turing Machine (pipelined) */
    }
}

Output

helloWorld! (Accept) :
outputTape : ^HelloWorld!^
custom syntax highlighting is now available!

Get the vscode extension here

The language is designed to be simple, and easy to understand. In theory , it is capable of solving any problem that can be solved by a turing machine/ digital computer. Beluga supports multi tape turing machines

Installation

Windows

1. Download the beluga exe file from here

2. Add the directory in which the exe is downloaded to your PATH variable

for example if the beluga.exe lies in C:/Users/username/Desktop/src/beluga.exe then C:/Users/username/Desktop/src should be the path

3. You are good to go!

Run the file as Beluga <filename.beluga>

image

MacOS

1. Download the beluga exe file from here

2. Add the directory in which the exe is downloaded to your PATH variable

The path variable for apple silicon machines generally lies in /etc/paths unless it has been set to .zshrc or .bashrc manually.

3. You are good to go!

Run the file as Beluga <filename.beluga>

image