Advanced Python transpiler for writing Python code using Bangla keywords
Project description
CodeBangla
Advanced Python transpiler for writing Python code using Bangla keywords
Features • Installation • Quick Start • Documentation • Contributing
CodeBangla is a professional-grade Python transpiler that enables developers to write Python code using Bangla keywords (in English transliteration). Designed to make programming more accessible for Bengali speakers while maintaining full compatibility with the Python ecosystem.
✨ Features
🚀 Complete Python Support
- Modern Python Features: Full support for async/await, type hints, decorators, context managers
- All Python Constructs: Classes, functions, exceptions, comprehensions, generators
- Python 3.8+ Compatible: Supports latest Python versions and features
🔧 Advanced Transpilation Engine
- AST-Based Processing: Sophisticated parsing and transformation
- Error Recovery: Intelligent error handling and suggestions
- Source Mapping: Debug transpiled code with original line numbers
- Performance Optimized: Fast transpilation with caching support
🛡️ Professional Tooling
- Type Checking: Optional static type analysis
- Strict Mode: Enhanced validation and error checking
- Plugin Architecture: Extensible with custom transformations
- CLI Tools: Comprehensive command-line interface
🌐 Internationalization
- Unicode Normalized: Proper handling of Bangla text and numerals
- Mixed Scripts: Support for mixed Bangla-English codebases
- Cultural Context: Keywords designed for Bengali programming concepts
📦 Installation
Quick Install
pip install codebangla
Development Install
git clone https://github.com/saky-semicolon/codebangla.git
cd codebangla
pip install -e ".[dev,docs,test]"
Verify Installation
codebangla --version
codebangla info
🚀 Quick Start
Your First Program
Create a file hello.bp:
# hello.bp
shuru main():
naam = neoa("আপনার নাম কি? ")
chhap(f"আসসালামু আলাইকুম, {naam}!")
jodi __name__ == "__main__":
main()
Run It
codebangla run hello.bp
Compile to Python
codebangla compile hello.bp -o hello.py
📚 Language Reference
🔤 Core Keywords
| Bangla | Python | Description |
|---|---|---|
chhap |
print |
Print output |
neoa |
input |
Get input |
jodi |
if |
Conditional statement |
noile |
else |
Else clause |
noile_jodi |
elif |
Else-if clause |
jotokkhon |
while |
While loop |
er_jonno |
for |
For loop |
moddhe |
in |
Membership test |
shuru |
def |
Function definition |
classh |
class |
Class definition |
phiredao |
return |
Return statement |
thamo |
break |
Break loop |
chaliye_jao |
continue |
Continue loop |
⚡ Modern Features
| Bangla | Python | Description |
|---|---|---|
ashinchronous |
async |
Async function |
opeksha |
await |
Await expression |
sathe |
with |
Context manager |
chesta_koro |
try |
Try block |
dhoro |
except |
Exception handler |
seshe |
finally |
Finally block |
uththapon |
raise |
Raise exception |
tulona |
assert |
Assertion |
🏗️ Data Types
| Bangla | Python | Description |
|---|---|---|
shongkhya |
int |
Integer |
tothyo |
float |
Float |
shobdo |
str |
String |
talika |
list |
List |
obhidhan |
dict |
Dictionary |
jora |
tuple |
Tuple |
shongroho |
set |
Set |
sotti |
True |
Boolean True |
miththa |
False |
Boolean False |
shunno |
None |
None value |
📖 Advanced Examples
Object-Oriented Programming
# person.bp
classh Person:
shuru __init__(nijei, naam: shobdo, boyosh: shongkhya):
nijei.naam = naam
nijei.boyosh = boyosh
shuru greet(nijei) -> shobdo:
phiredao f"আমার নাম {nijei.naam}, বয়স {nijei.boyosh}"
shuru birthday(nijei):
nijei.boyosh += 1
chhap(f"{nijei.naam} এর জন্মদিন! এখন বয়স {nijei.boyosh}")
# Usage
person = Person("আহমেদ", 25)
chhap(person.greet())
person.birthday()
Async Programming
# async_example.bp
theke asyncio ano sleep
ashinchronous shuru fetch_data(url: shobdo) -> obhidhan:
chhap(f"Fetching data from {url}")
opeksha sleep(1) # Simulate network delay
phiredao {"url": url, "data": "Sample data"}
ashinchronous shuru main():
urls = ["http://api1.com", "http://api2.com", "http://api3.com"]
er_jonno url moddhe urls:
result = opeksha fetch_data(url)
chhap(f"Received: {result}")
jodi __name__ == "__main__":
theke asyncio ano run
run(main())
Error Handling
# error_handling.bp
shuru divide(a: tothyo, b: tothyo) -> tothyo:
chesta_koro:
result = a / b
phiredao result
dhoro ZeroDivisionError:
chhap("ভাগ করা যায় না শূন্য দিয়ে!")
phiredao 0.0
dhoro TypeError hishabe e:
chhap(f"ভুল ডাটা টাইপ: {e}")
uththapon e
seshe:
chhap("গণনা সম্পন্ন")
# Usage
result1 = divide(10, 2) # Normal case
result2 = divide(10, 0) # Zero division
result3 = divide("10", 2) # Type error
�️ CLI Reference
Basic Commands
# Run a CodeBangla file
codebangla run myfile.bp
# Compile to Python
codebangla compile myfile.bp -o myfile.py
# Interactive REPL
codebangla repl
# Validate code
codebangla validate myfile.bp
# Create new project
codebangla init myproject --template advanced
Advanced Options
# Enable strict mode
codebangla run myfile.bp --strict
# Watch for changes
codebangla run myfile.bp --watch
# Enable profiling
codebangla compile myfile.bp --profile
# Format output
codebangla compile myfile.bp --format black
# Enable debugging
codebangla run myfile.bp --debug
Project Management
# Initialize project with template
codebangla init my-web-app --template web --author "আপনার নাম"
# Show system information
codebangla info
# List available keywords
codebangla keywords --category core
# Search keywords
codebangla keywords --search "print"
⚙️ Configuration
Create codebangla.json in your project:
{
"name": "my-project",
"version": "1.0.0",
"author": "Your Name",
"license": "MIT",
"transpiler": {
"strict_mode": false,
"enable_type_checking": true,
"enable_async_support": true,
"target_python_version": [3, 8],
"plugins": []
}
}
🧪 Testing
# Run tests
pytest
# Run with coverage
pytest --cov=codebangla
# Run performance benchmarks
pytest --benchmark-only
# Run specific test categories
pytest -m "not slow" # Skip slow tests
pytest -m integration # Integration tests only
📊 Performance
CodeBangla is optimized for performance:
- Fast Transpilation: Sub-millisecond transpilation for typical files
- Memory Efficient: Minimal memory overhead during processing
- Caching: Intelligent caching of transpilation results
- Parallel Processing: Multi-threaded processing for large projects
Benchmarks
Small file (< 1KB): ~0.1ms
Medium file (10KB): ~1ms
Large file (100KB): ~10ms
Very large (1MB): ~100ms
� API Reference
Programmatic Usage
from codebangla import AdvancedTranspiler, TranspilerConfig
# Basic usage
from codebangla import transpile
result = transpile('chhap("Hello")')
# Advanced usage
config = TranspilerConfig(
strict_mode=True,
enable_type_checking=True,
enable_debugging=True
)
transpiler = AdvancedTranspiler(config)
result = transpiler.transpile(source_code, filename="test.bp")
if result.success:
print("Transpiled code:", result.code)
exec(result.code)
else:
print("Errors:", result.errors)
print("Warnings:", result.warnings)
Tokenization
from codebangla.tokenizer import AdvancedTokenizer
tokenizer = AdvancedTokenizer()
tokens = tokenizer.tokenize('chhap("Hello")')
for token in tokens:
print(f"{token.type}: {token.value} -> {token.python_equivalent}")
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Development Setup
git clone https://github.com/saky-semicolon/codebangla.git
cd codebangla
pip install -e ".[dev]"
pre-commit install
Code Quality
# Format code
black codebangla tests
isort codebangla tests
# Lint code
flake8 codebangla tests
mypy codebangla
# Run all checks
tox
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Inspired by the need to make programming accessible to Bengali speakers
- Built on Python's robust tokenization and AST infrastructure
- Thanks to the open-source community for tools and libraries
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Read the Docs
- Email: team@codebangla.org
Made with ❤️ for the Bengali programming community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codebangla-0.2.0.tar.gz.
File metadata
- Download URL: codebangla-0.2.0.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eec51f23106e80a3b74c1d19fc244345d1e7e93c5a1f2cde5a7e6e11125c450e
|
|
| MD5 |
b47dcf9a9ae4d7aba55c26897a0d1afc
|
|
| BLAKE2b-256 |
3718a59434bdd7867d3e3b34ac9a9450099d8374a4a183faba35f10bc788f245
|
Provenance
The following attestation bundles were made for codebangla-0.2.0.tar.gz:
Publisher:
publish-to-pypi.yml on saky-semicolon/CodeBangla
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codebangla-0.2.0.tar.gz -
Subject digest:
eec51f23106e80a3b74c1d19fc244345d1e7e93c5a1f2cde5a7e6e11125c450e - Sigstore transparency entry: 438418406
- Sigstore integration time:
-
Permalink:
saky-semicolon/CodeBangla@e57be4c43cc629d8212fe6366072182830fae104 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/saky-semicolon
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e57be4c43cc629d8212fe6366072182830fae104 -
Trigger Event:
release
-
Statement type:
File details
Details for the file codebangla-0.2.0-py3-none-any.whl.
File metadata
- Download URL: codebangla-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40eed6cc612c5d9afcd0de36d1f9993938826c54bc1a2aa12742f0da32dc1c96
|
|
| MD5 |
53b731e5502c9b54a004a84eed546aed
|
|
| BLAKE2b-256 |
e02463906bc21511df00898b26bda6c7f5eadb939b602def05082e337e4d6d7d
|
Provenance
The following attestation bundles were made for codebangla-0.2.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on saky-semicolon/CodeBangla
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codebangla-0.2.0-py3-none-any.whl -
Subject digest:
40eed6cc612c5d9afcd0de36d1f9993938826c54bc1a2aa12742f0da32dc1c96 - Sigstore transparency entry: 438418449
- Sigstore integration time:
-
Permalink:
saky-semicolon/CodeBangla@e57be4c43cc629d8212fe6366072182830fae104 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/saky-semicolon
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e57be4c43cc629d8212fe6366072182830fae104 -
Trigger Event:
release
-
Statement type: