Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elisstaaf/kite

Source code for the "Kite" programming language. Contributions are always welcome! (WIP)
https://github.com/elisstaaf/kite

apache-2-0-license c contribute contributions-welcome functional functional-programming imperative imperative-programming imperative-programming-language interpreter minimal minimalist programming programming-language recursion recursive recursive-functions recursive-programming

Last synced: 2 months ago
JSON representation

Source code for the "Kite" programming language. Contributions are always welcome! (WIP)

Awesome Lists containing this project

README

        

Kite Programming Language
=========================

Kite is a pure and minimalistic programming language written in C.
It can be a lot, but if I'd *have* to classify it, it's a functional
programming language with imperative elements. This is a sample of what
code written in Kite might look like:

let loop = fun(func, times, until)
if times < until do @(func, times + 1, until)
else func

let incr = fun(num)
num + 1

let mainloop = fun(k, j, i)
loop(incr(k), j, i)

loop(mainloop(1, 5, 25), 0, 10)

Simple program to print the number "100":

# To print without newline:
write(tostring(100)
# or
import io
io.print(100)

# To print with a newline:
writeln(tostring(100))
# or
import io
io.println(100)

It also includes functions:

let println = fun(v)
writeln(tostring(v)

let sum = fun(x)
if x < 2 do x
else x + sum(x - 1)

println(sum(3))

This does the same thing as the last example:

let println = fun(v)
writeln(tostring(v))

println((fun(x) if x < 2 do x else x + @(x - 1))(3))

Oh, almost forgot about Modules:

import io
io.print(10)
io.println(20)
io.print(30)

stdlib/io.kite:

let export print = fun(val)
write(tostring(val))
let export println = fun(val)
writeln(tostring(val))

Another module; func:

import func

let test = fun()
writeln(tostring(100))

func.loop(test(), 0, 10)

stdlib/func.kite:

let export loop = fun(func, times, until)
if times < until do @(func, times + 1, until)
else func

(All modules should be located in ./stdlib/)

Requirements
------------
* https://gcc.gnu.org/install
* https://www.gnu.org/software/make
* https://git-scm.com/downloads or https://github.com/cli/cli#installation

Installation
------------
To install, firstly clone the repo:

# git
git clone https://github.com/ElisStaaf/kite

# gh
gh repo clone ElisStaaf/kite

Then build an executable using make:

cd kite
sudo make