Skip to main content

Chi Programming Language - A Chichewa-inspired programming language with intuitive syntax

Project description

Chi Programming Language

PyPI version Python Support License: MIT

Chi is a modern, intuitive programming language inspired by Chichewa with seamless Python interoperability. It makes programming accessible using familiar Chichewa keywords while maintaining full programming capabilities.

Features

🌍 Chichewa-Inspired Syntax - Programming keywords in Chichewa
🐍 Python Interoperability - Seamless integration with Python ecosystem
🚀 Modern Language Features - Functions, exception handling, data structures
📚 Rich Examples - Comprehensive example library included
🔧 Multiple Interfaces - CLI, REPL, Python import, and web interface
🎯 Educational Focus - Perfect for learning programming concepts

Quick Start

Installation

pip install chi-lang

Your First Chi Program

Create a file hello.chi:

onetsa("Moni, dziko!")  # Hello, world!

Run it:

chi run hello.chi

Usage

Command Line Interface

# Run a Chi program
chi run program.chi

# Interactive REPL
chi repl

# Execute Chi code directly
chi exec 'onetsa("Hello from command line!")'

# View example code
chi run --see hello_world

# Run built-in examples
chi run --example hello_world
chi run --list-examples

# Translate between Chi and Python
chi translate hello.chi --to python
chi translate hello.py --from python --to chi

Python Integration

# Import and run examples
from chi.examples import hello_world
hello_world.run()

# Access example source code
print(hello_world.content)
hello_world.show()

# List all examples
from chi import examples
examples.help()

# Execute Chi code from Python
from chi import run_code
run_code('onetsa("Hello from Python!")')

Interactive REPL

$ chi repl
Chi Programming Language REPL 1.0.0
Author: Duncan Masiye
Type 'exit()', 'quit()', 'help()' or press Ctrl+C to quit.
Commands: 'examples()', 'clear()', 'version()'

chi> ika name = "Chi"
chi> onetsa("Welcome to", name)
Welcome to Chi
chi> help()

Language Syntax

Variables and Data Types

# Variables (ika = "put/place")
ika name = "Jakesh"
ika age = 25
ika height = 5.8
ika is_student = zoona  # true
ika empty = palibe      # null

# Lists
ika fruits = ndandanda("apple", "banana", "orange")

# Dictionaries  
ika person = kaundula("name", "Alice", "age", 20)

Control Flow

# If statements (ngati = "if", sizoona = "else")
ngati age wafananitsa 18:
    onetsa("Adult")
sizoona:
    onetsa("Minor")

# Loops (yesani = "while", bwereza = "for")
ika i = 0
yesani i wachepetsedwa 5:
    onetsa("Count:", i)
    ika i = i + 1

bwereza fruit mu fruits:
    onetsa("Fruit:", fruit)

Functions

# Function definition (panga = "make/create")
panga greet(name):
    onetsa("Moni", name + "!")
    bweza "Hello " + name

# Function call
ika greeting = greet("World")

Built-in Functions

# I/O Functions
onetsa("Output")           # Print
ika input = funsani("Enter text: ")  # Input

# Type Functions  
ika type = mtundu(42)      # Get type
ika length = kukula("text") # Get length

# Math Functions
ika power = mphamvu(2, 3)   # 2^3 = 8
ika root = muzu(16)         # Square root = 4
ika sum = phatikiza(1, 2, 3, 4)  # Sum = 10

Examples

Chi comes with comprehensive examples covering all language features:

Basic Examples

  • hello_world - Simple hello world
  • simple_data_types - Variable types and declarations
  • simple_math - Mathematical operations
  • operators_demo - All operators (arithmetic, comparison, logical)

Data Structures

  • simple_lists - List operations
  • dictionary_operations_demo - Dictionary methods
  • string_methods_demo - String manipulation

Advanced Features

  • control_structures_demo - If/else, loops, control flow
  • functions_demo - Function definition and usage
  • exception_handling_demo - Try/catch error handling
  • file_operations_demo - File I/O operations

Real-World Applications

  • real_world_app_demo - Student grade management system

Run any example:

chi run --example control_structures_demo
chi run --see functions_demo  # View source code

Development

Local Development

# Clone repository (will be available soon)
# git clone https://github.com/chi-lang/chi.git
# cd chi

# For now, install from source or pip
pip install chi-lang

# Install in development mode (if you have source)
pip install -e .

# Format code (optional)
black chi/

Contributing

We welcome contributions! Please contact us at duncanmasiye16@gmail.com to get involved.

  1. Email your interest and ideas
  2. We'll help you get started
  3. GitHub repository coming soon for collaborative development
  4. Documentation and contribution guidelines will be available online

Language Reference

Keywords

  • ika - Variable assignment
  • onetsa() - Print/output function
  • ngati / sizoona - If/else statements
  • yesani - While loops
  • bwereza / mu - For loops
  • panga / bweza - Function definition/return
  • kuyesera / zakanika - Try/except

Operators

  • Arithmetic: +, -, *, /, **, %
  • Comparison: wafanana (==), wasiyana (!=), wapambana (>), etc.
  • Logical: komanso (AND), kapena (OR), osati (NOT)

Data Types

  • mawu - Strings
  • manambala - Float numbers
  • manambala_olekeza - Integer numbers
  • yankho - Booleans (zoona/zabodza)
  • ndandanda - Lists
  • kaundula - Dictionaries
  • palibe - Null values

License

MIT License - see LICENSE file for details.

Author

Duncan Masiye - duncanmasiye16@gmail.com

Support & Contact

  • 📧 Email: duncanmasiye16@gmail.com
  • 🐛 Bug Reports: Please email with detailed description
  • 💡 Feature Requests: Email your suggestions
  • 📚 Documentation: Coming soon - check back for updates
  • 🌐 Online Resources: GitHub repository and documentation will be available soon

Chi Programming Language - Making programming accessible in Chichewa!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chi_lang-1.0.0.tar.gz (128.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chi_lang-1.0.0-py3-none-any.whl (171.3 kB view details)

Uploaded Python 3

File details

Details for the file chi_lang-1.0.0.tar.gz.

File metadata

  • Download URL: chi_lang-1.0.0.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chi_lang-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2a8410c0e60fdcbe98cbb846caa7b824db602ba8162df1ad276be2dd1601a747
MD5 426ed4028d3a92477139dba6fd4c3ec0
BLAKE2b-256 a354d426be5ac8a3f44dfbcae985e9159319d62e0f24e5ea48d0cfccbd6b1c35

See more details on using hashes here.

File details

Details for the file chi_lang-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: chi_lang-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 171.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chi_lang-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2abe56ac7dacc60e82df7ad3465edbd875860ac54fb35007c72486b983a319c0
MD5 d275b033406024da2614de23f129b019
BLAKE2b-256 a2975326669a2747bf43785adec49ddad3efa8811d1d17e5f901cb536db2f7cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page