Komali's Awful Golfing Language (KAGL)

Try it here!

This is a coding language I've been working on in my free time. It's not intended for serious use but it could potentially be used for golfing or something

The compiler itself is written in Javascript, and transpiles said code to (you guessed it) Javascript. For example, the code

Vi|0;Ffoo|Pi++;}^foo;

turns into

var i = 0;
function foo()
console.log(i++);
}
foo();


Syntax:

Printing

To print something, use the character P

P0;

Simple as that

Variables:

Variables are defined with V

V{{name}}|{{value}};
Empty variables are set to 0
Vi;Pi;
(prints 0)

Strings

Strings are defined with double quotes

Vstr|"Hello, World!";

Parentheses are used to make replacements

Vn|43;P"The value of n is (n)!";

If/Else

The syntax for an if statement is

I{{condition}}|{{action}}}

Else is simply

E{{action}}}

Example:

Vi|"foo";Ii=="foo"|P"foo";}EP"bar";}

Repetition

You can use a { to denote repetition

{{{count}}|{{action}}}

For example

{10|P"Hello!";}

You can also supply an argument after the repetition count

Vi;{10,i|Pi;}

(prints 0-9)

Unfortunately, nested loops are not implemented yet

Functions

Functions are defined with an F

F{{comment}}|{{action}}}

And are executed with a ^

^foo;

Therefore recursion is possible

Fr|^r;}^r;

(Overloads the program)

Other variables

L{{n}}; | Math.floor({{n}})
R | Math.random()
D | Date.now()
{{n}}K | {{n}}*1000
{{s}}.l | {{s}}.length
/A | [ "A","B","C", ... "X","Y","Z" ]
/a | [ "a","b","c", ... "x","y","z" ]
{{e}}.c | ["constructor"]
{{e}}.s | {{e}}.toString()
/i | {{input specified with -i}}
{{e}}.t | ["constructor"].toString().split(" ")[1].split("(")[0] /* similar to typeof */


{{a}}J{{s}}; | [Array].join({{s}}) {{a}}.f{{s}}; | [Array].fill({{s}}) {{s}}.x{{s}}; | [String].split({{s}}) {{s}}.r{{n}}; | [String].repeat({{n}})

Flags

-script | Shows the executed script, before and after transpilation
-s | Adds "use strict";\n to the top of the script
-i | Supplies input for /i; if both -s and /i are used, it is required
-g | Shows the steps taken to get to the final code