Skip to main content

Lightweight and expressive programming language similar to Python

Project description

Zink

Zink is a programming language that simplifies scripting with many tweaks and additions.

Why Zink and not other languages?

One of the problems developers face when writing in other languages is that it can sometimes be very complex to write simple expressions, like for example iterating through a list while also getting the current item's position in that list in Python, which uses the enumerate function.

Zink simplifies these kinds of operations by letting the developer write shorter code and still converting it to the correct functions.

Quick comparison

This Python script determines if a number is prime:

def is_prime(n: int) -> bool:
    if n <= 1: return False
    if n <= 3: return True
    if n % 2 == 0 or n % 3 == 0: return False

    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i += 6
    return True

This here is that same code written in Zink:

def is_prime(n: int): bool
    if n <= 1; <-False;.
    if n <= 3; <-True;.
    if n % 2 == 0 or n % 3 == 0; <-False;.

    i = 5
    while i * i <= n
        if n % i == 0 or n % (i + 2) == 0
            <-False
        .
        i += 6
    .
    <-True
.

It may seem stupid (and longer), but now look at Python classes:

class Animal:
    def __init__(self, name: str) -> None:
        self.name = name
    def eat(self, food: str) -> None:
        print(self.name, "is eating", food)

class Bird(Animal):
    def __init__(self, name: str, color: str) -> None:
        super().__init__(name=name)
        self.color = color
    def fly(self) -> None:
        print(self.color, self.name, "is flying")

And look at those same classes in Zink:

class Animal
    def __init__(@, @name: str): None;;.

    def eat(@, food: str): None
        print(@.name, "is eating", food)
    .
.

class Bird from Animal
    def __init__(@, ^name: str, @color: str)@: None;;.

    def fly(@): None
        print(@.color, @.name, "is flying")
    .
.

You can start to notice that it simplifies many things that require a lot of time to type: it replaces entire lines spent typing self.foo = foo to simply putting a @ before the argument, or automatically passing those arguments to the super().__init__ function with ^. In fact, that very function is abbreviated to @^.

Getting the length of an object is as easy as typing # before the object, and converting an object to a type is done with the repurposed keyword as.

Here's a comparison between Zink and Python:

Python Zink
type(a) a as type
a.upper() ↑a
a.lower() ↓a
a() a!
print(a) :::a
self @
self.a = a @<-a
super() ^
super().__init__ @^
a = a.b a .= b
for i, x in enumerate(a) for x at i in a
range(10) {->10}
range(2, 5) {2<->5}
try: ... except: pass try ...
try: ... except: ... try ... catch ...
x <= a <= y (a between x, y)

Language support

Zink is also built with the idea of writing the same code while still converting it to many languages, like for example writing the source code in Zink and then converting it to both Python and Ruby. The bin folder here contains the main file zink (that requires the language we're trying to convert to as the first parameter) and a bunch of "helper" files like zpy which is exactly the same as calling zink py.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zlang-1.0.4.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zlang-1.0.4-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file zlang-1.0.4.tar.gz.

File metadata

  • Download URL: zlang-1.0.4.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.14.6-arch1-1

File hashes

Hashes for zlang-1.0.4.tar.gz
Algorithm Hash digest
SHA256 99704124e53033c8a9e9ef90f38b3e91db39b54e39e190a31281e48bf9cc8d05
MD5 fb5b52b1fd39e22d0915d6c61b438fee
BLAKE2b-256 bfd5869599a83c901ffced00831e621d3f867f1b060eb09703bb9de3f76c19aa

See more details on using hashes here.

File details

Details for the file zlang-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: zlang-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.14.6-arch1-1

File hashes

Hashes for zlang-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d61be1d817a4b7cae8ab48d5e0ef7c9c93fc4686be52cf6c1f8d6ed8a0013f11
MD5 4658d9464449d6d6b0cbdac48599928b
BLAKE2b-256 feeac3792f740db2d8cf603c16b21a30bf32fc8cd7103012152c7b1a4a4a2afe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page