Skip to main content

Oktopios — un langage de programmation moderne et expressif

Project description

🐙 Oktopios

Un langage de programmation moderne, expressif et orienté objet, interprété en Python.


Installation

pip install oktopios

Ou depuis les sources :

git clone https://github.com/ALISOULEMOUANWIYA/oktopios
cd oktopios
pip install -e .

Utilisation rapide

# Exécuter un fichier
okp mon_programme.okp

# Code en ligne
okp 'print("Bonjour 🐙")'

# Mode interactif (REPL)
okp --repl

# Aide complète
okp --help

Syntaxe de base

// Variables et constantes
var age: int = 25
val nom: string = "Mouanwiya"

// Fonctions
fun saluer(prenom: string): string {
    return "Bonjour " + prenom + " !"
}
print(saluer(nom))

// Surcharge de fonctions
fun calcule(a: int, b: int): int { return a + b }
fun calcule(a: int, b: int, c: int): int { return (a + b) * c }

// Lambdas
val doubler = lambda(x: int) => x * 2
print(doubler(5))   // 10

// Boucles
loop (i = 0; i < 5; i += 1) {
    print(i)
}

// Classes
class Animal {
    var nom: string

    fun __construct(n: string) {
        this.nom = n
    }

    fun parler(): string {
        return this.nom + " dit bonjour"
    }
}

var chat = new Animal("Mimi")
print(chat.parler())

// Modules natifs
inject Math as math
inject String

print(Math.sqrt(16))           // 4.0
print(String.upper("hello"))   // HELLO

matrix.new([lignes, colonnes]) → MatrixObject (sparse) Pour les graphes, réseaux, liens entre cellules, traversée BFS/DFS :

inject matrix
var m = matrix.new([3, 3])
matrix.set(m, [0, 0], 42)
matrix.link(m, [0, 0], m, [1, 1])
var chemin = matrix.traverse(m, [0, 0], "bfs")

matrix.new([lignes, colonnes], true) → Matrix (dense) Pour les calculs mathématiques, addition, produit tensoriel, IA :

inject matrix
var A = matrix.new([2, 2], true)
var B = matrix.new([2, 2], true)
matrix.set(A, [0, 0], 1)
var C = matrix.add(A, B)
var T = matrix.tensor(A, B)
var R = matrix.contract(A, B, 0, 1)

Fonctionnalités

  • ✅ Variables typées (var, val)
  • ✅ Fonctions avec surcharge (overloading)
  • ✅ Lambdas et fonctions anonymes
  • ✅ Classes, interfaces, classes abstraites
  • ✅ Héritage, override, super
  • ✅ Énumérations
  • ✅ Modules natifs : Math, String, Time, IO, List, Dict...
  • ✅ Boucles avancées : loop, filterLoop, sortLoop, permuteLoop...
  • ✅ Gestion des exceptions (try / catch / finally / throw)
  • ✅ REPL interactif
  • ✅ Importation de fichiers .okp

Commandes CLI

Commande Description
okp fichier.okp Exécute un fichier
okp 'code' Exécute du code inline
okp --repl Lance le REPL
okp --check fichier.okp Vérifie la syntaxe
okp --version Affiche la version
okp --keywords Liste les mots-clés
okp --native Liste les fonctions natives
okp --doc Documentation intégrée
okp --init NomProjet Crée un projet

Licence

MIT © Mouanwiya Ali Soule

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oktopios-0.0.4.tar.gz (74.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oktopios-0.0.4-py3-none-any.whl (79.6 kB view details)

Uploaded Python 3

File details

Details for the file oktopios-0.0.4.tar.gz.

File metadata

  • Download URL: oktopios-0.0.4.tar.gz
  • Upload date:
  • Size: 74.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for oktopios-0.0.4.tar.gz
Algorithm Hash digest
SHA256 cd529264b626861d2485a0e5ba621bbf086972948f654004821d069e11c52ace
MD5 b723905afb201770a7af6bdce2a78f50
BLAKE2b-256 a9dbb52c4a7e5ef66304598f9018c8996ac27db2eb9f06b8759f58f8c226e2a2

See more details on using hashes here.

File details

Details for the file oktopios-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: oktopios-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 79.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for oktopios-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ff55f8028aaf1e053dd5704a53bc292d8e03fc9e7d4fa92d8c3b32ded230520f
MD5 5db07b4312400a4aeadf86b00afa45af
BLAKE2b-256 89c2bd300fd2c48bef04e67d0585cebd700a2e7a1be9b441c9fcad709053ba29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page