Skip to content

prashlkam/Shilp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

शिल्प (Shilp) - Sahaj Hindi Lipi Prakalp...

हिन्दी में लिखी जाने वाली, पायथन पर आधारित प्रोग्रामिंग भाषा। A Hindi programming language whose semantics are identical to Python — keywords, builtins, variables, and error messages, all in Hindi (Devanagari).

कार्य अभिवादन(नाम):
    अगर नाम == "":
        वापस "नमस्ते, दुनिया!"
    वापस f"नमस्ते, {नाम}!"

हर व्यक्ति में ["अर्जुन", "प्रिया", "कबीर"]:
    छापो(अभिवादन(व्यक्ति))
$ shilp namaste.shilp
नमस्ते, अर्जुन!
नमस्ते, प्रिया!
नमस्ते, कबीर!

त्रुटियाँ भी हिन्दी में / Errors are in Hindi too:

अनुरेखण (सबसे हालिया कॉल अंतिम):
  फ़ाइल "khel.shilp", पंक्ति 8, <मुख्य स्तर> में
    छापो(भाग(१०, ०))
  फ़ाइल "khel.shilp", पंक्ति 5, कार्य 'भाग' में
    वापस अ / ब
शून्य से भाग त्रुटि (ZeroDivisionError): शून्य से भाग संभव नहीं

स्थापना / Install

pip install shilp          # from a local wheel: pip install dist/shilp-*.whl

Requires Python ≥ 3.12. A standalone Linux binary (no Python needed) is in dist/bin/.

प्रयोग / Usage

आदेश काम
shilp अन्तरक्रियात्मक सत्र (REPL)
shilp खेल.shilp [तर्क...] कार्यक्रम चलाएँ
shilp chalao खेल.shilp कार्यक्रम चलाएँ (run)
shilp anuvad खेल.shilp [-o out.py] उत्पन्न पायथन कोड देखें — "मुझे पायथन दिखाओ"
shilp anuvad --ulta खेल.py [-o out.shilp] पायथन कोड को शिल्प में बदलें — "मुझे शिल्प दिखाओ"
shilp jaanch खेल.shilp केवल वाक्यविन्यास जाँचें
shilp --madad सहायता

यह कैसे काम करता है / How it works

Shilp is a thin, token-level translation layer over CPython (see PLAN.md):

  1. Devanagari numerals (१२.५) are converted to ASCII outside string literals.
  2. The source is tokenized by Python's own tokenizer; Hindi keywords arrive as NAME tokens and are remapped (अगरif) with line numbers preserved exactly.
  3. CPython compiles and runs the result — so every Python feature works: classes, generators, decorators, असिंक/प्रतीक्षा (async/await), मिलान/मामला (match/case), f-strings…
  4. Hindi builtins (छापो, लंबाई, श्रेणी, …) are injected as aliases of the real builtins; a custom excepthook renders tracebacks in Hindi with the original Hindi source lines.

Because the mapping is one-to-one and reversible, Shilp is tested differentially against CPython: reference Python programs are machine-converted to Shilp, both are executed, and outputs must match.

  • Python modules and pip packages import as-is: आयात math, से random आयात randint.
  • Multi-file programs work: आयात मेरा_मॉड्यूल finds मेरा_मॉड्यूल.shilp.
  • Methods/attributes (.append, .split) remain English in v1 — see SPEC.md.
  • Word tables are data (shilp/shabdkosh/) — future language packs (मराठी, தமிழ், বাংলা…) need no engine changes.

भाषा एक नज़र में / Language at a glance

पायथन शिल्प पायथन शिल्प
if / elif / else अगर / अन्यथा_अगर / अन्यथा def / return कार्य / वापस
for / in / while हर / में / जब_तक class वर्ग
try / except / finally कोशिश / पकड़ो / अंत_में import / from / as आयात / से / जैसा
True / False / None सत्य / असत्य / रिक्त and / or / not और / या / नहीं
break / continue / pass तोड़ो / जारी / छोड़ो raise / assert / del उठाओ / दावा / हटाओ

Full tables: SPEC.md. Examples: examples/.

विकास / Development

python3 -m unittest discover -s tests    # परीक्षण चलाएँ
python3 -m shilp examples/namaste.shilp  # बिना install किए चलाएँ

VS Code syntax highlighting + phonetic snippets (agarअगर): editors/vscode/. Pygments: pygmentize -l shilp works once shilp and pygments are installed.

License

GPL Ver 3.0

About

Shilp is a programming language in which most of the instructions are written in Hindi. The language is a descendent of Python. Shilp stands for Sahaj Hindi Lipi Prakalp.......

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages