A low level turing-complete interpreter for YAML
Project description
YIPL
YIPL pronounced Yip-el is a turing-complete interpreted language using YAML as it's syntax,
made for Hackclub Horizons.
Quick start
- In your terminal of choice type
pip install yipl - Create a YAML file with your code (example code below)
print:
- Hello World!
- Run
yipl <file.yaml>
AI Disclaimer for hackclub
No AI was used :)
Maybe Helpful Links
Syntax
General rules
Key names
Because of YAML's inherent structure, every key must be unique. YIPL allows any keyword to be appended by text with a leading space. Examples include:
print 1:set main variableif a and b are equal
Truthiness
YIPL uses the same truthiness values as Python when using logical operators.
Falsy values: False, None, 0, 0.0, "" (empty string), [] (empty list), {} (empty dict)
Truthy values: Everything else
Function nesting
YIPL allows the nesting of functions to allow for more complex functions than the basic keywords. Some examples include:
Greater than or equal
or:
- greater:
- $a
- $b
- equality:
- $a
- $b
Modulo ($a mod $b)
minus:
- $a
- multiply:
- $b
- cast:
- int
- divide:
- $a
- $b
Increment by $b
set:
- $a
- plus:
- $a
- $b
Keywords
YIPL posesses 17 unique keywords, all listed below.
Comparisons
Equality
a == b
Takes two variables, outputs bool if exactly the same
equality:
- a
- b
Greater than
a > b
Takes two int or floats, outputs bool if a is greater than b (not equal to)
greater:
- a
- b
Less than
a < b
Takes two int or floats, outputs bool if a is less than b (not equal to)
less:
- a
- b
Or
a or b
Takes two bools or comparisons, outputs bool if a or b is True
or:
- a
- b
And
a and b
Takes two bools or comparisons, outputs bool if a and b is True
and:
- a
- b
Not
not a
Takes one bool or comparisons, outputs the opposite boolean literal
not:
- a
Conditionals
if a == True:
print("Yes")
elif a == False:
print("No")
else:
print("something else")
If:
Takes one bool or comparison, jumps to the name of the second entry if true, the third entry if false (think ASM). Every term is required
if_1:
- equality:
- a
- True
- print_1
- if_2
print_1:
- Yes
goto_1:
- <code>
if_2:
- equality:
- a
- False
- print_2
- print_3
print_2:
- No
goto_2:
- <code>
print_3:
- something else
goto_3:
- <code>
Arithmetic
All of YIPL's arithmetic only works on two values at a time; a + b + c in one function is not possible in YIPL
a + b
a - b
a * b
a / b
Addition:
Returns the sum of two ints or floats as an int or float
Subtraction:
Returns the difference of two ints or floats as an int or float
Multiplication:
Returns the product of two ints or floats as an int or float
Division:
Returns the Quotient of two ints or floats as an int or float
plus:
- a
- b
minus:
- a
- b
multiply:
- a
- b
divide:
- a
- b
Variables
variables are made by prepending a string with $. They do not need to be put in quotes
When using set:, the $ is optional
filler_word = "Foobar"
set:
- $filler word
- Foobar
I/O
Print:
print(a)
Prints the given data to the terminal
print:
- a
Set:
input(a)
Returns the typed value as a str. a is the prompt displayed in the terminal/
input:
- a
Cast:
int(a)
str(b)
float(c)
Returns argument b as the type a
Supported types:
- int
- str
- float
cast:
- int
- $a
cast:
- str
- $b
cast:
- float
- $c
List operations
YIPL posesses multiple operations to be done on a list object.
To make a list, use [] like python in the second field of set:
set:
- $a
- [a, b, c]
makes a variable $a with the contents [a, b, c]
All operations on lists are done in the list: function, with the first argument being which one to use.
Currently implemented functions are:
- length
- read
- delete
- append
- replace
list:
- length
- $a
Returns the length of the list $a as an int. Equivialent to len(a) in python
list:
- read
- $a
- $b
Returns the item at index $b of list $a. Equivialent to a[b]
list:
- delete
- $a
- $b
Removes the item at index $b of list $a. Equivialent to del a[b]
list:
- append
- $a
- $b
Appends $b to list $a. Equivialent to a.append(b)
list:
- replace
- $a
- $b
- $c
Replaces the item at index $b of list $a with $c. Equivialent to a[b] = c
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yipl-1.0.1.tar.gz.
File metadata
- Download URL: yipl-1.0.1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0128b37a9ab9979c686552e64f4521d98f41615455fc431ae603891c117f059a
|
|
| MD5 |
415f2b27363157dd4b7849569d86bb6c
|
|
| BLAKE2b-256 |
8d5dd00e1975418ffe16dafdebc0f92cac46acdb86f4148306d69fa4db8b9c22
|
File details
Details for the file yipl-1.0.1-py3-none-any.whl.
File metadata
- Download URL: yipl-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c72cb765cf11416a3080af5df796962290cb89c80e7ef02892324b43d0c6eff5
|
|
| MD5 |
e82c6e7efe62a5524a570408fca06846
|
|
| BLAKE2b-256 |
c7ca90a8de4a603e63bbe2ee5ebfd88636c6ac1efd1f7451ad15c1874f1b45f3
|