Getting Started

Get up and running with Keikaku in under 5 minutes. This guide covers installation, your first program, and essential concepts.

1Installation

Linux (Arch-based)

# Clone and build

$ git clone https://github.com/regaan/keikaku-programming-language.git

$ cd keikaku-programming-language/packaging/arch

$ makepkg -si

Linux/macOS (From Source)

# 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

Windows

# Download from GitHub Releases

Download keikaku.exe and add to PATH

2Your First Program

Create a file called hello.kei:

KEIKAKU Protocol
1# hello.kei - Your first Keikaku program
2
3declare("Hello, World!")
4declare("Everything proceeds according to plan.")

Run it:

$ keikaku hello.kei

# Output:

Hello, World!

Everything proceeds according to plan.

3Core Concepts (5-Minute Overview)

Variables

KEIKAKU Protocol
1# Use := to declare, = to reassign
2name := "Keikaku"
3count := 42
4count = count + 1
5
6# Lists
7items := [1, 2, 3, "mixed", true]

Conditionals

KEIKAKU Protocol
1score := 85
2
3foresee score >= 90:
4 declare("Excellent!")
5alternate score >= 70:
6 declare("Good job!")
7otherwise:
8 declare("Keep practicing")

Loops

KEIKAKU Protocol
1# Range loop
2cycle from 1 to 5 as i:
3 declare("Number:", i)
4
5# List iteration
6fruits := ["apple", "banana", "cherry"]
7cycle through fruits as fruit:
8 declare("I like", fruit)

Functions (Protocols)

KEIKAKU Protocol
1protocol greet(name):
2 declare("Hello,", name, "!")
3 yield "greeted"
4
5result := greet("World")
6# Output: Hello, World !

Generators (Sequences)

KEIKAKU Protocol
1sequence countdown(n):
2 cycle while n > 0:
3 yield n
4 n = n - 1
5 yield "Liftoff!"
6
7cycle through countdown(3) as val:
8 declare(val)
9# Output: 3, 2, 1, Liftoff!

4Interactive Mode (REPL)

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

Quick Reference Cheatsheet

Keywords

foreseeif
alternateelse if
otherwiseelse
cycleloop
protocolfunction
sequencegenerator
entityclass
manifestnew instance

Common Functions

declare()print
inquire()input
measure()length
text()to string
number()to int
proceed()next(gen)
yieldreturn value
delegateyield from

Next Steps