KEYwords
Downloads
v2.0.0+
This is now no longer an early release! But still be weary
btw error handling sucks right now so expect it to spew Python code on a line you didn't make
Keylang is a simple Python-like programming LANGuage that puts emphasis on built in functions and KEYwords.
It's powered by Python, so you have to have that downloaded haha
It can also embed Lua, but you don't need to download that because Keylang comes with the Lua.exe
Very lightweight if you already have Python
def is replaced with func for simplicity
: is replaced with opening ‘{‘ and closing ‘}’
() is optional for functions that don’t have arguments. However, calling them you still use () haha
Tabs and spaces are optional. Put them anyways they’re helpful
Variables are defined using the var keyword
's is an alias for the . accessor for better grammar, it may have a few bugs though
Yep you know Keylang now (ish)
You can embed Lua in Keylang!
To embed Lua, simply type
embed_lua{}
Easiest part
Right click on the zip folder and press "Extract All..." or something else if you're not on Windows idk
Open keylang-x.x.x -> keylang_files -> runner
Right click keylang.bat and press "Run as administrator"
It does cool stuff and sets up your .kl files
To run your .kl file... from a Python file, just put
import subprocess
with open("test.kl", "r") as f: # replace with file... path you want to run
kl_source = f.read()
result = subprocess.run(["python", "other_stuff/preprocess.py"], input=kl_source, text=True, capture_output=True) # replace this line if needed
python_code = result.stdout
exec(python_code, {"__name__": "__main__"})
var vari_name = dict("a" = random(67, 68), "b" = 2763)
func cool_func{
print("hi")
loop(3){
wait(1)
self 's scale *= random(vari_name)
}
}
cool_func()
# prints hi, then, repeating 3 times, waits 1 second before multiplying self's scale by a random value from the dictionary vari_name.
| Functions and keywords | What it does |
|---|---|
| var (v2.0.0+) | Defines a variable |
| loop(n) {} | Loops the code in the block an amount of times |
| loop() {} | Infinite loop |
| once {} | Won’t repeat code in the block after running it once |
| 's | Keyword alias of the . accessor, useful when you're fed up with . and want good grammar |
| array() | Creates a LIST not array |
| dict() | Creates a dictionary |
| the_array_name[index] | Access one of an LIST’s value |
| dictionary_array_name[key] | Access one of a dictionaries value |
| random(n, n) | Picks one of the numbers provided |
| random_range(from, to) | Picks one of the numbers in the range of the numbers provided |
| embed_lua {} | Runs Lua code |
| spawn func_name() | Calls a function… but it runs in the background |
| private func_name() | Alias of 2 underscores |
| protected func_name() | Alias of 1 underscore |
| print_vars | Prints all variables and their values |
| print_nones | Prints all variables with a value of None |
| print_all | Prints a LOT of stuff basically |
| looprate | Gets the rate of the last time it was called. Still may be buggy but should work for now |
| Shortcut | What it does |
|---|---|
| Ctrl K or Ctrl / | Comment out |
| Ctrl Shift K or Ctrl Shift / | Uncomment out |
| Ctrl F | Find |
| Ctrl D | Select word |
| Ctrl Shift D | Duplicate line |
| Alt ↑ / Alt ↓ | Move line up or down |
| Ctrl L | Select line |
| Tab and Shift+Tab | Indent or unindent selection |
You can download it directly from here
v2.x.x
Download Keylang v2.0.0v1.x.x
Download Keylang v1.0.0Or if for some reason you want the early releases:
Download Keylang v0.2.0 Download Keylang v0.1.1Or you can download from the GitHub repository
Go to GitHub repo PLEASE if you find bugs (very likely), send them here
Open an issue on GitHub