Kentarg

From Esolang
Jump to navigation Jump to search

Kentarg is a programming language created by Javaveryhot (talk).

The project was started at 6 February 2020 and released (with version 0.0.0) at 14 February 2020.

Kentarg program files uses the *.keg file extension.

NOTE: In and after version 0.1.6 the file extension is changed to *.ke !


Examples and basic syntax

Kentarg language "Hello, world." example:

print [Hello, world.]

Where "print" is the command and "Hello, world." is the first argument.

The [ and ] keeps "Hello, world." as one argument instead of two. If the [ and ] would not be used, the program would think that you would type ("Hello," and "world.") as the arguments, as this programming language uses single spaces to split up arguments.


Syntax:

command arg1 arg2 [arg3 arg3] arg4


Commands are split up with semicolons ( ; ), so a script would be:

print [Hello, world.];
print [Second line];
print Third_line;


Variables

To define or set a value to a variable, use the "put" (older versions use "define"), or the "get" command.

"put" command syntax:

put x this_is_my_variable

"get" command syntax:

get x

When using the "get" command, the user will have to type something (length of input has to be +1, not "").


In the "put" example above, "x" will be set to "this_is_my_variable", and in the "get" example, the value of "x" would be set to whatever the user inputs.

To include a variable in a command, using "print" in this example:

print ^(x)

and if "x" is "this_is_my_variable" then the terminal would print "this_is_my_variable".

To delete a variable, use the "break" command, with the variable name as the first argument.


Making a script variable:

You can make variables scripts, it would still be a normal variable with a value of a script:

~handle x
print ^(y)
~

The above example puts the existing variable (variable must already exist before handling it) "x" to the value of "~handle x;print ^(y);".

The tilde (~) exits variable handling mode.

Difference between "put" and "~handle":

The "~handle" command may just seem to be a script formatter, but doing the above handle code does not do the same thing as using "put x [print ^(y)]".


Why:

Because if the "y" variable already exists, then if the "put" method would be used, the variable "x" would become "print value_of_y" if "value_of_y" would be the value of the "y" variable.



To execute a variable script, you can use first this to define the script:

put x [print Hello!]

and then this to execute the script:

rar x

The "rar" command executes whatever variable is the first argument,

which in this case is "x" which has the value of "print Hello!".


PAGE IS NOT COMPLETE YET!


NOTE: Different versions may have different command names and syntax, this wiki is using the latest version.