Get up and running with Keikaku in under 5 minutes. This guide covers installation, your first program, and essential concepts.
# Clone and build
$ git clone https://github.com/regaan/keikaku-programming-language.git
$ cd keikaku-programming-language/packaging/arch
$ makepkg -si
# Requires CMake and GCC
$ git clone https://github.com/regaan/keikaku-programming-language.git
$ cd keikaku-programming-language
$ mkdir build && cd build
$ cmake .. && make
$ sudo make install
# Download from GitHub Releases
Download keikaku.exe and add to PATH
Create a file called hello.kei:
1# hello.kei - Your first Keikaku program23declare("Hello, World!")4declare("Everything proceeds according to plan.")Run it:
$ keikaku hello.kei
# Output:
Hello, World!
Everything proceeds according to plan.
1# Use := to declare, = to reassign2name := "Keikaku"3count := 424count = count + 156# Lists7items := [1, 2, 3, "mixed", true]1score := 8523foresee score >= 90:4 declare("Excellent!")5alternate score >= 70:6 declare("Good job!")7otherwise:8 declare("Keep practicing")1# Range loop2cycle from 1 to 5 as i:3 declare("Number:", i)45# List iteration6fruits := ["apple", "banana", "cherry"]7cycle through fruits as fruit:8 declare("I like", fruit)1protocol greet(name):2 declare("Hello,", name, "!")3 yield "greeted"45result := greet("World")6# Output: Hello, World !1sequence countdown(n):2 cycle while n > 0:3 yield n4 n = n - 15 yield "Liftoff!"67cycle through countdown(3) as val:8 declare(val)9# Output: 3, 2, 1, Liftoff!Run keikaku without arguments to enter the interactive shell:
$ keikaku
╔═══════════════════════════════════════════════════════════╗
║ K E I K A K U v1.0.0 ║
║ "Everything proceeds according to plan." ║
╚═══════════════════════════════════════════════════════════╝
keikaku> x := 10 + 20
→ 30
keikaku> declare("Result:", x * 2)
Result: 60
keikaku> conclude
foresee | if |
alternate | else if |
otherwise | else |
cycle | loop |
protocol | function |
sequence | generator |
entity | class |
manifest | new instance |
declare() | |
inquire() | input |
measure() | length |
text() | to string |
number() | to int |
proceed() | next(gen) |
yield | return value |
delegate | yield from |