DEV Community

Cover image for Floppa Programming Language!
5elenay
5elenay

Posted on • Updated on

Floppa Programming Language!

Floppa Programming Language

Created just for fun. But if you want to contribute, why not? Github

Floppa p.l. inspired by the brainf*ck programming language. So you can convert your brainf*ck code to floppa code.

Compiling

You must have installed go before using compiler. If you have, run the ./compiler/main.go program. Compiler takes two argument, first argument is input file (.flop file), second argument is output file (.go file). The compiler is written in golang, so you actually can compile your .flop code to machine language with using go build <file.go>

Converting Brainf*ck Code to Floppa Code

You can use simple python code for that. You must have python3.6>= for use this code. Converter: ./tools/bf2floppa.py. Same with compiler, takes two argument. First one is input file (.bf), Second one is output file (.flop).

Hello World

Here an example hello world program written in floppa programming language (./example/helloworld.flop);

keeerr keerr flop go keeerr keeerr keer no fo hoe go keer floppa 
no keerr flop go keeerr keeerr keer no fo hoe go fo floppa keeerr 
keerr floppa floppa keerr floppa no keeerr keerr flop go foooo fo 
foooo foo no fo hoe go foo floppa no keeerr keeerr keerr flop go 
keeerr ker no fo hoe go floppa no keeerr keer flop go keeerr no 
fo hoe go floppa keerr floppa foooo foo floppa foooo foooo floppa 
no ker keeerr ker flop go foooo foooo fooo no fo hoe go fo flop 
no ker go fo hoe no floppa fooo flop foooo foooo fooo hoe
Enter fullscreen mode Exit fullscreen mode

Commands

ker => Add one byte to current cell.
fo => Remove one byte from current cell.
go => Goto next cell.
no => Goto last cell.
flop => Start loop. (will continue until no byte left.)
hoe => Finish current statement.
caracal => Get one byte input.
floppa => Print current cell as ascii.
brb => Finish the program. (panic.)
flop(0-255) => Checks if current cell byte size same with the number. if so, runs the commands after this statement.
fofo(0-255) => Checks if current cell byte size same or smaller than the number. if so, runs the commands after this statement.
fohoe(0-255) => Checks if current cell byte size same or bigger than the number. if so, runs the commands after this statement.

These commands added for help while adding / removing byte:
keer => Add two byte to current cell.
foo => Remove two byte from current cell.
keerr => Add three byte to current cell.
fooo => Remove three byte from current cell.
keeerr => Add four byte to current cell.
foooo => Remove four byte from current cell.
Enter fullscreen mode Exit fullscreen mode

For brainf*ck;

{
    "+": "ker",
    "-": "fo",
    ">": "go",
    "<": "no",
    "[": "flop",
    "]": "hoe",
    ",": "caracal",
    ".": "floppa",
    "++": "keer",
    "--": "foo",
    "+++": "keerr",
    "---": "fooo",
    "++++": "keeerr",
    "----": "foooo"
}
Enter fullscreen mode Exit fullscreen mode

Comments

Compiler ignores anything except keywords, so you can type whatever you want. Check ./example/mandelbrot.flop for example.

What Can I Do With This?

In theory, you can do everything. If you are masochist, try write a floppa programming language interpreter that created with floppa programming language!

Top comments (4)

Collapse
 
furtsy profile image
Furtsy

aaaaaa

Collapse
 
5elenay profile image
5elenay

"b"*6

Collapse
 
defman profile image
Sergey Kislyakov

flopa

Collapse
 
5elenay profile image
5elenay