sawitscript
v1.0.0
Published
Syntax highlighting and language support for the SAWIT programming language
Readme
🌴 SawitScript (SS) - Palm Oil Themed Programming Language
A unique programming language inspired by palm oil plantation operations
Write code like you're managing a plantation! 🌳
📖 Table of Contents
🌟 About
SawitScript (SS) is an interpreted programming language built with Python, designed for backend tasks, Telegram bots, and API interactions. It features a unique palm oil plantation theme while remaining a serious, production-capable language.
The language follows a logical cycle: tanam → rawat → cek_lahan → panen (Plant → Maintain → Check Field → Harvest)
✨ Features
- 🌴 Unique Themed Syntax - Programming concepts expressed through plantation metaphors
- ⚡ Easy to Learn - Intuitive keywords in Indonesian
- 🤖 Telegram Bot Ready - Built-in functions for bot development
- 🌐 HTTP Integration - Native support for API requests
- 🔧 Flexible - Dynamic typing and easy debugging
- 🎯 Purpose-Built - Optimized for backend and automation tasks
🛠️ Installation
- Clone the repository:
git clone https://github.com/BahasaSawit/BahasaSawit.git
cd BahasaSawit- Ensure you have Python 3.7+ installed:
python --version- Run a SawitScript file:
sawit run examples/hello.ss📝 Syntax Overview
| SawitScript Keyword | English Equivalent | Purpose |
|-------------------|------------------|---------|
| panen | print | Output data |
| tanam | declare variable | Variable assignment |
| cek_lahan | if | Conditional check |
| lahan_lain | else | Alternative condition |
| rawat | for loop | Fixed iteration loop |
| rawat_selama | while loop | Conditional loop |
| tutup_lahan | end block | Block terminator |
| olah | function | Define function |
| hasilkan | return | Return value |
| siram | input | Get user input |
| subur | true | Boolean true |
| kering | false | Boolean false |
| dan | and | Logical AND |
| atau | or | Logical OR |
| bukan | not | Logical NOT |
| kebun | array | Array constructor |
| uji_lahan | try | Try block |
| gagal_lahan | except | Catch block |
💡 Examples
Hello World
# Simple greeting
tanam name = "World"
panen "Hello, " + name + "!"Conditional Logic
tanam age = 18
cek_lahan age >= 17
panen "Eligible to work"
lahan_lain
panen "Still learning"
tutup_lahanLoops
# For loop - Fixed iterations
rawat 3
panen "Maintaining palm tree"
tutup_lahan
# While loop - Conditional
tanam counter = 0
rawat_selama counter < 3
counter = counter + 1
panen "Counter: " + counter
tutup_lahanFunctions
olah greet(nama)
hasilkan "Greetings, " + nama + "!"
tutup_lahan
panen greet("Farmer")Telegram Bot Example
# Handle commands
cek_lahan command == "/start"
tg_kirim(user_id, "Welcome to SawitBot!")
tg_kirim(user_id, "Commands: /info, /price, /weather")
lahan_lain
tg_kirim(user_id, "Unknown command. Use /start for help.")
tutup_lahanHTTP Requests
# GET request
tanam response = http_dapat("https://api.example.com/data")
# POST request
tanam data = "param1=value1¶m2=value2"
tanam response = http_kirim("https://api.example.com/create", data)📚 Standard Library
Core Functions
panen- Output functionssiram- Input functionspanjang- Length of collectionsteks,angka,pecahan,bool- Type conversions
Telegram Bot Functions
tg_kirim(chat_id, text)- Send message to chattg_balas(message_id, text)- Reply to messagetg_pengguna_id()- Get user IDtg_nama_pengguna()- Get usernametg_simpan(key, value)- Store user datatg_ambil(key)- Retrieve stored data
HTTP Functions
http_dapat(url)- GET requesthttp_kirim(url, data)- POST requesthttp_ubah(url, data)- PUT requesthttp_hapus(url)- DELETE request
🤝 Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
# Clone the repository
git clone https://github.com/BahasaSawit/BahasaSawit.git
cd BahasaSawit
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run tests
python -m pytest tests/📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🌴 About the Theme
SawitScript draws inspiration from palm oil plantation operations, where programming concepts are metaphorically represented:
- Program = Plantation
- Variable = Planted tree
- Process = Maintenance
- Output = Harvest
- Function = Processing facility
- Array = Garden/field
This unique approach makes programming more accessible to Indonesian speakers while maintaining professional capabilities.
Made with 🌴 by the SawitScript Team
Happy Coding in the Plantation! 🌳
