Request for Sanskrit Grammar Review — Number Guessing Game in PaniniVM

9 views
Skip to first unread message

Kaushal Kumar Singh

unread,
Sep 28, 2026, 12:18:53 AMSep 28
to sanskrit-programmers
Namaste,

I am working on PaniniVM, where Sanskrit sentences are written in morphologically segmented form and executed as programs.

I have written a small Number Guessing Game and would appreciate help checking whether the generated Sanskrit sentences are grammatically and semantically natural.

Segmented source

# Number Guessing Game
# The program chooses one secret number. The player gets five attempts.

# Prakriya: define one reusable guessing attempt.
# The prakriya reads a bounded input, compares it, and prints dynamic feedback.
प्रयत्न + सुँ इति प्रक्रिया + सुँ असँ + लट् + तिप् ।
निवेश + अम् सङ्ख्या + टा ग्रहँ + श्ना + लोट् + सिप् ।
यदि ग्रह् + ल्युट् + ङस् फल + सुँ रहस्य + टा सम + सुँ असँ + लट् + तिप् तर्हि विजय + सुँ अन्यथा यदि ग्रह् + ल्युट् + ङस् फल + सुँ रहस्य + ङसिँ न्यून + सुँ असँ + लट् + तिप् तर्हि लघु अन्यथा गुरु ततः मुद्र् + णिच् + लोट् + सिप् ॥

# 1. Choose a number from the explicit inclusive range and store it as the secret.
एक + ङसिँ दशन् + शस् परि + अन्त + अम् सङ्ख्या + अम् चिञ् + श्नु + लोट् + सिप् ततः चिञ् + ल्युट् + ङस् फल + अम् रहस्य + ङि स्थाञँ + णिच् + लोट् + सिप् ।

# 2. Quote a grammatical command; iti makes mudr print it without executing it.
सङ्ख्या + अम् ऊहँ + लोट् + थास् इति मुद्र् + णिच् + लोट् + सिप् ।

# 3. Continue while the latest comparison is false; the loop exposes its structured outcome.
यावत् विजय + सुँ न भू + लट् + तिप् तावत् पञ्चन् + म + ङस् प्रयत्न + ङस् परि + अन्त + अम् प्रयत्न + अम् डुकृञ् + उ + लोट् + सिप् अन्यथा प्रयत्न + आम् समाप्ति + अम् मुद्र् + णिच् + लोट् + सिप् ।

# 4. Reveal the secret number after all attempts are finished.
रहस्य + अम् मुद्र् + णिच् + लोट् + सिप् ।

Generated Sanskrit

प्रयत्नः इति प्रक्रिया अस्ति ।
निवेशं सङ्ख्यया गृहाण ।
यदि ग्रहणस्य फलं रहस्येन समम् अस्ति तर्हि विजयः अन्यथा यदि ग्रहणस्य फलं रहस्यात् न्यूनम् अस्ति तर्हि लघु अन्यथा गुरु ततः मुद्रय ॥

एकस्माद् दश पर्यन्तं सङ्ख्यां चिनु ततः चयनस्य फलं रहस्ये स्थापय ।

सङ्ख्याम् ऊहस्व इति मुद्रय ।

यावद् विजयः न भवति तावत् पञ्चमस्य प्रयत्नस्य पर्यन्तं प्रयत्नं कुरु अन्यथा प्रयत्नानां समाप्तिं मुद्रय ।

रहस्यं मुद्रय ।

I would particularly appreciate feedback on:

1. Whether the case endings (vibhaktis) are appropriate.
2. Whether constructions such as एकस्माद् दश पर्यन्तम्, रहस्ये स्थापय, and ग्रहणस्य फलम् are natural.
3. Whether the यदि–तर्हि–अन्यथा and यावत्–तावत् constructions are grammatically sound.
4. How a Sanskrit speaker/grammarian would naturally express “up to the fifth attempt / for five attempts.”
5. Whether terms such as प्रक्रिया, निवेश, रहस्य, फल, विजय are suitable in this computational context.

The purpose is not merely to translate programming syntax into Sanskrit. PaniniVM derives the surface forms from segmented grammatical input, so I would especially like to identify places where the underlying grammatical representation itself should be changed.

Any corrections with the corresponding segmented form would be extremely helpful.

धन्यवादाः।
Reply all
Reply to author
Forward
0 new messages