C**

From Esolang
Jump to navigation Jump to search

C** (pronounced see times times) is a programming language that User:BestCoder made, and is compiled to windows x64:

Main Constructs

If

if x > 4 then
printc 'H';
printc 'i';
end;

While

while x > 4 then
print x;
x = x + -1;
end;

Repeat (directive)

list = 0;
repeat 9 define
:= 0;
end;

Assign (directive)

const x = 5;
print x;

Anonymous assignment

string = 'H';
:=       'i';
:=       '!';
:=         0;

memory is linear so 'i' is next to 'H' and '!'

Adding and Multiplying (no subtraction or division)

a = 5;
b = 6;
c = a + b;
d = a * b;

Negatives

a = -5;

Print and Printc

print 65;
printc 'A';

Comments

you cant make comments

> and == (no < or >= or <=)

a = 5;
b = 6;
c = a == b;
d = a > b;

Input

a = 0;
read a;

you have to write a = 0; because right now, it doesnt auto declare a variable, also it reads a singular character from input

Pointers

x = 5;
y = 6;
z = &x;
print *z;
z = z -> 1;
print *z;

it should say 56, yes print doesnt have a newline

Index

a = 0;
:=  1;
:=  2;
print a[1];

it should say 1

Examples

BrainF Intepreter

s0 = 'H';
s1 = 'e';
s2 = 'l';
s3 = 'l';
s4 = 'o';
s5 = ' ';
s6 = 'W';
s7 = 'o';
s8 = 'r';
s9 = 'l';
s10 = 'd';
s11 = '!';
s12 = 0;
i = &s0;
while *i do
printc *i;
i = i +-8;
end;
printc 10;
*/
/*
c0 = '+';
c1 = '+';
c2 = '+';
c3 = '+';
c4 = '+';
c5 = '+';
c6 = '+';
c7 = '+';
c8 = '+';
c9 = '+';
c10 = '[';
c11 = '>';
c12 = '+';
c13 = '+';
c14 = '+';
c15 = '+';
c16 = '+';
c17 = '+';
c18 = '+';
c19 = '>';
c20 = '+';
c21 = '+';
c22 = '+';
c23 = '+';
c24 = '+';
c25 = '+';
c26 = '+';
c27 = '+';
c28 = '+';
c29 = '+';
c30 = '>';
c31 = '+';
c32 = '+';
c33 = '+';
c34 = '>';
c35 = '+';
c36 = '<';
c37 = '<';
c38 = '<';
c39 = '<';
c40 = '-';
c41 = ']';
c42 = '>';
c43 = '+';
c44 = '+';
c45 = '.';
c46 = '>';
c47 = '+';
c48 = '.';
c49 = '+';
c50 = '+';
c51 = '+';
c52 = '+';
c53 = '+';
c54 = '+';
c55 = '+';
c56 = '.';
c57 = '.';
c58 = '+';
c59 = '+';
c60 = '+';
c61 = '.';
c62 = '>';
c63 = '+';
c64 = '+';
c65 = '.';
c66 = '<';
c67 = '<';
c68 = '+';
c69 = '+';
c70 = '+';
c71 = '+';
c72 = '+';
c73 = '+';
c74 = '+';
c75 = '+';
c76 = '+';
c77 = '+';
c78 = '+';
c79 = '+';
c80 = '+';
c81 = '+';
c82 = '+';
c83 = '.';
c84 = '>';
c85 = '.';
c86 = '+';
c87 = '+';
c88 = '+';
c89 = '.';
c90 = '-';
c91 = '-';
c92 = '-';
c93 = '-';
c94 = '-';
c95 = '-';
c96 = '.';
c97 = '-';
c98 = '-';
c99 = '-';
c100 = '-';
c101 = '-';
c102 = '-';
c103 = '-';
c104 = '-';
c105 = '.';
c106 = '>';
c107 = '+';
c108 = '.';
c109 = '>';
c110 = '.';
c111 = 0;
pc = &c0;
ts = 0;
t1 = 0;
t2 = 0;
t3 = 0;
t4 = 0;
t5 = 0;
t6 = 0;
t7 = 0;
t8 = 0;
te = 0;
dp = &ts;
did = 0;
depth = 0;
while *pc do
did = 0;
cmd = *pc;
if cmd == '+' then
*dp = *dp + 1;
end;
if cmd == '-' then
*dp = *dp +-1;
end;
if cmd == '>' then
dp = dp +-8;
end;
if cmd == '<' then
dp = dp + 8;
end;
if cmd == '.' then
printc *dp;
end;
if cmd == '[' then
  if *dp == 0 then
    did = 1;
    depth = 1;
    pc = pc +-8;
    while depth do
      cmd = *pc;
      if cmd == '[' then
        depth = depth + 1;
      end;
      if cmd == ']' then
        depth = depth +-1;
      end;
      pc = pc + -8;
    end;
  end;
end;
if did == 0 then
if cmd == ']' then
  if *dp then
    depth = 1;
    pc = pc + 8;
    while depth do
      cmd = *pc;
      if cmd == ']' then
        depth = depth + 1;
      end;
      if cmd == '[' then
        depth = depth +-1;
      end;
      pc = pc + 8;
    end;
  end;
end;
end;
if &te > dp then
dp = &ts;
end;
if dp > &ts then
dp = &te;
end;
if *dp == 256 then
*dp = 0;
end;
if *dp == -1 then
*dp = 255;
end;
pc = pc +-8;
end;

this was made before -> and [] existed

Compiler

i will post it later