WebFuckLang

From Esolang
Jump to navigation Jump to search

WebFuckLang is a Python-based Language inspired by the legendary logical programming-Language Brainfuck. WebFuckLang combines the Syntax of Brainfuck - an add a few more features, like:
- Use Variables
- Output multiple 'Cells'
- creating HTTP-Sockets
- Input Multiple-Character-Inputs to multiple Cells
- break the execution of the script
- execute console-commands

The basic Syntax

The syntax of webFuckLang is verry similar to the brainfuck synatx. WebFuckLnag is based on a "Grid-System", so you have a POINTER wich can controll single CELLS, entrypoint is (DEFAULT) CELL_0.
Now, you can add some Int-Values with the + this will add 1 to Cell_0. So when you would like to have an "A", you have to watch into an ASCII-Table -> A has the Number 65 in ASCII. So we have to add 65-Times the +.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now the Cell_0 has the Value "65". So we can PRINT/Output this Cell with the . => The Output is "A". Next, we can go to the next CELL (Cell_1), for that, we have to NAVIGATE with our POINTER to the next Cell.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>

Now we are in CELL_1, we can add 2 to this cell.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++

So, I think its better documentet here Brainfuck.

All functions in one List:
> - Pointer goes one cell forward.
< - Pointer goes one cell backward.
+ - Adds +1 to the current cell.
- - Calculate -1 to the current cell.
. - Print (Output) the current cell [as ASCII].
, - Input from commandline to current cell [as ASCII].
[ - Opens a new loop. [Loops in Loops are NOT supported]
] - Closing the loop.
: - Define new variable. (Example: test:++ = variable "test" becomes the value "2")
! - Break current execution.
( - Opens a new ALPHABETIC LOOP.
) - Closes the ALPHABETIC LOOP.
; - Makes a MULTI-CELL input (the Pointer goes to the last from input used cell).
%() - Makes a MULTI-CELL output (Example: %(>>) => Output the last 5 Cells as "one"-string)
# - Output the NUMERIC-VALUE of a cell.
* - Output all cells with values (like DD).
$ - Set the entrypoint of the cells (Default: 0).
&() - Create a new Socket (HTTP/TCP).
?(VALUE) - Get something from the Socket.
P5000 - Set the TCP Port for Socket. (DEFAULT=9447)
_() - Exectute a console-command (Example: _ls -a_).
_(?) - Execute a console-command, and get back the OUTPUT.

Examples

Calculate - addition To Calculate, you can use the LOOPS. The folowing example describes the proicess of adding the value of Cell_0 to the value of Cell_1:

+++>++<[->+<]

Firstly we add "3" to Cell_0, after that, we point to the next cell (Cell_1), and add "2", and Point back to Cell_0. Now we open a new LOOP - this LOOP makes simple that:
[->+<] => Subtract -1 from Cell_0
[->+<] => Point to the next cell (Cell_1)
[->+<] => Add +1 to Cell_1
[->+<] => Point back to Cell_0, and return this - when cell_0 has the value "0", the LOOP stops (or continue thje script after the loop)

Now, cell_1 has the result of "cell_0 + cell_1" / 3 + 2.


Calculate - substraction To subtract something you also need a LOOP:

+++>++[-<->]

Firstly we add "3" to Cell_0, after that, we point to the next cell (Cell_1), and add "2". Now we open a new LOOP - this LOOP makes simple that:
[->+<] => Subtract -1 from Cell_1
[-<->] => Point to the first cell (Cell_0)
[-<->] => Subtract -1 to Cell_0
[-<->] => Point to next Cell_1, and return this - when cell_1 has the value "0", the LOOP stops (or continue thje script after the loop)

Now, cell_0 has the result of "cell_0 - cell_1" / 3 - 2.


WORK in PROGRESS of THIS article -- More in Future