Skip to content

Tasty-Kiwi/kiwilang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KiwiLang

KiwiLang is a Lisp-like programming language written in Python.

Kiwilang is modular, allowing you write the syntax in JSON or KiwiLang's own, lisp-like syntax.

Usage

python main.py examples/hello.json [-v] [-d] [-r] [-p]
python main.py examples/hello.klsp -c [-v] [-d] [-r] [-p]
  • -v or --verbose - verbose output
  • -d or --debug - debug output
  • -r or --repl - run in interactive mode
  • -p or --performance - enable performance metrics
  • -c or --compile - use KiwiLang's compiler

Syntax

JSON

[
  ["print", "Hello, World!"],
  ["defn", ":x", 2],
  ["print", ":x"],
  ["defn", ":my_list", ["list", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],
  ["print", ":my_list"],

  ["defn", ":y", 2],
  ["if", ["=", ":y", 2], 
    ["print", "y is 2"],
    ["print", "y is not 2"]
  ],

  ["print", ["range", 1, 10]],

  ["for-each", "$i", ["range", 1, 10], ["print", "$i"]],
  
  ["defn", ":test", ["lambda", ["$x"], ["print", "$x"]]],
  [":test", "Hello, test function!"]
]

KiwiLang

(defn :x 2)
(print :x)
(defn :my_list (list 1 2 3 4 5 6 7 8 9 10))
(print :my_list)

(defn :y 2)
(if (= :y 2)
    (print "y is 2")
    (print "y is not 2"))

(print (range 1 10))

(for-each $i (range 1 10) (print $i))

(defn :test (lambda ($x) (print $x)))
(:test "Hello, test function!")

Features

  • Variables
  • Lambda functions
  • Control flow
  • Loops
  • Lists

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages