[BUG] No elif mapping — नहि त यदि transpiles to invalid else if

未关闭 适合新手
#25 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
compilers

调研方向

关键字映射位于 maithili_dsl/transpiler/mappings.py 中的 DEVNAGIRI_KEYWORD_MAP。请在现有的 नहि त 条目之前添加映射到 elif 的短语 नहि त यदि,因为模式按插入顺序应用。检查 maithili_dsl/transpiler/linter.py 第 38-40 行附近,确认它无需修改即可接受该链。当 नहि त यदि क > ५: 在针对 यदि / नहि त यदि / नहि त 链的完整测试中转译为 elif,且 linter 测试通过时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

area:transpiler bug good first issue keyword-mapping P2

Files: maithili_dsl/transpiler/mappings.py, maithili_dsl/transpiler/linter.py:38

There is no elif mapping, and writing the natural construct produces invalid Python:

Input:  नहि त यदि क > ५:
Output: else if क > 5:    # SyntaxError at runtime

(Verified against v0.3.0 — नहि त → else and यदि → if are substituted independently.)

Fix:

  1. Add "नहि त यदि": "elif" to DEVNAGIRI_KEYWORD_MAP — ⚠️ it must be inserted before "नहि त" in the dict, because patterns are applied in insertion order and the longer phrase must win.
  2. The linter already tolerates नहि त ... यदि lines (linter.py:40), so no linter change should be needed — but add a linter test to prove it.

Tests: transpile test for a full यदि / नहि त यदि / नहि त chain; smoke-test an example using it.

Good first issue — the whole fix is one dict entry placed correctly, plus tests. Native speakers: if a different phrase than नहि त यदि is more natural for elif, please raise it here before implementing.

主要语言
Python
星标
1
派生
4
平均合并
12 天 21 小时
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

alphacrack/python-maithili-dsl 的其他 Issue

查看 alphacrack/python-maithili-dsl 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。