hinglish-lang 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. hinglish_lang-1.1.0/PKG-INFO +293 -0
  2. hinglish_lang-1.1.0/README.md +264 -0
  3. hinglish_lang-1.1.0/hinglish/__init__.py +30 -0
  4. hinglish_lang-1.1.0/hinglish/__main__.py +7 -0
  5. hinglish_lang-1.1.0/hinglish/ast/__init__.py +166 -0
  6. hinglish_lang-1.1.0/hinglish/ast/dump.py +56 -0
  7. hinglish_lang-1.1.0/hinglish/ast/nodes.py +645 -0
  8. hinglish_lang-1.1.0/hinglish/cli/__init__.py +483 -0
  9. hinglish_lang-1.1.0/hinglish/cli/__main__.py +7 -0
  10. hinglish_lang-1.1.0/hinglish/compiler/__init__.py +35 -0
  11. hinglish_lang-1.1.0/hinglish/compiler/compiler.py +764 -0
  12. hinglish_lang-1.1.0/hinglish/dap/__init__.py +33 -0
  13. hinglish_lang-1.1.0/hinglish/dap/__main__.py +6 -0
  14. hinglish_lang-1.1.0/hinglish/dap/debugger.py +455 -0
  15. hinglish_lang-1.1.0/hinglish/dap/protocol.py +189 -0
  16. hinglish_lang-1.1.0/hinglish/dap/server.py +260 -0
  17. hinglish_lang-1.1.0/hinglish/exceptions.py +52 -0
  18. hinglish_lang-1.1.0/hinglish/formatter/__init__.py +12 -0
  19. hinglish_lang-1.1.0/hinglish/formatter/formatter.py +893 -0
  20. hinglish_lang-1.1.0/hinglish/keywords.py +285 -0
  21. hinglish_lang-1.1.0/hinglish/lexer/__init__.py +38 -0
  22. hinglish_lang-1.1.0/hinglish/lexer/debug.py +60 -0
  23. hinglish_lang-1.1.0/hinglish/lexer/lexer.py +655 -0
  24. hinglish_lang-1.1.0/hinglish/lexer/tokens.py +136 -0
  25. hinglish_lang-1.1.0/hinglish/linter/__init__.py +16 -0
  26. hinglish_lang-1.1.0/hinglish/linter/analyzer.py +1101 -0
  27. hinglish_lang-1.1.0/hinglish/linter/diagnostics.py +74 -0
  28. hinglish_lang-1.1.0/hinglish/linter/rules.py +67 -0
  29. hinglish_lang-1.1.0/hinglish/lsp/__init__.py +40 -0
  30. hinglish_lang-1.1.0/hinglish/lsp/__main__.py +6 -0
  31. hinglish_lang-1.1.0/hinglish/lsp/analyzer.py +679 -0
  32. hinglish_lang-1.1.0/hinglish/lsp/documents.py +129 -0
  33. hinglish_lang-1.1.0/hinglish/lsp/protocol.py +257 -0
  34. hinglish_lang-1.1.0/hinglish/lsp/server.py +311 -0
  35. hinglish_lang-1.1.0/hinglish/parser/__init__.py +38 -0
  36. hinglish_lang-1.1.0/hinglish/parser/parser.py +2234 -0
  37. hinglish_lang-1.1.0/hinglish/runtime/__init__.py +20 -0
  38. hinglish_lang-1.1.0/hinglish/runtime/context.py +33 -0
  39. hinglish_lang-1.1.0/hinglish/runtime/engine.py +167 -0
  40. hinglish_lang-1.1.0/hinglish/runtime/importer.py +107 -0
  41. hinglish_lang-1.1.0/hinglish/runtime/repl.py +126 -0
  42. hinglish_lang-1.1.0/hinglish_lang.egg-info/PKG-INFO +293 -0
  43. hinglish_lang-1.1.0/hinglish_lang.egg-info/SOURCES.txt +68 -0
  44. hinglish_lang-1.1.0/hinglish_lang.egg-info/dependency_links.txt +1 -0
  45. hinglish_lang-1.1.0/hinglish_lang.egg-info/entry_points.txt +4 -0
  46. hinglish_lang-1.1.0/hinglish_lang.egg-info/requires.txt +9 -0
  47. hinglish_lang-1.1.0/hinglish_lang.egg-info/top_level.txt +1 -0
  48. hinglish_lang-1.1.0/pyproject.toml +61 -0
  49. hinglish_lang-1.1.0/setup.cfg +4 -0
  50. hinglish_lang-1.1.0/tests/test_compiler.py +236 -0
  51. hinglish_lang-1.1.0/tests/test_foundation.py +56 -0
  52. hinglish_lang-1.1.0/tests/test_keywords.py +91 -0
  53. hinglish_lang-1.1.0/tests/test_lexer.py +277 -0
  54. hinglish_lang-1.1.0/tests/test_parser.py +373 -0
  55. hinglish_lang-1.1.0/tests/test_runtime.py +167 -0
  56. hinglish_lang-1.1.0/tests/test_step10a_packaging.py +136 -0
  57. hinglish_lang-1.1.0/tests/test_step10b_cli.py +265 -0
  58. hinglish_lang-1.1.0/tests/test_step10c_vscode.py +191 -0
  59. hinglish_lang-1.1.0/tests/test_step10d_docs.py +124 -0
  60. hinglish_lang-1.1.0/tests/test_step10e_lsp.py +428 -0
  61. hinglish_lang-1.1.0/tests/test_step10f_debugger.py +391 -0
  62. hinglish_lang-1.1.0/tests/test_step10g_formatter.py +523 -0
  63. hinglish_lang-1.1.0/tests/test_step10h_linter.py +513 -0
  64. hinglish_lang-1.1.0/tests/test_step11a_conformance.py +180 -0
  65. hinglish_lang-1.1.0/tests/test_step12_validation.py +92 -0
  66. hinglish_lang-1.1.0/tests/test_step13_v11.py +407 -0
  67. hinglish_lang-1.1.0/tests/test_step6.py +482 -0
  68. hinglish_lang-1.1.0/tests/test_step7.py +424 -0
  69. hinglish_lang-1.1.0/tests/test_step8.py +486 -0
  70. hinglish_lang-1.1.0/tests/test_step9.py +535 -0
@@ -0,0 +1,293 @@
1
+ Metadata-Version: 2.4
2
+ Name: hinglish-lang
3
+ Version: 1.1.0
4
+ Summary: A Python-compatible programming language interface using Hinglish syntax.
5
+ Author-email: Neeraj Yadav <neerajbhaiya1508@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/NeerajYadav-coder/Hinglish_programming_language.
8
+ Project-URL: Repository, https://github.com/NeerajYadav-coder/Hinglish_programming_language.
9
+ Keywords: hinglish,programming-language,compiler,transpiler,python,hindi
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Software Development :: Compilers
20
+ Classifier: Topic :: Software Development :: Interpreters
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ Provides-Extra: dev
24
+ Requires-Dist: wheel; extra == "dev"
25
+ Provides-Extra: lsp
26
+ Requires-Dist: pygls>=1.3.1; extra == "lsp"
27
+ Provides-Extra: dap
28
+ Requires-Dist: debugpy>=1.8.0; extra == "dap"
29
+
30
+ # Hinglish Programming Language
31
+
32
+ > **Hinglish** is a Python-compatible programming language interface that uses familiar Hinglish (Hindi + English) keywords and syntax, targeting Python execution under the hood.
33
+
34
+ ---
35
+
36
+ ## What is Hinglish?
37
+
38
+ Hinglish is an intuitive, approachable programming language interface designed for Hindi and Hinglish speakers. It allows developers and students to express algorithms, logic, and data flows using natural Hinglish vocabulary (such as `agar`, `warna`, `jabtak`, `kaam`, and `dikhao`), while retaining the simplicity, semantics, and standard library power of Python.
39
+
40
+ ---
41
+
42
+ ## Why Hinglish?
43
+
44
+ 1. **Accessibility**: For millions of aspiring developers in India and South Asia, syntax barriers in English can add unnecessary cognitive friction when learning computational logic.
45
+ 2. **Cognitive Ease**: Reading `agar umar >= 18:` feels immediately intuitive and lowers the barrier to entry for beginners.
46
+ 3. **Bridge, Not Island**: Rather than creating an isolated language with no ecosystem, Hinglish seamlessly maps to Python. Code written in Hinglish preserves Python's block structure and expression semantics, acting as an educational and practical bridge to full Python mastery.
47
+
48
+ ---
49
+
50
+ ## The Core Idea
51
+
52
+ Hinglish separates **syntax representation** from **computational semantics**:
53
+
54
+ - **Syntax Layer**: Natural Hinglish keywords (`agar`, `warna`, `dikhao`, `kaam`, `har`, `jabtak`) and idiomatic constructs.
55
+ - **Structural Model**: Strict preservation of Python-style indentation (`INDENT`, `DEDENT`, and colons `:`).
56
+ - **Expression Compatibility**: Mathematical operations, indexing, slicing, function calls, and object attribute access remain standard Python expressions wherever practical.
57
+ - **Execution Target**: Hinglish compiles deterministically into clean Python AST or Python source code for execution via standard Python runtimes.
58
+
59
+ ### Example
60
+
61
+ ```hinglish
62
+ # Hinglish Source Code
63
+ naam = "Neeraj"
64
+
65
+ agar naam == "Neeraj":
66
+ dikhao("Namaste duniya!")
67
+ warna:
68
+ dikhao("Hello!")
69
+ ```
70
+
71
+ Translates under the hood to:
72
+
73
+ ```python
74
+ # Generated Python
75
+ naam = "Neeraj"
76
+
77
+ if naam == "Neeraj":
78
+ print("Namaste duniya!")
79
+ else:
80
+ print("Hello!")
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Long-Term Compiler Pipeline
86
+
87
+ The complete end-to-end architectural pipeline is designed as follows:
88
+
89
+ ```
90
+ Hinglish Source Code (.hin)
91
+
92
+ Tokenizer / Lexer (converts Hinglish characters into token stream; tracks INDENT / DEDENT)
93
+
94
+ Parser (constructs Hinglish Abstract Syntax Tree from tokens)
95
+
96
+ Hinglish AST (semantic node graph representing Hinglish program logic)
97
+
98
+ Semantic Analysis (validates scopes, names, and grammar rules)
99
+
100
+ Compiler / Lowering (transforms Hinglish AST to Python AST or Python source code)
101
+
102
+ Python Execution (executes directly via Python runtime)
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Installation
108
+
109
+ Install Hinglish directly using `pip`:
110
+
111
+ ```bash
112
+ # From PyPI
113
+ pip install hinglish-lang
114
+
115
+ # Or from local repository source
116
+ pip install .
117
+ ```
118
+
119
+ Requires **Python 3.10+** (tested on Python 3.10 through 3.14). Zero third-party runtime dependencies required!
120
+
121
+ ---
122
+
123
+ ## Quickstart
124
+
125
+ ### 1. Minimal Hello World
126
+
127
+ Create a file named `hello.hin`:
128
+
129
+ ```hinglish
130
+ naam = "Neeraj"
131
+
132
+ agar naam == "Neeraj":
133
+ dikhao("Namaste")
134
+ warna:
135
+ dikhao("Hello")
136
+ ```
137
+
138
+ Run it using the `hinglish` command:
139
+
140
+ ```bash
141
+ hinglish hello.hin
142
+ ```
143
+
144
+ Output:
145
+ ```text
146
+ Namaste
147
+ ```
148
+
149
+ You can also run it via standard Python module invocation:
150
+ ```bash
151
+ python3 -m hinglish hello.hin
152
+ ```
153
+
154
+ ### 2. Basic Syntax at a Glance
155
+
156
+ ```hinglish
157
+ # Variables and Printing
158
+ naam = "Aarav"
159
+ dikhao(f"Namaste, {naam}!")
160
+
161
+ # Conditionals (agar, warna_agar, warna)
162
+ agar naam == "Aarav":
163
+ dikhao("User verified")
164
+ warna_agar naam == "Neeraj":
165
+ dikhao("Creator verified")
166
+ warna:
167
+ dikhao("Guest verified")
168
+
169
+ # Loops (har ... mein ...)
170
+ har i mein ginti(1, 4):
171
+ dikhao(f"Step {i}")
172
+
173
+ # Inline Conditional Expression (ternary)
174
+ status = "Admin" agar naam == "Neeraj" warna "Member"
175
+
176
+ # Bilingual Built-in Aliases
177
+ items = [10, 20, 30]
178
+ n = lambai(items) # len -> 3
179
+ total = jod(items) # sum -> 60
180
+ valid = sab([sahi, sahi]) # all -> True
181
+ exists = koi([galat, sahi]) # any -> True
182
+
183
+ # Functions (kaam, wapas)
184
+ kaam jodo(a: int, b: int) -> int:
185
+ wapas a + b
186
+ ```
187
+
188
+ ### 3. Interactive REPL
189
+
190
+ Start the interactive Hinglish REPL by running `hinglish` with no arguments:
191
+
192
+ ```bash
193
+ hinglish
194
+ ```
195
+
196
+ Example session:
197
+ ```hinglish
198
+ Hinglish 1.1.0 Interactive REPL
199
+ Type "exit()", "quit()", or Ctrl-D to exit.
200
+
201
+ >>> x = 10
202
+ >>> agar x > 5:
203
+ ... dikhao(f"Value is {x}")
204
+ ...
205
+ Value is 10
206
+ >>>
207
+ ```
208
+
209
+ ### 4. CLI Commands & Subcommands
210
+
211
+ The `hinglish` CLI supports both explicit subcommands and backward-compatible flags:
212
+
213
+ ```bash
214
+ # Subcommand Syntax
215
+ hinglish run script.hin # Execute a Hinglish script
216
+ hinglish tokens script.hin # Inspect token stream
217
+ hinglish ast script.hin # Inspect Abstract Syntax Tree
218
+ hinglish transpile script.hin # Transpile to Python source
219
+ hinglish transpile script.hin -o out.py # Save Python output to file
220
+ hinglish format script.hin # Format Hinglish source in-place
221
+ hinglish format src/ tests/ # Recursively format all *.hin in directories
222
+ hinglish format script.hin --check # Check if formatted without modifying (exit code 0/1)
223
+ hinglish format script.hin -o out.hin # Save formatted source to another file (single input only)
224
+ hinglish lint script.hin [files...] # Static analysis and lint diagnostics
225
+ hinglish lint src/ tests/ # Recursively discover and lint all *.hin in directories
226
+ hinglish lint script.hin --check # Lint check (exits 1 if warnings/errors found)
227
+ hinglish repl # Start interactive REPL
228
+
229
+ # Shorthand Syntax (100% Backward Compatible)
230
+ hinglish script.hin # Execute script directly
231
+ hinglish --tokens script.hin # Inspect tokens
232
+ hinglish --ast script.hin # Inspect AST
233
+ hinglish --transpile script.hin # Transpile to stdout
234
+ hinglish --format src/ # Format directory in-place
235
+ hinglish --lint src/ # Run linter across directory
236
+ hinglish --version # Show version
237
+ ```
238
+
239
+ ### 5. Standard Input (Stdin / Pipelines)
240
+
241
+ Hinglish can read and execute source code directly from pipelines:
242
+
243
+ ```bash
244
+ # Pipe code into hinglish
245
+ cat script.hin | hinglish
246
+
247
+ # Explicit stdin execution
248
+ echo 'dikhao("Namaste")' | hinglish -
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Developer Tooling & Ecosystem
254
+
255
+ Hinglish provides a complete developer ecosystem:
256
+
257
+ - **VS Code Extension (`vscode-hinglish`)**:
258
+ - Full TextMate syntax highlighting for all 64 Hinglish keywords, strings, decorators, and builtins.
259
+ - **Language Server Protocol (LSP)**: `hinglish-lsp` entrypoint providing hover documentation, real-time diagnostics, document symbols, and auto-completion.
260
+ - **Debug Adapter Protocol (DAP)**: `hinglish-dap` entrypoint with breakpoints, variable inspection, call stack navigation, and step debugging.
261
+ - **Document Formatter & Linter**: Integrated source formatting and static analysis directly within VS Code.
262
+ - **Official Documentation Website (`docs/`)**:
263
+ - Full modern interactive documentation, language guide, interactive comparison tables, keyword glossary, and real-world examples.
264
+
265
+
266
+ ---
267
+
268
+ ## Real Multi-File Projects
269
+
270
+ Hinglish provides first-class support for multi-file modular architectures:
271
+
272
+ ```text
273
+ my_project/
274
+ ├── config.hin # App constants and configuration
275
+ ├── utils.hin # Helper functions and formatting
276
+ ├── models.hin # Data classes and models
277
+ ├── services.hin # Business logic & async operations
278
+ └── main.hin # Project entrypoint
279
+ ```
280
+
281
+ ### Module Resolution Semantics
282
+ - **Executing Projects**: Run `hinglish /path/to/project/main.hin` from **any** working directory.
283
+ - **Working Directory Independence**: Hinglish automatically sets `sys.path[0]` to the directory of the executed script, so relative `.hin` imports (`laao utils`, `se models laao Product`) resolve cleanly regardless of your current working directory.
284
+ - **Nested & Inter-Module Imports**: A module (`models.hin`) can import another sibling module (`utils.hin`) without needing complex packaging configuration.
285
+ - **Source-Mapped Multi-File Tracebacks**: When an exception occurs inside an imported `.hin` module, Hinglish renders a full traceback showing every `.hin` file name, exact line number, and original code snippet.
286
+ - **Python Interoperability**: Hinglish seamlessly imports Python standard library modules (`se datetime laao datetime`, `se json laao dumps`), and Python scripts can import `.hin` files via `hinglish.runtime.install_import_hook()`.
287
+
288
+ ### Exit Codes
289
+ - `0`: Successful execution, version display, help display, or clean REPL exit.
290
+ - `1`: Program execution error (syntax errors, compiler errors, runtime exceptions, missing file, or source overwrite safety violation).
291
+ - `2`: CLI argument usage error (unrecognized flags, missing file argument for subcommands).
292
+
293
+
@@ -0,0 +1,264 @@
1
+ # Hinglish Programming Language
2
+
3
+ > **Hinglish** is a Python-compatible programming language interface that uses familiar Hinglish (Hindi + English) keywords and syntax, targeting Python execution under the hood.
4
+
5
+ ---
6
+
7
+ ## What is Hinglish?
8
+
9
+ Hinglish is an intuitive, approachable programming language interface designed for Hindi and Hinglish speakers. It allows developers and students to express algorithms, logic, and data flows using natural Hinglish vocabulary (such as `agar`, `warna`, `jabtak`, `kaam`, and `dikhao`), while retaining the simplicity, semantics, and standard library power of Python.
10
+
11
+ ---
12
+
13
+ ## Why Hinglish?
14
+
15
+ 1. **Accessibility**: For millions of aspiring developers in India and South Asia, syntax barriers in English can add unnecessary cognitive friction when learning computational logic.
16
+ 2. **Cognitive Ease**: Reading `agar umar >= 18:` feels immediately intuitive and lowers the barrier to entry for beginners.
17
+ 3. **Bridge, Not Island**: Rather than creating an isolated language with no ecosystem, Hinglish seamlessly maps to Python. Code written in Hinglish preserves Python's block structure and expression semantics, acting as an educational and practical bridge to full Python mastery.
18
+
19
+ ---
20
+
21
+ ## The Core Idea
22
+
23
+ Hinglish separates **syntax representation** from **computational semantics**:
24
+
25
+ - **Syntax Layer**: Natural Hinglish keywords (`agar`, `warna`, `dikhao`, `kaam`, `har`, `jabtak`) and idiomatic constructs.
26
+ - **Structural Model**: Strict preservation of Python-style indentation (`INDENT`, `DEDENT`, and colons `:`).
27
+ - **Expression Compatibility**: Mathematical operations, indexing, slicing, function calls, and object attribute access remain standard Python expressions wherever practical.
28
+ - **Execution Target**: Hinglish compiles deterministically into clean Python AST or Python source code for execution via standard Python runtimes.
29
+
30
+ ### Example
31
+
32
+ ```hinglish
33
+ # Hinglish Source Code
34
+ naam = "Neeraj"
35
+
36
+ agar naam == "Neeraj":
37
+ dikhao("Namaste duniya!")
38
+ warna:
39
+ dikhao("Hello!")
40
+ ```
41
+
42
+ Translates under the hood to:
43
+
44
+ ```python
45
+ # Generated Python
46
+ naam = "Neeraj"
47
+
48
+ if naam == "Neeraj":
49
+ print("Namaste duniya!")
50
+ else:
51
+ print("Hello!")
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Long-Term Compiler Pipeline
57
+
58
+ The complete end-to-end architectural pipeline is designed as follows:
59
+
60
+ ```
61
+ Hinglish Source Code (.hin)
62
+
63
+ Tokenizer / Lexer (converts Hinglish characters into token stream; tracks INDENT / DEDENT)
64
+
65
+ Parser (constructs Hinglish Abstract Syntax Tree from tokens)
66
+
67
+ Hinglish AST (semantic node graph representing Hinglish program logic)
68
+
69
+ Semantic Analysis (validates scopes, names, and grammar rules)
70
+
71
+ Compiler / Lowering (transforms Hinglish AST to Python AST or Python source code)
72
+
73
+ Python Execution (executes directly via Python runtime)
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ Install Hinglish directly using `pip`:
81
+
82
+ ```bash
83
+ # From PyPI
84
+ pip install hinglish-lang
85
+
86
+ # Or from local repository source
87
+ pip install .
88
+ ```
89
+
90
+ Requires **Python 3.10+** (tested on Python 3.10 through 3.14). Zero third-party runtime dependencies required!
91
+
92
+ ---
93
+
94
+ ## Quickstart
95
+
96
+ ### 1. Minimal Hello World
97
+
98
+ Create a file named `hello.hin`:
99
+
100
+ ```hinglish
101
+ naam = "Neeraj"
102
+
103
+ agar naam == "Neeraj":
104
+ dikhao("Namaste")
105
+ warna:
106
+ dikhao("Hello")
107
+ ```
108
+
109
+ Run it using the `hinglish` command:
110
+
111
+ ```bash
112
+ hinglish hello.hin
113
+ ```
114
+
115
+ Output:
116
+ ```text
117
+ Namaste
118
+ ```
119
+
120
+ You can also run it via standard Python module invocation:
121
+ ```bash
122
+ python3 -m hinglish hello.hin
123
+ ```
124
+
125
+ ### 2. Basic Syntax at a Glance
126
+
127
+ ```hinglish
128
+ # Variables and Printing
129
+ naam = "Aarav"
130
+ dikhao(f"Namaste, {naam}!")
131
+
132
+ # Conditionals (agar, warna_agar, warna)
133
+ agar naam == "Aarav":
134
+ dikhao("User verified")
135
+ warna_agar naam == "Neeraj":
136
+ dikhao("Creator verified")
137
+ warna:
138
+ dikhao("Guest verified")
139
+
140
+ # Loops (har ... mein ...)
141
+ har i mein ginti(1, 4):
142
+ dikhao(f"Step {i}")
143
+
144
+ # Inline Conditional Expression (ternary)
145
+ status = "Admin" agar naam == "Neeraj" warna "Member"
146
+
147
+ # Bilingual Built-in Aliases
148
+ items = [10, 20, 30]
149
+ n = lambai(items) # len -> 3
150
+ total = jod(items) # sum -> 60
151
+ valid = sab([sahi, sahi]) # all -> True
152
+ exists = koi([galat, sahi]) # any -> True
153
+
154
+ # Functions (kaam, wapas)
155
+ kaam jodo(a: int, b: int) -> int:
156
+ wapas a + b
157
+ ```
158
+
159
+ ### 3. Interactive REPL
160
+
161
+ Start the interactive Hinglish REPL by running `hinglish` with no arguments:
162
+
163
+ ```bash
164
+ hinglish
165
+ ```
166
+
167
+ Example session:
168
+ ```hinglish
169
+ Hinglish 1.1.0 Interactive REPL
170
+ Type "exit()", "quit()", or Ctrl-D to exit.
171
+
172
+ >>> x = 10
173
+ >>> agar x > 5:
174
+ ... dikhao(f"Value is {x}")
175
+ ...
176
+ Value is 10
177
+ >>>
178
+ ```
179
+
180
+ ### 4. CLI Commands & Subcommands
181
+
182
+ The `hinglish` CLI supports both explicit subcommands and backward-compatible flags:
183
+
184
+ ```bash
185
+ # Subcommand Syntax
186
+ hinglish run script.hin # Execute a Hinglish script
187
+ hinglish tokens script.hin # Inspect token stream
188
+ hinglish ast script.hin # Inspect Abstract Syntax Tree
189
+ hinglish transpile script.hin # Transpile to Python source
190
+ hinglish transpile script.hin -o out.py # Save Python output to file
191
+ hinglish format script.hin # Format Hinglish source in-place
192
+ hinglish format src/ tests/ # Recursively format all *.hin in directories
193
+ hinglish format script.hin --check # Check if formatted without modifying (exit code 0/1)
194
+ hinglish format script.hin -o out.hin # Save formatted source to another file (single input only)
195
+ hinglish lint script.hin [files...] # Static analysis and lint diagnostics
196
+ hinglish lint src/ tests/ # Recursively discover and lint all *.hin in directories
197
+ hinglish lint script.hin --check # Lint check (exits 1 if warnings/errors found)
198
+ hinglish repl # Start interactive REPL
199
+
200
+ # Shorthand Syntax (100% Backward Compatible)
201
+ hinglish script.hin # Execute script directly
202
+ hinglish --tokens script.hin # Inspect tokens
203
+ hinglish --ast script.hin # Inspect AST
204
+ hinglish --transpile script.hin # Transpile to stdout
205
+ hinglish --format src/ # Format directory in-place
206
+ hinglish --lint src/ # Run linter across directory
207
+ hinglish --version # Show version
208
+ ```
209
+
210
+ ### 5. Standard Input (Stdin / Pipelines)
211
+
212
+ Hinglish can read and execute source code directly from pipelines:
213
+
214
+ ```bash
215
+ # Pipe code into hinglish
216
+ cat script.hin | hinglish
217
+
218
+ # Explicit stdin execution
219
+ echo 'dikhao("Namaste")' | hinglish -
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Developer Tooling & Ecosystem
225
+
226
+ Hinglish provides a complete developer ecosystem:
227
+
228
+ - **VS Code Extension (`vscode-hinglish`)**:
229
+ - Full TextMate syntax highlighting for all 64 Hinglish keywords, strings, decorators, and builtins.
230
+ - **Language Server Protocol (LSP)**: `hinglish-lsp` entrypoint providing hover documentation, real-time diagnostics, document symbols, and auto-completion.
231
+ - **Debug Adapter Protocol (DAP)**: `hinglish-dap` entrypoint with breakpoints, variable inspection, call stack navigation, and step debugging.
232
+ - **Document Formatter & Linter**: Integrated source formatting and static analysis directly within VS Code.
233
+ - **Official Documentation Website (`docs/`)**:
234
+ - Full modern interactive documentation, language guide, interactive comparison tables, keyword glossary, and real-world examples.
235
+
236
+
237
+ ---
238
+
239
+ ## Real Multi-File Projects
240
+
241
+ Hinglish provides first-class support for multi-file modular architectures:
242
+
243
+ ```text
244
+ my_project/
245
+ ├── config.hin # App constants and configuration
246
+ ├── utils.hin # Helper functions and formatting
247
+ ├── models.hin # Data classes and models
248
+ ├── services.hin # Business logic & async operations
249
+ └── main.hin # Project entrypoint
250
+ ```
251
+
252
+ ### Module Resolution Semantics
253
+ - **Executing Projects**: Run `hinglish /path/to/project/main.hin` from **any** working directory.
254
+ - **Working Directory Independence**: Hinglish automatically sets `sys.path[0]` to the directory of the executed script, so relative `.hin` imports (`laao utils`, `se models laao Product`) resolve cleanly regardless of your current working directory.
255
+ - **Nested & Inter-Module Imports**: A module (`models.hin`) can import another sibling module (`utils.hin`) without needing complex packaging configuration.
256
+ - **Source-Mapped Multi-File Tracebacks**: When an exception occurs inside an imported `.hin` module, Hinglish renders a full traceback showing every `.hin` file name, exact line number, and original code snippet.
257
+ - **Python Interoperability**: Hinglish seamlessly imports Python standard library modules (`se datetime laao datetime`, `se json laao dumps`), and Python scripts can import `.hin` files via `hinglish.runtime.install_import_hook()`.
258
+
259
+ ### Exit Codes
260
+ - `0`: Successful execution, version display, help display, or clean REPL exit.
261
+ - `1`: Program execution error (syntax errors, compiler errors, runtime exceptions, missing file, or source overwrite safety violation).
262
+ - `2`: CLI argument usage error (unrecognized flags, missing file argument for subcommands).
263
+
264
+
@@ -0,0 +1,30 @@
1
+ """Hinglish Programming Language Package.
2
+
3
+ A Python-compatible programming language interface using Hinglish/Hindi-style syntax.
4
+ """
5
+
6
+ __version__ = "1.1.0"
7
+ __author__ = "Neeraj Yadav"
8
+
9
+ from .compiler import compile
10
+ from .formatter import format_source
11
+ from .keywords import DEFAULT_KEYWORD_REGISTRY, KeywordRegistry
12
+ from .lexer import tokenize
13
+ from .linter import lint_source
14
+ from .parser import parse
15
+ from .runtime import HinglishREPL, run, run_file, start_repl
16
+
17
+ __all__ = [
18
+ "DEFAULT_KEYWORD_REGISTRY",
19
+ "KeywordRegistry",
20
+ "HinglishREPL",
21
+ "compile",
22
+ "format_source",
23
+ "lint_source",
24
+ "parse",
25
+ "run",
26
+ "run_file",
27
+ "start_repl",
28
+ "tokenize",
29
+ "__version__",
30
+ ]
@@ -0,0 +1,7 @@
1
+ """Top-level executable module for python -m hinglish."""
2
+
3
+ import sys
4
+ from .cli import main
5
+
6
+ if __name__ == "__main__":
7
+ sys.exit(main())