Introducing KittenScript!

Continuing the discussion from Programming Language Jam:

I have finally, finally, FINALLY, FINALLY, FINALLY succeeded in making a programming language. (It doesn’t really have much to do with kittens)

It uses the file extension *.kitten. The official repository can be found here.

You can use KittenScript by forking my template and then editing the main.kitten file.

Sooooo, here’s a little doc about it:

KittenScript doc

KittenScript Official Documentation

1 Variables

You can set variables by using this syntax:

let variable of type type be value

variable: The name of the variable.
type: The type of the variable, see §1.2 for more info.
value: The value of the variable.

1.1 Constants

Constants are variables that cannot be changed. The constant syntax is similar to the variable syntax (§1):

const variable of type type be value

variable: The name of the constant.
type: The type of the constant, see §1.2 for more info.
value: The value of the constant.

1.1.1 Constant-related Errors

When you try to change a constant using set (§1.3), it will throw an error UNMODIFIABLE_LION (sorry for the strange error names). See §3.1 for more info on this error.

1.2 Data types

In KittenScript, all variables are typed, meaning that they must have a specified data type. The list of data types are: int, float, and string. (Booleans will come in support later)

int: An integer, any whole number.
float: Any decimal or “floating-point”.
string: Any text of any length (sorry, spaces are not supported yet) or “strings”.

1.3 Changing variables

The following does not apply to constants.

You can change variables using set. The syntax is a little bit different (Note that you must still specify the type because variables can change types)

set variable to value with type type

variable: The name of the variable.
value: The new value of the variable.
type: The new type of the variable, see §1.2.

1.4 Variable Expressions

In certain commands where expressions are supported, you can use variable expressions:

!var variable

variable: The name of the variable.

This expression returns the value of the variable. See §4 for more info on this expression.

2 Console Operations

2.1 Printing

You can print text (strings) to the console using the print command. Syntax:

print text|expr

text|expr: The text to print to the console. Expressions supported (§4)

2.2 Clearing

You can clear the console using the clear command:

clear

This command takes no parameters.

3 Errors

pass

4 Logic & Looping

4.1 If/Check-if/Otherwise

4.2 Looping

4.3 Conditions

4.4 exists

exists is a condition that checks if a variable exists. Syntax:

variable exists

Example:

if myvar exists
  print existence
endif
5 Likes

A very interesting language. How about functions?

Such a shame it isn’t compatible with Windows 98

It’s not supposed to be. You’re supposed to run it on Replit.

Functions, if/else, looping, and other logic will be added soon.

2 Likes

It will be a good programming language!
I want to say that it is possible to change the value of a variable without specifying its new type, with the following syntax: set variable to value, this can be used if the type of the variable should not be changed.

1 Like

Great idea! I will implement this soon.

1 Like

do you have a replit link?

Sorry, no. I just added the instructions to use KittenScript above:

EDIT: I do have a Repl that I use for testing, however, it isn’t a template and you shouldn’t fork it. I will make a template soon.

1 Like

Love it (and the errors are awesome lol)

Meow

3 Likes

ok thanks, i would just look on github but my school decided to block it lol

Also can’t wait for logic to be added (and once you complete the template, I’ll be sure to try it out!)
I do have a question though; once you start to add some complexity to the language, will you add object-oriented programming?

The template is complete!

You can find it at:

https://replit.com/@element1010/KittenScript?v=1

Note that this is one of my “self-writing Repls”. It downloads the main.py file from GitHub, then writes it to the main.py file in the Repl. If you ever wanted to update KittenScript, you don’t need to re-fork the template! You can just run python3 download.py in the Shell tab, and KittenScript will automatically be updated! And, the other benefit of self-writing Repls is lower storage (for my account).

In order to use the self-writing Repl, you need to Run it first, before doing anything. The first run will put the source code in main.py. Only after this can you start writing KittenScript in main.kitten.

If I figure out how to.

You should probably add this to the readme.md

No, I put it in GitHub’s Wiki. It’s a little bit different there.

Can I have the link to the Git?

The Git… as in the repository? It’s up there ^

Ok, there’s a bug. I’m trying to get the if logic working.

Sorry if the joke was kinda bad, the joke was meant to be that Windows 98 file extensions had a max limit of 3 IIRC, and so this file type would probably give an error.

1 Like

Why doesn’t it work?

I was going to make an improved template but it doesn’t even work :l

Because the file is main.kts and not main.kitten. I thought I changed .kts to .kitten? It works completely fine when it’s main.kitten.