Website docs https://fsk.kirosb.fr
FPM Gestionary package Website https://fpm.kirosb.fr
A custom interpreted programming language written in C++.
- Dynamic Typing: Variables can hold any type of value.
- Functions: First-class functions with closures.
- Classes: Object-oriented programming with classes and inheritance.
- Standard Library: Built-in
FSKobject for system utilities. - Import System: Modularize code with
import.
Requirements:
- CMake 3.10+
- C++ Compiler (C++17 recommended)
mkdir build
cd build
cmake ..
makeAfter building, you can install Fsk and FPM system-wide to run fsk and fpm from any directory.
sudo mkdir -p /usr/local/lib/fsk/
sudo cp -r std /usr/local/lib/fsk/
sudo cp build/fsk /usr/local/bin/
sudo cp -r fpm /usr/local/lib/fsk/
echo '#!/bin/bash' | sudo tee /usr/local/bin/fpm
echo 'fsk /usr/local/lib/fsk/fpm/fpm.fsk "$@"' | sudo tee -a /usr/local/bin/fpm
sudo chmod +x /usr/local/bin/fpmRun as Administrator:
New-Item -ItemType Directory -Force -Path "C:\Fsk"
Copy-Item -Recurse -Force "std" "C:\Fsk\"
[System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Fsk", "User")
Copy-Item -Recurse -Force "fpm" "C:\Fsk\"
Set-Content -Path "C:\Fsk\fpm.bat" -Value '@fsk C:\Fsk\fpm\fpm.fsk %*'Note: You will need to manually compile or download
fsk.exeand place it inC:\Fsk\.
Run a script:
./fsk script.fskInteractive mode (REPL):
./fskimport "lib.fsk";
class Greeter {
fn init(name) {
this.name = name;
}
fn greet() {
print "Hello, " + this.name + "!";
}
}
let g = Greeter("World");
g.greet();
print "Random: " + FSK.random(1, 100);FSK.random(min, max): Returns a random number between min and max.FSK.exec(command): Executes a shell command.FSK.version(): Returns the current version.FSK.sleep(ms): Pauses execution formsmilliseconds.
Fsk comes with a standard library written in Fsk itself, located in the std/ directory. It is automatically loaded on startup.
A linked list implementation.
let list = List();
list.push(10);
list.push(20);
list.map(fn(x) { return x * 2; }).forEach(fn(x) { print x; });Math utilities.
print Math.max(10, 20); // 20
print Math.pow(2, 3); // 8Fsk includes a native HTTP server! You can run the self-hosted documentation:
./build/fsk docs/server.fskVisit https://fsk.kirosb.fr to see the documentation served by Fsk itself.
fn handler(req) {
return "<h1>Hello from Fsk!</h1>";
}
FSK.startServer(3000, handler);Fsk supports anonymous functions, useful for callbacks and functional programming.
let double = fn(x) { return x * 2; };
print double(5); // 10