Curlyfrick

From Esolang
Jump to: navigation, search

Curlyfrick is an esolang that was designed after seeing how popular graphing program Desmos evaluates {} as the literal number 1. Using these brackets, any number can be formed, which was the main inspiration.

Syntax

Each line has two parts: the op code and the data. The op code determines which command is to be performed on the data.

Opcodes are provided in a sort of binary way, with `.`s representing 0 and {} representing 1. For example:

{} {}{}

Represents 1011, which is opcode 11.

Here is a list of opcodes, and their bracket representation

Opcode Function Brackets
1 Print value ...{}
2 Print variable at variable pointer ..{}.
3 Store value in variable ..{}{}
4 Increment variable pointer .{}..
5 Decrement variable pointer .{}.{}
6 Input to a variable .{}{}.
7 Start an if condition .{}{}{}
8 Start a while loop {}...
9 Comment {}..{}
10 End statement {}.{}.
11 Increment variable {}.{}{}
12 Decrement variable {}{}..
13 Print value as char {}{}.{}
14 Print variable as char {}{}{}.
15 Zero the value of a var {}{}{}{}
  • If statements test to see if the value of the variable pointer is zero, and if it is, skip to the next END ({}.{}.).
  • While statements are similar, but constantly check the value of the variable at the variable pointer

The opcodes ..{}., ..{}., .{}{}{}, {}... and {}.{}. still need data, but it doesn’t have any impact on the execution of the program (i.e. data given to these opcodes acts as a comment).

Also, the opcode and data are separated by a tab (\t)

Examples of Opcodes

{}  {}  Print the value 5
   {}   {}+{}+{}+{}+{}
{}  {}  Store the value 8 in the variable 0
  {}{}  ({}+{})^({}+{}+{})
{}  {}  Increment variable 0 by 27
{} {}{} ({}+{}+{})^({}+{}+{})
{}  {}  Increment the variable pointer
 {}     {}
{}  {}  Print value in variable 1
  {}    {}
{}  {}  Decrement the variable pointer
{}{}    {}
{}  {}  Print the value in variable 1 as a character
{}{}{}  {}

Valid mathematical operations are:

  • +-*/ -> Standard operations
  • ^ -> Exponent
  • -> Square root

Examples

Truth Machine

.{}{}.	{}
.{}{}{}	{}
{}...	{}
...{}	{}
{}.{}.	{}
...{}	{}-{}
{}.{}.	{}

Pseudocode-ish representation

INPUT
IF VAR_0 ISN'T 1 THEN
    WHILE VAR_0 IS TRUE
        PRINT 1
    END
    PRINT 0
END

Hello, World!

{}{}.{}	(({}+{}+{}+{})^({}+{}+{}))+(({}+{})^({}+{}+{}))
{}{}.{}	(((({}+{})^({}+{}+{}))+{}+{})^({}+{}))+{}
{}{}.{}	(((({}+{})^({}+{}+{}))+{}+{})^({}+{}))+(({}+{})^({}+{}+{}))
{}{}.{}	(((({}+{})^({}+{}+{}))+{}+{})^({}+{}))+(({}+{})^({}+{}+{}))
{}{}.{}	(((({}+{})^({}+{}+{}))+{}+{})^({}+{}))+(({}+{})^({}+{}+{}))+{}+{}+{}
{}{}.{}	(((({}+{})*({}+{}))^({}+{}))*({}+{}+{}))-({}+{}+{}+{})
{}{}.{}	(({}+{})^({}+{}+{}))*({}+{}+{}+{})
{}{}.{}	({}+{}+{})*((({}+{}+{}+{}+{})^({}+{}))+{}+{}+{}+{})
{}{}.{}	(((({}+{})^({}+{}+{}))*({}+{}+{}+{}))+{}+{}+{}+{}+{})*({}+{}+{})
{}{}.{}	((((({}+{})^({}+{}+{}))*({}+{}+{}+{}))+{}+{}+{}+{}+{})*({}+{}+{}))+{}+{}+{}
{}{}.{}	(((({}+{})^({}+{}+{}))+{}+{})^({}+{}))+(({}+{})^({}+{}+{}))
{}{}.{}	((({}+{})^({}+{}+{}))+{}+{})^({}+{})
{}{}.{}	((({}+{})^({}+{}+{}))*({}+{}+{}+{})) + {}

Looping counter

{}.{}{}	{}
{}...	{}
{}.{}{}	{}
{}.{}.	{}

Infinite loop

{}.{}{}	{}
{}...	{}
{}.{}.	{}

Square root of 2

...{}	√2)

Feel free to add more examples

Cat program

.{}{}.	{}
{}...	{}
{}{}{}.	{}
.{}{}.	{}
{}.{}.	{}

Computational Class

I’m pretty sure Curlyfrick is Turing complete, as a comparison table between BF and Curlyfrick can be drawn

BF Curlyfrick
> .{}..
< .{}.{}
+ {}.{}{}
- {}{}..
. ..{}.
, .{}{}.
[ {}...
] {}.{}.

Some notable things

  • When using input (.{}{}.), it will try and store the input as an integer if possible, otherwise, it will be stored as a string
  • The increment and decrement functions will either increment/decrement the value of the variable by the given amount, or it will go through and increment/decrement the ordinal value of each character in a string by the given amount
  • The amount of variables to put in the register list can be specified on the command line, but defaults to 30,000
  • If the variable pointer reaches a value that is not inside the list of vars, then it will kind of wrap around, but details of this can be found in the interpreter.
  • The operator must be closed with a )