Metadata-Version: 2.4
Name: myancode-python
Version: 2.2.0
Summary: A Burmese natural language programming language and browser-based IDE (Python edition)
Author: Kaung Mrat Thu
License: MIT
Keywords: myanmar,burmese,programming-language,nlp,transpiler,ide
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flask>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Dynamic: license-file

# MyanCode · မြန်မာကုဒ် (Python Edition)

> A Burmese natural language programming language for beginners — rewritten in Python.
> Write code in Myanmar script — MyanCode understands it, transpiles it to Python, and runs it.

This is a Python port of the original [MyanCode](https://github.com/Kaung-Myat/Myan-Code) JavaScript implementation.

---

## What is MyanCode?

MyanCode is a multi-paradigm programming language written entirely in the Burmese (Myanmar) language. Students write code like this:

```
score ကို ၇၅ အဖြစ်သတ်မှတ်ပါ
အကယ်၍ score က ၈၀ ထက်ကြီးရင်
  ပြောပါ "ဂုဏ်ထူး"
မဟုတ်ရင်
  ပြောပါ "ပျမ်းမျှ"
ပြီးပါပြီ
```

Which runs as:

```
ပျမ်းမျှ
```

---

## How It Works

MyanCode uses a 6-stage NLP pipeline:

```
[Burmese source .myan]
        ↓
[1] Tokenizer       — splits text into typed tokens (lexical analysis)
        ↓
[2] Classifier      — identifies the intent of each line (text classification)
        ↓
[3] Extractor       — pulls out variable names, values, operators (NER)
        ↓
[4] AST Builder     — assembles lines into a nested syntax tree (syntactic parsing)
        ↓
[5] Transpiler      — converts the tree to Python (language generation)
        ↓
[6] Runtime         — executes via Python subprocess, captures output
```

---

## Installation

Requires Python 3.10+.

```bash
cd myancode-python
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# or: pip install -e ".[dev]"
```

---

## Usage

### Run a `.myan` file

```bash
python src/cli.py examples/hello.myan
# or after pip install -e .
myancode examples/hello.myan
```

### CLI options

```bash
myancode --transpile examples/hello.myan   # print generated Python
myancode --ast examples/hello.myan         # print AST JSON
myancode --repl                            # interactive REPL
myancode --ide                             # browser IDE
myancode --version
```

### Browser IDE

**Recommended** (avoids conflict with the Node.js `myancode` on your PATH):

```bash
./myancode --ide              # from project root — always Python
# or
source scripts/activate.sh    # venv + fixes PATH vs nvm
myancode --ide
# or
.venv/bin/myancode --ide
myancode-py --ide             # after pip install -e .
```

Open **http://127.0.0.1:3000**. Tabs: **OUTPUT**, **SIMULATION** (n8n-style: packets flow through a shared NLP pipeline), **PYTHON**.

#### Node vs Python `myancode`

If you have the old **Node.js** MyanCode installed (`npm install -g myancode`), the global
`myancode` command opens https://myan-code.vercel.app (JavaScript IDE). The Python edition
uses a local server instead.

| Command | What runs |
| --- | --- |
| `myancode --ide` (global) | Often **Node → Vercel** if nvm is on PATH |
| `./myancode --ide` | **Python → localhost** |
| `.venv/bin/myancode --ide` | **Python → localhost** |
| `myancode-py --ide` | **Python → localhost** (no name clash) |

To remove the conflict entirely:

```bash
npm uninstall -g myancode
pip install -e .
source scripts/activate.sh
myancode --version   # should print 2.2.0
```

---

## Docs

- [Tutorial](docs/TUTORIAL.md) — မြန်မာဘာသာ သင်ခန်းစာ
- [Lesson plan](docs/LESSON_PLAN.md) — ဆရာ/ဆရာမ သင်ကြား မှတ်စု
- [Language reference](docs/LANGUAGE.md) — full keyword table
- [LICENSE](LICENSE) — MIT

---

## Project Structure

```
myancode-python/
├── bin/myancode
├── config/                  # keywords + error messages (dev)
├── docs/                    # tutorial + language reference
├── examples/                # sample .myan programs
├── src/
│   ├── cli.py
│   ├── engine/              # tokenizer → runner pipeline
│   │   └── data/            # packaged copy of config JSON
│   └── ide/                 # Flask IDE + public/index.html
└── tests/                   # pytest suite
```

---

## Tests

```bash
source .venv/bin/activate
pytest -q
```

---

## License

MIT
