stencil-lang 1.0.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stencil_lang/__init__.py +32 -0
- stencil_lang/examples/collections.st +25 -0
- stencil_lang/examples/demo.st +70 -0
- stencil_lang/examples/fibonacci.st +12 -0
- stencil_lang/examples/oop.st +39 -0
- stencil_lang/examples/pixel_oyun.st +50 -0
- stencil_lang/examples/showcase.st +44 -0
- stencil_lang/examples/snake.st +87 -0
- stencil_lang/examples/v2_data.st +46 -0
- stencil_lang/examples/v2_fibonacci.st +25 -0
- stencil_lang/examples/v2_model.st +59 -0
- stencil_lang/stencil.exe +0 -0
- stencil_lang-1.0.0.dist-info/METADATA +40 -0
- stencil_lang-1.0.0.dist-info/RECORD +17 -0
- stencil_lang-1.0.0.dist-info/WHEEL +5 -0
- stencil_lang-1.0.0.dist-info/entry_points.txt +2 -0
- stencil_lang-1.0.0.dist-info/top_level.txt +1 -0
stencil_lang/__init__.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""STencil programming language launcher (pip wrapper).
|
|
2
|
+
|
|
3
|
+
Bundles the native STencil interpreter/compiler executable and exposes it as the
|
|
4
|
+
`stencil` command after `pip install stencil-lang`.
|
|
5
|
+
"""
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
import subprocess
|
|
9
|
+
|
|
10
|
+
__version__ = "1.0.0"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _exe_path() -> str:
|
|
14
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
15
|
+
name = "stencil.exe" if os.name == "nt" else "stencil"
|
|
16
|
+
return os.path.join(here, name)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> int:
|
|
20
|
+
"""Entry point for the `stencil` console script — forwards all args."""
|
|
21
|
+
exe = _exe_path()
|
|
22
|
+
if not os.path.exists(exe):
|
|
23
|
+
sys.stderr.write("STencil executable not found in package.\n")
|
|
24
|
+
return 1
|
|
25
|
+
try:
|
|
26
|
+
return subprocess.call([exe] + sys.argv[1:])
|
|
27
|
+
except KeyboardInterrupt:
|
|
28
|
+
return 130
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// STencil - Listeler ve Sözlükler (çalışan v1 sözdizimi)
|
|
2
|
+
// Kitteniverse Studios
|
|
3
|
+
|
|
4
|
+
print("--- Liste ---");
|
|
5
|
+
let sayilar = [10, 20, 30, 40, 50];
|
|
6
|
+
print("Orijinal:", sayilar);
|
|
7
|
+
sayilar.push(60);
|
|
8
|
+
print("Ekleme sonrası:", sayilar);
|
|
9
|
+
print("Uzunluk:", len(sayilar));
|
|
10
|
+
|
|
11
|
+
let toplam = 0;
|
|
12
|
+
let i = 0;
|
|
13
|
+
while (i < len(sayilar)) {
|
|
14
|
+
toplam = toplam + sayilar[i];
|
|
15
|
+
i = i + 1;
|
|
16
|
+
}
|
|
17
|
+
print("Toplam:", toplam);
|
|
18
|
+
|
|
19
|
+
print("--- Sözlük ---");
|
|
20
|
+
let ogrenci = { "ad": "Ali", "soyad": "Yılmaz", "yas": 22, "aktif": true };
|
|
21
|
+
print("Adı:", ogrenci["ad"], "| Yaşı:", ogrenci["yas"]);
|
|
22
|
+
ogrenci["bolum"] = "Bilgisayar Mühendisliği";
|
|
23
|
+
ogrenci["yas"] = 23;
|
|
24
|
+
print("Bölüm:", ogrenci["bolum"], "| Güncel yaş:", ogrenci["yas"]);
|
|
25
|
+
print("Anahtarlar:", ogrenci.keys());
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// STencil ile yazilmis ornek program
|
|
3
|
+
// Kitteniverse Studios
|
|
4
|
+
// ============================================
|
|
5
|
+
|
|
6
|
+
print("==== STencil Mini Uygulama ====");
|
|
7
|
+
|
|
8
|
+
// --- 1) Fonksiyon + ozyineleme ---
|
|
9
|
+
func faktoriyel(n) {
|
|
10
|
+
if (n <= 1) { return 1; }
|
|
11
|
+
return n * faktoriyel(n - 1);
|
|
12
|
+
}
|
|
13
|
+
print("5! =", faktoriyel(5));
|
|
14
|
+
|
|
15
|
+
// --- 2) FizzBuzz (dongu + kosul) ---
|
|
16
|
+
print("");
|
|
17
|
+
print("FizzBuzz 1..15:");
|
|
18
|
+
for (let i = 1; i <= 15; i = i + 1) {
|
|
19
|
+
if (i % 15 == 0) { print(i, "-> FizzBuzz"); }
|
|
20
|
+
else if (i % 3 == 0) { print(i, "-> Fizz"); }
|
|
21
|
+
else if (i % 5 == 0) { print(i, "-> Buzz"); }
|
|
22
|
+
else { print(i, "->", i); }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// --- 3) Liste isleme + builtin'ler ---
|
|
26
|
+
print("");
|
|
27
|
+
let notlar = [70, 85, 90, 60, 100, 45];
|
|
28
|
+
let toplam = 0;
|
|
29
|
+
let i = 0;
|
|
30
|
+
while (i < len(notlar)) {
|
|
31
|
+
toplam = toplam + notlar[i];
|
|
32
|
+
i = i + 1;
|
|
33
|
+
}
|
|
34
|
+
let ortalama = toplam / len(notlar);
|
|
35
|
+
print("Notlar:", notlar);
|
|
36
|
+
print("Ortalama:", ortalama, "| En yuksek:", max(notlar), "| En dusuk:", min(notlar));
|
|
37
|
+
|
|
38
|
+
// --- 4) Sozluk ---
|
|
39
|
+
print("");
|
|
40
|
+
let kisi = { "ad": "Emir", "rol": "Gelistirici", "dil": "STencil" };
|
|
41
|
+
print(kisi["ad"], "bir", kisi["rol"], "ve favori dili", kisi["dil"]);
|
|
42
|
+
|
|
43
|
+
// --- 5) OOP: basit banka hesabi ---
|
|
44
|
+
print("");
|
|
45
|
+
class Hesap {
|
|
46
|
+
func init(sahip, bakiye) {
|
|
47
|
+
this.sahip = sahip;
|
|
48
|
+
this.bakiye = bakiye;
|
|
49
|
+
}
|
|
50
|
+
func yatir(miktar) {
|
|
51
|
+
this.bakiye = this.bakiye + miktar;
|
|
52
|
+
print(this.sahip + " yatirdi:", miktar, "| Bakiye:", this.bakiye);
|
|
53
|
+
}
|
|
54
|
+
func cek(miktar) {
|
|
55
|
+
if (miktar > this.bakiye) {
|
|
56
|
+
print("Yetersiz bakiye!");
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
this.bakiye = this.bakiye - miktar;
|
|
60
|
+
print(this.sahip + " cekti:", miktar, "| Bakiye:", this.bakiye);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let h = Hesap("Emir", 100);
|
|
65
|
+
h.yatir(250);
|
|
66
|
+
h.cek(80);
|
|
67
|
+
h.cek(1000);
|
|
68
|
+
|
|
69
|
+
print("");
|
|
70
|
+
print("==== Bitti — sqrt(144) =", sqrt(144.0), "====");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// STencil - Fibonacci (çalışan v1 sözdizimi)
|
|
2
|
+
// Kitteniverse Studios
|
|
3
|
+
|
|
4
|
+
func fibonacci(n) {
|
|
5
|
+
if (n <= 1) { return n; }
|
|
6
|
+
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
print("--- Fibonacci ---");
|
|
10
|
+
for (let i = 0; i < 10; i = i + 1) {
|
|
11
|
+
print("fib(" + i + ") =", fibonacci(i));
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// STencil - Nesne Yönelimli Programlama (çalışan v1 sözdizimi)
|
|
2
|
+
// Kitteniverse Studios
|
|
3
|
+
|
|
4
|
+
class Araba {
|
|
5
|
+
func init(marka, model) {
|
|
6
|
+
this.marka = marka;
|
|
7
|
+
this.model = model;
|
|
8
|
+
this.hiz = 0;
|
|
9
|
+
this.calisiyor = false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func calistir() {
|
|
13
|
+
this.calisiyor = true;
|
|
14
|
+
print(this.marka + " motoru çalıştı. Vrum vrum!");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func hizlan(artis) {
|
|
18
|
+
if (!this.calisiyor) {
|
|
19
|
+
print("Önce motoru çalıştırmalısın!");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
this.hiz = this.hiz + artis;
|
|
23
|
+
print("Yeni hız: " + this.hiz + " km/s");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func fren_yap(azalis) {
|
|
27
|
+
this.hiz = this.hiz - azalis;
|
|
28
|
+
if (this.hiz < 0) { this.hiz = 0; }
|
|
29
|
+
print("Fren! Yeni hız: " + this.hiz + " km/s");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
print("--- Model Testi ---");
|
|
34
|
+
let arabam = Araba("Toyota", "Corolla");
|
|
35
|
+
arabam.hizlan(20); // motor kapalı -> uyarı
|
|
36
|
+
arabam.calistir();
|
|
37
|
+
arabam.hizlan(50);
|
|
38
|
+
arabam.hizlan(30);
|
|
39
|
+
arabam.fren_yap(40);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// ===== PIKSEL OYUNU — STencil (pencere grafigi) =====
|
|
2
|
+
// Ok tuslari ile yesil kareyi hareket ettir, kirmizi hedefi topla.
|
|
3
|
+
// Pencereyi kapatınca veya ESC ile cikar.
|
|
4
|
+
|
|
5
|
+
let W = 400;
|
|
6
|
+
let H = 300;
|
|
7
|
+
let ok = window_open(W, H, "STencil Piksel Oyunu");
|
|
8
|
+
|
|
9
|
+
let x = 180;
|
|
10
|
+
let y = 130;
|
|
11
|
+
let boyut = 20;
|
|
12
|
+
let hedefx = randint(20, W - 40);
|
|
13
|
+
let hedefy = randint(20, H - 40);
|
|
14
|
+
let skor = 0;
|
|
15
|
+
let oyna = ok;
|
|
16
|
+
|
|
17
|
+
while (oyna) {
|
|
18
|
+
// girdi
|
|
19
|
+
if (window_key("left")) { x = x - 6; }
|
|
20
|
+
if (window_key("right")) { x = x + 6; }
|
|
21
|
+
if (window_key("up")) { y = y - 6; }
|
|
22
|
+
if (window_key("down")) { y = y + 6; }
|
|
23
|
+
if (window_key("esc")) { oyna = false; }
|
|
24
|
+
|
|
25
|
+
// sinirlar
|
|
26
|
+
if (x < 0) { x = 0; }
|
|
27
|
+
if (y < 0) { y = 0; }
|
|
28
|
+
if (x > W - boyut) { x = W - boyut; }
|
|
29
|
+
if (y > H - boyut) { y = H - boyut; }
|
|
30
|
+
|
|
31
|
+
// carpisma (basit kutu carpismasi)
|
|
32
|
+
if (x < hedefx + 16 && x + boyut > hedefx && y < hedefy + 16 && y + boyut > hedefy) {
|
|
33
|
+
skor = skor + 1;
|
|
34
|
+
hedefx = randint(20, W - 40);
|
|
35
|
+
hedefy = randint(20, H - 40);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ciz
|
|
39
|
+
fill("black");
|
|
40
|
+
rect(hedefx, hedefy, 16, 16, "red");
|
|
41
|
+
rect(x, y, boyut, boyut, "green");
|
|
42
|
+
// skor cubugu (ust solda yesil barlar)
|
|
43
|
+
let i = 0;
|
|
44
|
+
while (i < skor) { rect(5 + i * 8, 5, 6, 6, "yellow"); i = i + 1; }
|
|
45
|
+
|
|
46
|
+
let acik = window_update();
|
|
47
|
+
if (!acik) { oyna = false; }
|
|
48
|
+
}
|
|
49
|
+
window_close();
|
|
50
|
+
print("Oyun bitti! Skor:", skor);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// STencil v1 - Çalışan Özellik Vitrini
|
|
2
|
+
// Kitteniverse Studios
|
|
3
|
+
// Çalıştırma: stencil examples/showcase.st
|
|
4
|
+
|
|
5
|
+
print("=== STencil Vitrin ===");
|
|
6
|
+
|
|
7
|
+
// Değişkenler ve tipler
|
|
8
|
+
let isim = "STencil";
|
|
9
|
+
let surum = 1.0;
|
|
10
|
+
let aktif = true;
|
|
11
|
+
print("Dil:", isim, "| Sürüm:", surum, "| Aktif:", aktif);
|
|
12
|
+
|
|
13
|
+
// Sayısal kule: int, float ve karışık aritmetik
|
|
14
|
+
print("Tam bölme 7 / 2 =", 7 / 2);
|
|
15
|
+
print("Float bölme 7.0 / 2 =", 7.0 / 2);
|
|
16
|
+
print("Karışık 3 + 1.5 =", 3 + 1.5);
|
|
17
|
+
print("Mod 7.5 % 2 =", 7.5 % 2);
|
|
18
|
+
|
|
19
|
+
// Karşılaştırma ve kısa devreli mantık
|
|
20
|
+
let x = 10;
|
|
21
|
+
print("x büyük mü?", x > 5 && x < 100);
|
|
22
|
+
|
|
23
|
+
// Fonksiyon ve özyineleme
|
|
24
|
+
func faktoriyel(n) {
|
|
25
|
+
if (n <= 1) { return 1; }
|
|
26
|
+
return n * faktoriyel(n - 1);
|
|
27
|
+
}
|
|
28
|
+
print("5! =", faktoriyel(5));
|
|
29
|
+
|
|
30
|
+
// Döngü
|
|
31
|
+
let toplam = 0;
|
|
32
|
+
let i = 1;
|
|
33
|
+
while (i <= 100) {
|
|
34
|
+
toplam = toplam + i;
|
|
35
|
+
i = i + 1;
|
|
36
|
+
}
|
|
37
|
+
print("1..100 toplamı =", toplam);
|
|
38
|
+
|
|
39
|
+
// Yerleşik fonksiyonlar
|
|
40
|
+
print("karekök(2) =", sqrt(2.0));
|
|
41
|
+
print("mutlak(-7) =", abs(-7));
|
|
42
|
+
print("uzunluk =", len("merhaba"));
|
|
43
|
+
|
|
44
|
+
print("=== Bitti ===");
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// ===== SNAKE — STencil ile gerçek-zamanlı terminal oyunu =====
|
|
2
|
+
// Oynamak icin: stencil snake.st (ok tuslari ile yonlendir, q ile cik)
|
|
3
|
+
|
|
4
|
+
let W = 24;
|
|
5
|
+
let H = 14;
|
|
6
|
+
|
|
7
|
+
game_init();
|
|
8
|
+
|
|
9
|
+
// Yilan: bas saga dogru, govde 3 parca. Her parca [x, y].
|
|
10
|
+
let yilan = [[5, 7], [4, 7], [3, 7]];
|
|
11
|
+
let dx = 1;
|
|
12
|
+
let dy = 0;
|
|
13
|
+
let skor = 0;
|
|
14
|
+
let bitti = false;
|
|
15
|
+
|
|
16
|
+
// Yem
|
|
17
|
+
let yemx = randint(1, W - 2);
|
|
18
|
+
let yemy = randint(1, H - 2);
|
|
19
|
+
|
|
20
|
+
let guvenlik = 0;
|
|
21
|
+
while (!bitti && guvenlik < 5000) {
|
|
22
|
+
guvenlik = guvenlik + 1;
|
|
23
|
+
|
|
24
|
+
// --- girdi (engellemeyen) ---
|
|
25
|
+
let t = key();
|
|
26
|
+
if (t == "up") { if (dy == 0) { dx = 0; dy = 0 - 1; } }
|
|
27
|
+
elif (t == "down") { if (dy == 0) { dx = 0; dy = 1; } }
|
|
28
|
+
elif (t == "left") { if (dx == 0) { dx = 0 - 1; dy = 0; } }
|
|
29
|
+
elif (t == "right") { if (dx == 0) { dx = 1; dy = 0; } }
|
|
30
|
+
elif (t == "q") { bitti = true; }
|
|
31
|
+
|
|
32
|
+
// --- yeni bas ---
|
|
33
|
+
let bas = yilan[0];
|
|
34
|
+
let nx = bas[0] + dx;
|
|
35
|
+
let ny = bas[1] + dy;
|
|
36
|
+
|
|
37
|
+
// duvar carpmasi
|
|
38
|
+
if (nx <= 0 || nx >= W - 1 || ny <= 0 || ny >= H - 1) {
|
|
39
|
+
bitti = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!bitti) {
|
|
43
|
+
// kendine carpma
|
|
44
|
+
for parca in yilan {
|
|
45
|
+
if (parca[0] == nx && parca[1] == ny) { bitti = true; }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!bitti) {
|
|
50
|
+
// basa yeni segment ekle
|
|
51
|
+
let yeni = [[nx, ny]];
|
|
52
|
+
for parca in yilan { yeni.push(parca); }
|
|
53
|
+
yilan = yeni;
|
|
54
|
+
|
|
55
|
+
// yem yendi mi?
|
|
56
|
+
if (nx == yemx && ny == yemy) {
|
|
57
|
+
skor = skor + 1;
|
|
58
|
+
yemx = randint(1, W - 2);
|
|
59
|
+
yemy = randint(1, H - 2);
|
|
60
|
+
} else {
|
|
61
|
+
// kuyrugu kis (son parcayi at)
|
|
62
|
+
let kisa = [];
|
|
63
|
+
let i = 0;
|
|
64
|
+
while (i < len(yilan) - 1) { kisa.push(yilan[i]); i = i + 1; }
|
|
65
|
+
yilan = kisa;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// --- ciz ---
|
|
69
|
+
clear();
|
|
70
|
+
// ust/alt duvar
|
|
71
|
+
let bx = 0;
|
|
72
|
+
while (bx < W) { draw(bx, 0, "#"); draw(bx, H - 1, "#"); bx = bx + 1; }
|
|
73
|
+
let by = 0;
|
|
74
|
+
while (by < H) { draw(0, by, "#"); draw(W - 1, by, "#"); by = by + 1; }
|
|
75
|
+
// yem
|
|
76
|
+
draw(yemx, yemy, color("@", "red"));
|
|
77
|
+
// yilan
|
|
78
|
+
for parca in yilan { draw(parca[0], parca[1], color("O", "green")); }
|
|
79
|
+
// skor
|
|
80
|
+
draw(0, H, "Skor: " + skor + " (q = cik)");
|
|
81
|
+
|
|
82
|
+
sleep(110);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
game_end();
|
|
87
|
+
print("Oyun bitti! Skorun: " + skor);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// STencil v2.0 - Veri Yapıları ve Döngüler
|
|
2
|
+
|
|
3
|
+
>> "--- STencil v2.0 Liste Testi ---"
|
|
4
|
+
|
|
5
|
+
// Liste tanımlama
|
|
6
|
+
mut sayilar: list = [10, 20, 30, 40, 50]
|
|
7
|
+
>> "Orijinal Liste: " + sayilar
|
|
8
|
+
|
|
9
|
+
// Eleman ekleme
|
|
10
|
+
sayilar.push(60)
|
|
11
|
+
>> "Ekleme sonrası: " + sayilar
|
|
12
|
+
|
|
13
|
+
// Liste uzunluğu
|
|
14
|
+
>> "Liste uzunluğu: " + len(sayilar)
|
|
15
|
+
|
|
16
|
+
// Listeyi döngü ile gezme
|
|
17
|
+
mut toplam = 0
|
|
18
|
+
mut index = 0
|
|
19
|
+
|
|
20
|
+
while index < len(sayilar) {
|
|
21
|
+
toplam = toplam + sayilar[index]
|
|
22
|
+
index = index + 1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
>> "Elemanların toplamı: " + toplam
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
>> "\n--- STencil v2.0 Sözlük (Map) Testi ---"
|
|
29
|
+
|
|
30
|
+
// Sözlük tanımlama
|
|
31
|
+
mut ogrenci = {
|
|
32
|
+
"ad": "Ali",
|
|
33
|
+
"soyad": "Yılmaz",
|
|
34
|
+
"yas": 22,
|
|
35
|
+
"aktif": true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
>> "Öğrenci: " + ogrenci
|
|
39
|
+
>> "Adı: " + ogrenci["ad"]
|
|
40
|
+
>> "Yaşı: " + ogrenci["yas"]
|
|
41
|
+
|
|
42
|
+
// Sözlüğe yeni değer ekleme/güncelleme
|
|
43
|
+
ogrenci["bolum"] = "Bilgisayar Mühendisliği"
|
|
44
|
+
ogrenci["yas"] = 23
|
|
45
|
+
|
|
46
|
+
>> "Güncel Öğrenci: " + ogrenci
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// STencil v2.0 - Fibonacci Örneği
|
|
2
|
+
// Temiz, modern ve benzersiz sözdizimi
|
|
3
|
+
|
|
4
|
+
// Normal fonksiyon tanımı
|
|
5
|
+
fibonacci(n: int) -> int {
|
|
6
|
+
if n <= 1 {
|
|
7
|
+
return n
|
|
8
|
+
}
|
|
9
|
+
return fibonacci(n - 1) + fibonacci(n - 2)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Arrow function ile tek satırlık tanım (çok daha kısa!)
|
|
13
|
+
fib(n: int) => n <= 1 ? n : fib(n-1) + fib(n-2)
|
|
14
|
+
|
|
15
|
+
>> "--- STencil v2.0 Fibonacci Testi ---"
|
|
16
|
+
|
|
17
|
+
>> "Normal Fonksiyon:"
|
|
18
|
+
loop i in 0..10 {
|
|
19
|
+
>> "Fibonacci(" + i + ") = " + fibonacci(i)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
>> "\nArrow Fonksiyon:"
|
|
23
|
+
loop i in 0..10 {
|
|
24
|
+
>> "Fib(" + i + ") = " + fib(i)
|
|
25
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// STencil v2.0 - Model (OOP) Örneği
|
|
2
|
+
|
|
3
|
+
// 'class' yerine 'model' kullanıyoruz
|
|
4
|
+
model Araba {
|
|
5
|
+
// Özellikler
|
|
6
|
+
marka: string
|
|
7
|
+
model_adi: string
|
|
8
|
+
mut hiz: int = 0
|
|
9
|
+
mut calisiyor: bool = false
|
|
10
|
+
|
|
11
|
+
// Kurucu metot
|
|
12
|
+
init(m: string, ad: string) {
|
|
13
|
+
marka = m
|
|
14
|
+
model_adi = ad
|
|
15
|
+
>> marka + " " + model_adi + " üretildi!"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Metotlar
|
|
19
|
+
calistir() {
|
|
20
|
+
calisiyor = true
|
|
21
|
+
>> marka + " motoru çalıştı. Vrum vrum!"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
durdur() {
|
|
25
|
+
calisiyor = false
|
|
26
|
+
hiz = 0
|
|
27
|
+
>> marka + " motoru durdu."
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
hizlan(artis: int) {
|
|
31
|
+
if !calisiyor {
|
|
32
|
+
>> "Önce motoru çalıştırmalısın!"
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
hiz = hiz + artis
|
|
37
|
+
>> "Hızlanılıyor... Yeni hız: " + hiz + " km/s"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fren_yap(azalis: int) {
|
|
41
|
+
hiz = hiz - azalis
|
|
42
|
+
if hiz < 0 {
|
|
43
|
+
hiz = 0
|
|
44
|
+
}
|
|
45
|
+
>> "Fren yapılıyor... Yeni hız: " + hiz + " km/s"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
>> "--- STencil v2.0 Model Testi ---"
|
|
50
|
+
|
|
51
|
+
// Yeni nesne oluşturma ('new' anahtar kelimesi yok)
|
|
52
|
+
benim_arabam = Araba("Toyota", "Corolla")
|
|
53
|
+
|
|
54
|
+
benim_arabam.hizlan(20) // Hata verecek, motor çalışmıyor
|
|
55
|
+
benim_arabam.calistir()
|
|
56
|
+
benim_arabam.hizlan(50)
|
|
57
|
+
benim_arabam.hizlan(30)
|
|
58
|
+
benim_arabam.fren_yap(40)
|
|
59
|
+
benim_arabam.durdur()
|
stencil_lang/stencil.exe
ADDED
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stencil-lang
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: STencil — a general-purpose programming language with first-class data templates (stencils). By Kitteniverse Studios.
|
|
5
|
+
Author: Kitteniverse Studios
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: stencil,programming-language,interpreter,compiler
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# STencil
|
|
12
|
+
|
|
13
|
+
A general-purpose programming language with a signature feature: first-class **data templates** (`stencil`). By Kitteniverse Studios.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
```
|
|
17
|
+
pip install stencil-lang
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
```
|
|
22
|
+
stencil program.st # run a file
|
|
23
|
+
stencil # REPL
|
|
24
|
+
stencil -c "print(1 + 2)" # one-liner
|
|
25
|
+
stencil build app.st -o app.exe # native compile (subset)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## A taste
|
|
29
|
+
```stencil
|
|
30
|
+
stencil User(name, age) {
|
|
31
|
+
name: name,
|
|
32
|
+
adult: age >= 18,
|
|
33
|
+
tag: name + "#" + age
|
|
34
|
+
}
|
|
35
|
+
let u = User!("Emir", 20);
|
|
36
|
+
print(u.tag, u.adult); // Emir#20 true
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Has: functions, OOP (class/model), lists/dicts, modules, file I/O, JSON, regex,
|
|
40
|
+
HTTP, date/time, terminal + pixel graphics, and the unique `stencil` templates.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
stencil_lang/__init__.py,sha256=AAbBM4M53sAnMeM3PqCQltHQOWnu_tNE8PYJZXKhfGg,841
|
|
2
|
+
stencil_lang/stencil.exe,sha256=GPBORdN59uAoFf7imp-C7OV46CQVntxROku4HWgMUuQ,5033472
|
|
3
|
+
stencil_lang/examples/collections.st,sha256=UJwnw6uUxeH8FqB3cJXkDtWvxrwHXQh6BLlvRkN1Xoo,741
|
|
4
|
+
stencil_lang/examples/demo.st,sha256=0T0KFb4eCq94Eohwk7Uld463S_jm4GQWA-1UlB6T1po,1879
|
|
5
|
+
stencil_lang/examples/fibonacci.st,sha256=QE8Kam4PPSSbDJohmtFQDCRplvU2WnHdUQeMZ-3irM4,288
|
|
6
|
+
stencil_lang/examples/oop.st,sha256=rXXLXvQ_H6crBLhh2i3oNMYla3hS53lrvu9QL8ZsPOw,1000
|
|
7
|
+
stencil_lang/examples/pixel_oyun.st,sha256=eLbd6_DShAKIiETDhDP6BuTWH-VKcpOQ6mw9soaoIic,1392
|
|
8
|
+
stencil_lang/examples/showcase.st,sha256=1xaJ39lFd0aI26CCZdebQkPAjFWEy8YrQP7gTNs3snY,1059
|
|
9
|
+
stencil_lang/examples/snake.st,sha256=BzcuZFt-F7GcB1aOmL9T52S6HKgGb3w9f-emLBH1AO0,2327
|
|
10
|
+
stencil_lang/examples/v2_data.st,sha256=UaIGWH26HUnaAtC2xn-ej47EIpdMhFYIyuc5aeJew3c,899
|
|
11
|
+
stencil_lang/examples/v2_fibonacci.st,sha256=jds3mm6zhJHwPL8ca2KmOi5BgnO2z_HKqm-mmkqbyh0,551
|
|
12
|
+
stencil_lang/examples/v2_model.st,sha256=jg_1ZocunXyTFDrmM2oKnRg78JR0RVLdYkNiK0HiPfY,1331
|
|
13
|
+
stencil_lang-1.0.0.dist-info/METADATA,sha256=b0xhYC5mjEucbFxUhLgMf0Ov0I1KP7-Xr1Xxm9sGfNU,1118
|
|
14
|
+
stencil_lang-1.0.0.dist-info/WHEEL,sha256=QR8DNjG6Lr6bNErJWJgF4dP2dJ2N7NpY-BWly1OvcTM,97
|
|
15
|
+
stencil_lang-1.0.0.dist-info/entry_points.txt,sha256=38gYTsoma890k2-PGlwdBlB7P1fkSQQABXzcU-4Cb8M,46
|
|
16
|
+
stencil_lang-1.0.0.dist-info/top_level.txt,sha256=PHQAGG4RDYZRgN7BnrszPqEhP8qNB4jtoimuFPZEimk,13
|
|
17
|
+
stencil_lang-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stencil_lang
|