bindo 2.0.0__tar.gz

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.
bindo-2.0.0/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BINDO Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
bindo-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: bindo
3
+ Version: 2.0.0
4
+ Summary: Bahasa pemrograman sintaks Indonesia berbasis Python
5
+ Author: BINDO Contributors
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 BINDO Contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
21
+
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ # BINDO v2.0 — Bahasa Pemrograman Indonesia
30
+
31
+ BINDO adalah bahasa dengan gaya sintaks Indonesia yang diterjemahkan berdasarkan token ke Python lalu dijalankan oleh runtime Python. Paket ini menyediakan CLI `bindo`, ekstensi `.bindo`, pemeriksaan sintaks, penerjemahan ke Python, REPL sederhana, contoh OOP, dan penggunaan library Python.
32
+
33
+ **Status:** eksperimental. Ini bukan implementasi ulang atau compiler native Python. Kompatibilitas mengikuti versi Python yang terpasang. Nama-nama di kamus terjemahan menjadi identifier khusus BINDO.
34
+
35
+ ## Kebutuhan
36
+ - Python 3.10 atau lebih baru
37
+ - Kali Linux, Debian, Ubuntu, Arch Linux, Windows, atau macOS
38
+ - Tidak ada dependensi runtime pihak ketiga
39
+
40
+ ## Instalasi lokal di Kali Linux
41
+ ```bash
42
+ sudo apt update
43
+ sudo apt install python3 python3-venv python3-pip
44
+ ```
45
+ Ekstrak ZIP, masuk ke folder proyek, lalu:
46
+ ```bash
47
+ cd BINDO-v2.0
48
+ python3 -m venv .venv
49
+ source .venv/bin/activate
50
+ python -m pip install -e .
51
+ ```
52
+ Instalasi ini berada di virtual environment, tidak mengubah Python sistem.
53
+
54
+ ## Mulai ngoding
55
+ Buat file:
56
+ ```bash
57
+ nano program.bindo
58
+ ```
59
+ Tulis kode:
60
+ ```python
61
+ impor math
62
+
63
+ kelas Lingkaran:
64
+ fungsi __init__(diri, jari_jari):
65
+ diri.jari_jari = jari_jari
66
+
67
+ fungsi luas(diri):
68
+ kembalikan math.pi * diri.jari_jari ** 2
69
+
70
+ bentuk = Lingkaran(7)
71
+ cetak("Luas:", bentuk.luas())
72
+ ```
73
+ Jalankan:
74
+ ```bash
75
+ bindo jalankan program.bindo
76
+ ```
77
+
78
+ ## Perintah CLI
79
+ ```bash
80
+ bindo --versi
81
+ bindo jalankan program.bindo
82
+ bindo run program.bindo
83
+ bindo periksa program.bindo
84
+ bindo terjemahkan program.bindo
85
+ bindo terjemahkan program.bindo -o hasil.py
86
+ bindo interaktif
87
+ ```
88
+
89
+ ## Kamus sintaks inti
90
+ | BINDO | Python |
91
+ |---|---|
92
+ | `jika` / `jika_lain` / `selain` | `if` / `elif` / `else` |
93
+ | `untuk` / `selama` / `dalam` | `for` / `while` / `in` |
94
+ | `dan` / `atau` / `bukan` / `adalah` | `and` / `or` / `not` / `is` |
95
+ | `fungsi` / `kembalikan` / `kelas` | `def` / `return` / `class` |
96
+ | `coba` / `kecuali` / `akhirnya` | `try` / `except` / `finally` |
97
+ | `dengan` / `sebagai` / `naikkan` | `with` / `as` / `raise` |
98
+ | `impor` / `dari` | `import` / `from` |
99
+ | `cocokkan` / `kasus` | `match` / `case` |
100
+ | `Benar` / `Salah` / `Kosong` | `True` / `False` / `None` |
101
+ | `cetak` / `masukan` | `print` / `input` |
102
+ | `rentang` / `panjang` / `jenis` | `range` / `len` / `type` |
103
+ | `teks` / `bilangan` / `desimal` / `logika` | `str` / `int` / `float` / `bool` |
104
+ | `daftar` / `kamus` / `himpunan` / `pasangan` | `list` / `dict` / `set` / `tuple` |
105
+ | `buka` / `enumerasi` / `gabungkan` | `open` / `enumerate` / `zip` |
106
+ | `jumlah` / `minimum` / `maksimum` / `urutkan` | `sum` / `min` / `max` / `sorted` |
107
+
108
+ ## Library Python
109
+ ```python
110
+ impor json
111
+ impor math
112
+ dari pathlib impor Path
113
+ data = {"nama": "BINDO", "aktif": Benar}
114
+ cetak(json.dumps(data))
115
+ cetak(math.sqrt(81))
116
+ cetak(Path(".").resolve())
117
+ ```
118
+ Paket pihak ketiga dipasang di virtual environment yang sama, misalnya `python -m pip install requests`.
119
+
120
+ ## Tes
121
+ ```bash
122
+ python -m unittest discover -s tests -v
123
+ ```
124
+
125
+ ## Build paket
126
+ ```bash
127
+ python -m pip install build
128
+ python -m build
129
+ ```
130
+ Nama distribusi paket adalah `bindo-lang`; nama perintah CLI adalah `bindo`. Publikasi ke PyPI memerlukan akun, pemeriksaan ketersediaan nama, dan pengujian rilis.
131
+
132
+ ## Batasan dan keamanan
133
+ - Sintaks Python yang belum diterjemahkan dapat ditulis memakai keyword Python asli; parser Python tetap menjadi penentu grammar.
134
+ - Nama yang tercantum di kamus menjadi kata khusus BINDO, sehingga tidak cocok dipakai sebagai nama variabel.
135
+ - String, komentar, dan nama atribut setelah titik tidak diterjemahkan.
136
+ - REPL saat ini mendukung satu baris per prompt; gunakan file `.bindo` untuk blok multi-baris.
137
+ - Error runtime dapat menampilkan istilah Python.
138
+ - Program BINDO mempunyai hak akses yang sama dengan proses Python. Jangan jalankan kode dari sumber yang tidak dipercaya.
139
+
140
+ Lisensi MIT — lihat `LICENSE`.
bindo-2.0.0/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # BINDO v2.0 — Bahasa Pemrograman Indonesia
2
+
3
+ BINDO adalah bahasa dengan gaya sintaks Indonesia yang diterjemahkan berdasarkan token ke Python lalu dijalankan oleh runtime Python. Paket ini menyediakan CLI `bindo`, ekstensi `.bindo`, pemeriksaan sintaks, penerjemahan ke Python, REPL sederhana, contoh OOP, dan penggunaan library Python.
4
+
5
+ **Status:** eksperimental. Ini bukan implementasi ulang atau compiler native Python. Kompatibilitas mengikuti versi Python yang terpasang. Nama-nama di kamus terjemahan menjadi identifier khusus BINDO.
6
+
7
+ ## Kebutuhan
8
+ - Python 3.10 atau lebih baru
9
+ - Kali Linux, Debian, Ubuntu, Arch Linux, Windows, atau macOS
10
+ - Tidak ada dependensi runtime pihak ketiga
11
+
12
+ ## Instalasi lokal di Kali Linux
13
+ ```bash
14
+ sudo apt update
15
+ sudo apt install python3 python3-venv python3-pip
16
+ ```
17
+ Ekstrak ZIP, masuk ke folder proyek, lalu:
18
+ ```bash
19
+ cd BINDO-v2.0
20
+ python3 -m venv .venv
21
+ source .venv/bin/activate
22
+ python -m pip install -e .
23
+ ```
24
+ Instalasi ini berada di virtual environment, tidak mengubah Python sistem.
25
+
26
+ ## Mulai ngoding
27
+ Buat file:
28
+ ```bash
29
+ nano program.bindo
30
+ ```
31
+ Tulis kode:
32
+ ```python
33
+ impor math
34
+
35
+ kelas Lingkaran:
36
+ fungsi __init__(diri, jari_jari):
37
+ diri.jari_jari = jari_jari
38
+
39
+ fungsi luas(diri):
40
+ kembalikan math.pi * diri.jari_jari ** 2
41
+
42
+ bentuk = Lingkaran(7)
43
+ cetak("Luas:", bentuk.luas())
44
+ ```
45
+ Jalankan:
46
+ ```bash
47
+ bindo jalankan program.bindo
48
+ ```
49
+
50
+ ## Perintah CLI
51
+ ```bash
52
+ bindo --versi
53
+ bindo jalankan program.bindo
54
+ bindo run program.bindo
55
+ bindo periksa program.bindo
56
+ bindo terjemahkan program.bindo
57
+ bindo terjemahkan program.bindo -o hasil.py
58
+ bindo interaktif
59
+ ```
60
+
61
+ ## Kamus sintaks inti
62
+ | BINDO | Python |
63
+ |---|---|
64
+ | `jika` / `jika_lain` / `selain` | `if` / `elif` / `else` |
65
+ | `untuk` / `selama` / `dalam` | `for` / `while` / `in` |
66
+ | `dan` / `atau` / `bukan` / `adalah` | `and` / `or` / `not` / `is` |
67
+ | `fungsi` / `kembalikan` / `kelas` | `def` / `return` / `class` |
68
+ | `coba` / `kecuali` / `akhirnya` | `try` / `except` / `finally` |
69
+ | `dengan` / `sebagai` / `naikkan` | `with` / `as` / `raise` |
70
+ | `impor` / `dari` | `import` / `from` |
71
+ | `cocokkan` / `kasus` | `match` / `case` |
72
+ | `Benar` / `Salah` / `Kosong` | `True` / `False` / `None` |
73
+ | `cetak` / `masukan` | `print` / `input` |
74
+ | `rentang` / `panjang` / `jenis` | `range` / `len` / `type` |
75
+ | `teks` / `bilangan` / `desimal` / `logika` | `str` / `int` / `float` / `bool` |
76
+ | `daftar` / `kamus` / `himpunan` / `pasangan` | `list` / `dict` / `set` / `tuple` |
77
+ | `buka` / `enumerasi` / `gabungkan` | `open` / `enumerate` / `zip` |
78
+ | `jumlah` / `minimum` / `maksimum` / `urutkan` | `sum` / `min` / `max` / `sorted` |
79
+
80
+ ## Library Python
81
+ ```python
82
+ impor json
83
+ impor math
84
+ dari pathlib impor Path
85
+ data = {"nama": "BINDO", "aktif": Benar}
86
+ cetak(json.dumps(data))
87
+ cetak(math.sqrt(81))
88
+ cetak(Path(".").resolve())
89
+ ```
90
+ Paket pihak ketiga dipasang di virtual environment yang sama, misalnya `python -m pip install requests`.
91
+
92
+ ## Tes
93
+ ```bash
94
+ python -m unittest discover -s tests -v
95
+ ```
96
+
97
+ ## Build paket
98
+ ```bash
99
+ python -m pip install build
100
+ python -m build
101
+ ```
102
+ Nama distribusi paket adalah `bindo-lang`; nama perintah CLI adalah `bindo`. Publikasi ke PyPI memerlukan akun, pemeriksaan ketersediaan nama, dan pengujian rilis.
103
+
104
+ ## Batasan dan keamanan
105
+ - Sintaks Python yang belum diterjemahkan dapat ditulis memakai keyword Python asli; parser Python tetap menjadi penentu grammar.
106
+ - Nama yang tercantum di kamus menjadi kata khusus BINDO, sehingga tidak cocok dipakai sebagai nama variabel.
107
+ - String, komentar, dan nama atribut setelah titik tidak diterjemahkan.
108
+ - REPL saat ini mendukung satu baris per prompt; gunakan file `.bindo` untuk blok multi-baris.
109
+ - Error runtime dapat menampilkan istilah Python.
110
+ - Program BINDO mempunyai hak akses yang sama dengan proses Python. Jangan jalankan kode dari sumber yang tidak dipercaya.
111
+
112
+ Lisensi MIT — lihat `LICENSE`.
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "bindo"
7
+ version = "2.0.0"
8
+ description = "Bahasa pemrograman sintaks Indonesia berbasis Python"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {file = "LICENSE"}
12
+ authors = [{name = "BINDO Contributors"}]
13
+ classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent"]
14
+ dependencies = []
15
+
16
+ [project.scripts]
17
+ bindo = "bindo.cli:main"
18
+
19
+ [tool.setuptools]
20
+ package-dir = {"" = "src"}
21
+
22
+ [tool.setuptools.packages.find]
23
+ where = ["src"]
bindo-2.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ __version__ = "2.0.0"
2
+ from .translator import terjemahkan, KAMUS
@@ -0,0 +1,2 @@
1
+ from .cli import main
2
+ raise SystemExit(main())
@@ -0,0 +1,46 @@
1
+ import argparse
2
+ import sys
3
+ import traceback
4
+ from pathlib import Path
5
+ from . import __version__
6
+ from .runtime import kompilasi, jalankan_file
7
+ from .translator import terjemahkan
8
+
9
+ def main(argv=None):
10
+ p = argparse.ArgumentParser(prog="bindo", description="BINDO — Bahasa Pemrograman Indonesia")
11
+ p.add_argument("--versi", "--version", action="version", version=f"BINDO {__version__}")
12
+ sub = p.add_subparsers(dest="aksi")
13
+ r = sub.add_parser("jalankan", aliases=["run"], help="Jalankan file .bindo")
14
+ r.add_argument("file"); r.add_argument("argumen", nargs=argparse.REMAINDER)
15
+ c = sub.add_parser("periksa", help="Periksa sintaks"); c.add_argument("file")
16
+ t = sub.add_parser("terjemahkan", aliases=["translate"], help="Terjemahkan ke Python")
17
+ t.add_argument("file"); t.add_argument("-o", "--keluaran")
18
+ sub.add_parser("interaktif", aliases=["repl"], help="Mode interaktif")
19
+ a = p.parse_args(argv)
20
+ if a.aksi is None: p.print_help(); return 0
21
+ if a.aksi in ("interaktif", "repl"):
22
+ print(f"BINDO {__version__} — ketik keluar() untuk berhenti")
23
+ ruang = {"__name__": "__console__", "__builtins__": __builtins__}
24
+ while True:
25
+ try:
26
+ baris = input("bindo>>> ")
27
+ if baris.strip() in ("keluar()", "exit()", "quit()"): break
28
+ if baris.strip(): exec(kompilasi(baris, "<BINDO-REPL>"), ruang, ruang)
29
+ except (EOFError, KeyboardInterrupt): print(); break
30
+ except Exception: traceback.print_exc()
31
+ return 0
32
+ path = Path(a.file).expanduser()
33
+ if not path.is_file(): print(f"[BINDO] File tidak ditemukan: {path}", file=sys.stderr); return 2
34
+ try:
35
+ source = path.read_text(encoding="utf-8")
36
+ if a.aksi == "periksa":
37
+ kompilasi(source, str(path)); print(f"[BINDO] Sintaks valid: {path}")
38
+ elif a.aksi in ("terjemahkan", "translate"):
39
+ out = terjemahkan(source)
40
+ if a.keluaran: Path(a.keluaran).write_text(out, encoding="utf-8"); print(f"[BINDO] Disimpan: {a.keluaran}")
41
+ else: print(out, end="")
42
+ elif a.aksi in ("jalankan", "run"):
43
+ jalankan_file(str(path), a.argumen)
44
+ return 0
45
+ except SystemExit: raise
46
+ except Exception: traceback.print_exc(); return 1
@@ -0,0 +1,23 @@
1
+ import sys
2
+ from pathlib import Path
3
+ from .translator import terjemahkan
4
+
5
+ def kompilasi(teks, nama_file="<BINDO>", mode="exec"):
6
+ return compile(terjemahkan(teks), nama_file, mode)
7
+
8
+ def jalankan(teks, nama_file="<BINDO>", argv=None):
9
+ kode = kompilasi(teks, nama_file)
10
+ ruang = {"__name__": "__main__", "__file__": nama_file, "__package__": None, "__builtins__": __builtins__}
11
+ lama = sys.argv[:]
12
+ try:
13
+ sys.argv = [nama_file] + list(argv or [])
14
+ exec(kode, ruang, ruang)
15
+ finally:
16
+ sys.argv = lama
17
+ return ruang
18
+
19
+ def jalankan_file(lokasi, argv=None):
20
+ path = Path(lokasi).expanduser().resolve()
21
+ if not path.is_file():
22
+ raise FileNotFoundError(f"File BINDO tidak ditemukan: {path}")
23
+ return jalankan(path.read_text(encoding="utf-8"), str(path), argv)
@@ -0,0 +1,40 @@
1
+ """Penerjemah token BINDO ke Python."""
2
+ import io
3
+ import tokenize
4
+
5
+ KAMUS = {
6
+ "jika":"if", "jika_lain":"elif", "selain":"else", "untuk":"for",
7
+ "selama":"while", "dalam":"in", "dan":"and", "atau":"or", "bukan":"not",
8
+ "adalah":"is", "fungsi":"def", "kembalikan":"return", "kelas":"class",
9
+ "coba":"try", "kecuali":"except", "akhirnya":"finally", "dengan":"with",
10
+ "sebagai":"as", "naikkan":"raise", "lulus":"pass", "hentikan":"break",
11
+ "lanjutkan":"continue", "hapus":"del", "global":"global", "nonlokal":"nonlocal",
12
+ "asinkron":"async", "tunggu":"await", "hasilkan":"yield", "dari":"from",
13
+ "impor":"import", "cocokkan":"match", "kasus":"case",
14
+ "Benar":"True", "Salah":"False", "Kosong":"None",
15
+ "cetak":"print", "masukan":"input", "rentang":"range", "panjang":"len",
16
+ "jenis":"type", "teks":"str", "bilangan":"int", "desimal":"float",
17
+ "logika":"bool", "daftar":"list", "kamus":"dict", "himpunan":"set",
18
+ "pasangan":"tuple", "buka":"open", "enumerasi":"enumerate", "gabungkan":"zip",
19
+ "jumlah":"sum", "minimum":"min", "maksimum":"max", "urutkan":"sorted",
20
+ "terbalik":"reversed", "mutlak":"abs", "semua":"all", "ada":"any",
21
+ "peta":"map", "saring":"filter", "bulatkan":"round", "bantuan":"help",
22
+ "objek":"object", "superkelas":"super", "properti":"property",
23
+ "statis":"staticmethod", "metode_kelas":"classmethod",
24
+ }
25
+
26
+ def terjemahkan(kode: str) -> str:
27
+ hasil = []
28
+ sebelumnya = None
29
+ try:
30
+ for tok in tokenize.generate_tokens(io.StringIO(kode).readline):
31
+ setelah_titik = sebelumnya is not None and sebelumnya.type == tokenize.OP and sebelumnya.string == "."
32
+ if tok.type == tokenize.NAME and tok.string in KAMUS and not setelah_titik:
33
+ tok = tok._replace(string=KAMUS[tok.string])
34
+ hasil.append(tok)
35
+ if tok.type not in (tokenize.NL, tokenize.NEWLINE, tokenize.INDENT,
36
+ tokenize.DEDENT, tokenize.COMMENT, tokenize.ENCODING):
37
+ sebelumnya = tok
38
+ return tokenize.untokenize(hasil)
39
+ except (tokenize.TokenError, IndentationError) as exc:
40
+ raise SyntaxError(f"Sintaks BINDO tidak dapat diterjemahkan: {exc}") from exc
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: bindo
3
+ Version: 2.0.0
4
+ Summary: Bahasa pemrograman sintaks Indonesia berbasis Python
5
+ Author: BINDO Contributors
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 BINDO Contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
21
+
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ # BINDO v2.0 — Bahasa Pemrograman Indonesia
30
+
31
+ BINDO adalah bahasa dengan gaya sintaks Indonesia yang diterjemahkan berdasarkan token ke Python lalu dijalankan oleh runtime Python. Paket ini menyediakan CLI `bindo`, ekstensi `.bindo`, pemeriksaan sintaks, penerjemahan ke Python, REPL sederhana, contoh OOP, dan penggunaan library Python.
32
+
33
+ **Status:** eksperimental. Ini bukan implementasi ulang atau compiler native Python. Kompatibilitas mengikuti versi Python yang terpasang. Nama-nama di kamus terjemahan menjadi identifier khusus BINDO.
34
+
35
+ ## Kebutuhan
36
+ - Python 3.10 atau lebih baru
37
+ - Kali Linux, Debian, Ubuntu, Arch Linux, Windows, atau macOS
38
+ - Tidak ada dependensi runtime pihak ketiga
39
+
40
+ ## Instalasi lokal di Kali Linux
41
+ ```bash
42
+ sudo apt update
43
+ sudo apt install python3 python3-venv python3-pip
44
+ ```
45
+ Ekstrak ZIP, masuk ke folder proyek, lalu:
46
+ ```bash
47
+ cd BINDO-v2.0
48
+ python3 -m venv .venv
49
+ source .venv/bin/activate
50
+ python -m pip install -e .
51
+ ```
52
+ Instalasi ini berada di virtual environment, tidak mengubah Python sistem.
53
+
54
+ ## Mulai ngoding
55
+ Buat file:
56
+ ```bash
57
+ nano program.bindo
58
+ ```
59
+ Tulis kode:
60
+ ```python
61
+ impor math
62
+
63
+ kelas Lingkaran:
64
+ fungsi __init__(diri, jari_jari):
65
+ diri.jari_jari = jari_jari
66
+
67
+ fungsi luas(diri):
68
+ kembalikan math.pi * diri.jari_jari ** 2
69
+
70
+ bentuk = Lingkaran(7)
71
+ cetak("Luas:", bentuk.luas())
72
+ ```
73
+ Jalankan:
74
+ ```bash
75
+ bindo jalankan program.bindo
76
+ ```
77
+
78
+ ## Perintah CLI
79
+ ```bash
80
+ bindo --versi
81
+ bindo jalankan program.bindo
82
+ bindo run program.bindo
83
+ bindo periksa program.bindo
84
+ bindo terjemahkan program.bindo
85
+ bindo terjemahkan program.bindo -o hasil.py
86
+ bindo interaktif
87
+ ```
88
+
89
+ ## Kamus sintaks inti
90
+ | BINDO | Python |
91
+ |---|---|
92
+ | `jika` / `jika_lain` / `selain` | `if` / `elif` / `else` |
93
+ | `untuk` / `selama` / `dalam` | `for` / `while` / `in` |
94
+ | `dan` / `atau` / `bukan` / `adalah` | `and` / `or` / `not` / `is` |
95
+ | `fungsi` / `kembalikan` / `kelas` | `def` / `return` / `class` |
96
+ | `coba` / `kecuali` / `akhirnya` | `try` / `except` / `finally` |
97
+ | `dengan` / `sebagai` / `naikkan` | `with` / `as` / `raise` |
98
+ | `impor` / `dari` | `import` / `from` |
99
+ | `cocokkan` / `kasus` | `match` / `case` |
100
+ | `Benar` / `Salah` / `Kosong` | `True` / `False` / `None` |
101
+ | `cetak` / `masukan` | `print` / `input` |
102
+ | `rentang` / `panjang` / `jenis` | `range` / `len` / `type` |
103
+ | `teks` / `bilangan` / `desimal` / `logika` | `str` / `int` / `float` / `bool` |
104
+ | `daftar` / `kamus` / `himpunan` / `pasangan` | `list` / `dict` / `set` / `tuple` |
105
+ | `buka` / `enumerasi` / `gabungkan` | `open` / `enumerate` / `zip` |
106
+ | `jumlah` / `minimum` / `maksimum` / `urutkan` | `sum` / `min` / `max` / `sorted` |
107
+
108
+ ## Library Python
109
+ ```python
110
+ impor json
111
+ impor math
112
+ dari pathlib impor Path
113
+ data = {"nama": "BINDO", "aktif": Benar}
114
+ cetak(json.dumps(data))
115
+ cetak(math.sqrt(81))
116
+ cetak(Path(".").resolve())
117
+ ```
118
+ Paket pihak ketiga dipasang di virtual environment yang sama, misalnya `python -m pip install requests`.
119
+
120
+ ## Tes
121
+ ```bash
122
+ python -m unittest discover -s tests -v
123
+ ```
124
+
125
+ ## Build paket
126
+ ```bash
127
+ python -m pip install build
128
+ python -m build
129
+ ```
130
+ Nama distribusi paket adalah `bindo-lang`; nama perintah CLI adalah `bindo`. Publikasi ke PyPI memerlukan akun, pemeriksaan ketersediaan nama, dan pengujian rilis.
131
+
132
+ ## Batasan dan keamanan
133
+ - Sintaks Python yang belum diterjemahkan dapat ditulis memakai keyword Python asli; parser Python tetap menjadi penentu grammar.
134
+ - Nama yang tercantum di kamus menjadi kata khusus BINDO, sehingga tidak cocok dipakai sebagai nama variabel.
135
+ - String, komentar, dan nama atribut setelah titik tidak diterjemahkan.
136
+ - REPL saat ini mendukung satu baris per prompt; gunakan file `.bindo` untuk blok multi-baris.
137
+ - Error runtime dapat menampilkan istilah Python.
138
+ - Program BINDO mempunyai hak akses yang sama dengan proses Python. Jangan jalankan kode dari sumber yang tidak dipercaya.
139
+
140
+ Lisensi MIT — lihat `LICENSE`.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/bindo/__init__.py
5
+ src/bindo/__main__.py
6
+ src/bindo/cli.py
7
+ src/bindo/runtime.py
8
+ src/bindo/translator.py
9
+ src/bindo.egg-info/PKG-INFO
10
+ src/bindo.egg-info/SOURCES.txt
11
+ src/bindo.egg-info/dependency_links.txt
12
+ src/bindo.egg-info/entry_points.txt
13
+ src/bindo.egg-info/top_level.txt
14
+ tests/test_translator.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ bindo = bindo.cli:main
@@ -0,0 +1 @@
1
+ bindo
@@ -0,0 +1,19 @@
1
+ import unittest
2
+ from bindo.translator import terjemahkan
3
+
4
+ class TestBindo(unittest.TestCase):
5
+ def test_keywords(self):
6
+ py = terjemahkan("jika Benar:\n cetak('ok')\nselain:\n cetak('no')\n")
7
+ self.assertIn("if True:", py); self.assertIn("else:", py); compile(py, "<test>", "exec")
8
+ def test_string_comment(self):
9
+ py = terjemahkan('# cetak jika Benar\ncetak("jika cetak Benar")\n')
10
+ self.assertIn('# cetak jika Benar', py); self.assertIn('"jika cetak Benar"', py)
11
+ def test_attribute(self):
12
+ self.assertIn("obj.cetak", terjemahkan("obj.cetak = 1\n"))
13
+ def test_oop(self):
14
+ py = terjemahkan("kelas A:\n fungsi __init__(diri):\n diri.x = 1\n")
15
+ compile(py, "<test>", "exec")
16
+ def test_match(self):
17
+ compile(terjemahkan("cocokkan x:\n kasus 1:\n cetak('satu')\n"), "<test>", "exec")
18
+
19
+ if __name__ == "__main__": unittest.main()