depolin
v1.0.0
Published
Depolin (dplin) - A modern data language to replace JSON
Maintainers
Readme
Depolin (dplin)
Modern data language — the replacement for JSON.
Depolin (disingkat dplin) adalah bahasa data modern yang dirancang untuk menggantikan JSON dengan sintaks yang lebih bersih, mudah dibaca, dan mendukung variabel serta kondisional.
📦 Instalasi
npm install depolin
# atau install secara global untuk CLI:
npm install -g depolin🚀 CLI Usage
dplin example.dplin # Jalankan file .dplin
dplin to-json config.dplin # Konversi .dplin ke JSON
dplin from-json data.json # Konversi JSON ke .dplin
dplin --help # Bantuan📖 Sintaks Bahasa Depolin
1. Data Block — [ (Data) ]
Menulis data seperti JSON object:
user is [
(Data)
name: "John"
age: 30
active: true
]Setara JSON:
{ "name": "John", "age": 30, "active": true }2. Variabel — is
Deklarasi variabel dengan keyword is:
nama is "Depolin"
versi is 1
aktif is true
kosong is null3. Kondisional — if ye dan if no else
if ye → berjalan jika kondisi benar (true):
flag is true
if ye flag {
status is "aktif"
} else {
status is "nonaktif"
}if no else → berjalan jika kondisi salah (false):
maintenanceMode is false
if no else maintenanceMode {
result is "Server berjalan"
} else {
result is "Sedang maintenance"
}4. else
Blok alternatif setelah if ye atau if no else:
if ye someCondition {
x is "ya"
} else {
x is "tidak"
}5. what — Query/Cetak Variabel
Menampilkan nilai variabel:
nama is "Budi"
what nama # Output: "Budi"6. Array
tags is ["javascript", "data", "modern"]7. Nested Data
config is [
(Data)
database: [
(Data)
host: "localhost"
port: 5432
]
debug: false
]8. Komentar
# Ini adalah komentar baris🛠 API (Node.js)
const depolin = require('depolin');
// Jalankan kode dplin
const vars = depolin.execute(`
user is [
(Data)
name: "Ana"
age: 25
]
`);
console.log(vars.user); // { name: 'Ana', age: 25 }
// Konversi .dplin ke JSON string
const json = depolin.toJSON(`nama is "Depolin"`);
// Konversi JSON ke .dplin
const dplin = depolin.fromJSON('{"key":"value"}', 'myData');
// Parse ke AST
const ast = depolin.parse(`x is 42`);🔑 Keyword Lengkap
| Keyword | Fungsi |
|---------------|---------------------------------------------|
| is | Deklarasi variabel |
| what | Query / cetak nilai variabel |
| if ye | Kondisional jika true |
| if no else | Kondisional jika false (dengan else) |
| else | Blok alternatif kondisional |
| [ (Data) ] | Blok data (seperti JSON object) |
| true/false | Boolean |
| null / nil | Nilai kosong |
| # | Komentar |
📊 Perbandingan dengan JSON
| Fitur | JSON | Depolin (dplin) |
|--------------------|-------------|----------------------|
| Variabel | ❌ | ✅ is |
| Kondisional | ❌ | ✅ if ye / if no else |
| Komentar | ❌ | ✅ # |
| Sintaks lebih clean| ❌ | ✅ |
| Konversi ke JSON | — | ✅ to-json |
| Konversi dari JSON | — | ✅ from-json |
📄 Lisensi
MIT
