indlan 0.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.
indlan-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bhavya S Solanki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
indlan-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: indlan
3
+ Version: 0.1.0
4
+ Summary: IndLan - a Hindi-inspired programming language implemented in Python
5
+ Author: Bhavya S Solanki
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/yourusername/indlan
8
+ Project-URL: Bug Tracker, https://github.com/yourusername/indlan/issues
9
+ Keywords: indlan,programming-language,interpreter,hindi,hinglish,education
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Education
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Software Development :: Interpreters
17
+ Classifier: Topic :: Education
18
+ Classifier: Natural Language :: Hindi
19
+ Classifier: Operating System :: OS Independent
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # IndLan
26
+
27
+ IndLan is a small Hindi-inspired programming language, implemented as a
28
+ tree-walking interpreter in pure Python. It supports familiar constructs
29
+ (variables, functions, conditionals, loops, classes) using either
30
+ English keywords or their Hindi-style aliases (e.g. `maano` for `let`,
31
+ `agar` for `if`, `jabtak` for `while`).
32
+
33
+ Made by Bhavya S Solanki.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install indlan
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Run a `.ind` file:
44
+
45
+ ```bash
46
+ indlan myprogram.ind
47
+ ```
48
+
49
+ Start an interactive REPL:
50
+
51
+ ```bash
52
+ indlan
53
+ ```
54
+
55
+ Launch the desktop IDE (Tkinter-based code editor):
56
+
57
+ ```bash
58
+ indlan-ide
59
+ ```
60
+
61
+ Check the version:
62
+
63
+ ```bash
64
+ indlan --version
65
+ ```
66
+
67
+ ## Example
68
+
69
+ ```
70
+ maano naam = "Duniya"
71
+ kaam namaste(naam) {
72
+ vapas "Namaste, " + naam + "!"
73
+ }
74
+ print(namaste(naam))
75
+ ```
76
+
77
+ ## License
78
+
79
+ MIT
indlan-0.1.0/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # IndLan
2
+
3
+ IndLan is a small Hindi-inspired programming language, implemented as a
4
+ tree-walking interpreter in pure Python. It supports familiar constructs
5
+ (variables, functions, conditionals, loops, classes) using either
6
+ English keywords or their Hindi-style aliases (e.g. `maano` for `let`,
7
+ `agar` for `if`, `jabtak` for `while`).
8
+
9
+ Made by Bhavya S Solanki.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install indlan
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Run a `.ind` file:
20
+
21
+ ```bash
22
+ indlan myprogram.ind
23
+ ```
24
+
25
+ Start an interactive REPL:
26
+
27
+ ```bash
28
+ indlan
29
+ ```
30
+
31
+ Launch the desktop IDE (Tkinter-based code editor):
32
+
33
+ ```bash
34
+ indlan-ide
35
+ ```
36
+
37
+ Check the version:
38
+
39
+ ```bash
40
+ indlan --version
41
+ ```
42
+
43
+ ## Example
44
+
45
+ ```
46
+ maano naam = "Duniya"
47
+ kaam namaste(naam) {
48
+ vapas "Namaste, " + naam + "!"
49
+ }
50
+ print(namaste(naam))
51
+ ```
52
+
53
+ ## License
54
+
55
+ MIT
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "indlan"
7
+ version = "0.1.0"
8
+ description = "IndLan - a Hindi-inspired programming language implemented in Python"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Bhavya S Solanki" }
15
+ ]
16
+ keywords = ["indlan", "programming-language", "interpreter", "hindi", "hinglish", "education"]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Developers",
21
+ "Intended Audience :: Education",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Topic :: Software Development :: Interpreters",
25
+ "Topic :: Education",
26
+ "Natural Language :: Hindi",
27
+ "Operating System :: OS Independent",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/yourusername/indlan"
32
+ "Bug Tracker" = "https://github.com/yourusername/indlan/issues"
33
+
34
+ [project.scripts]
35
+ indlan = "indlan.cli:main"
36
+ indlan-ide = "indlan.ide:main"
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["src"]
40
+
41
+ [tool.setuptools.package-data]
42
+ indlan = ["examples/*.ind", "*.png", "*.ico"]
indlan-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,21 @@
1
+ """
2
+ IndLan - A Hindi-inspired programming language, implemented in Python.
3
+
4
+ Made by Bhavya S Solanki.
5
+ """
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ from .lexer import tokenize, LexError
10
+ from .ind_parser import parse, ParseError
11
+ from .interpreter import Interpreter, IndLanRuntimeError
12
+
13
+ __all__ = [
14
+ "tokenize",
15
+ "LexError",
16
+ "parse",
17
+ "ParseError",
18
+ "Interpreter",
19
+ "IndLanRuntimeError",
20
+ "__version__",
21
+ ]
@@ -0,0 +1,181 @@
1
+ class Node:
2
+ pass
3
+
4
+
5
+ # ---------- Expressions ----------
6
+
7
+ class NumberLit(Node):
8
+ def __init__(self, value, line):
9
+ self.value = value
10
+ self.line = line
11
+
12
+ class StringLit(Node):
13
+ def __init__(self, value, line):
14
+ self.value = value
15
+ self.line = line
16
+
17
+ class FStringLit(Node):
18
+ """f"hello {name}" — parts is list of ("str", text) | ("expr", expr_source)"""
19
+ def __init__(self, parts, line):
20
+ self.parts = parts
21
+ self.line = line
22
+
23
+ class BoolLit(Node):
24
+ def __init__(self, value, line):
25
+ self.value = value
26
+ self.line = line
27
+
28
+ class NullLit(Node):
29
+ def __init__(self, line):
30
+ self.line = line
31
+
32
+ class ListLit(Node):
33
+ def __init__(self, elements, line):
34
+ self.elements = elements
35
+ self.line = line
36
+
37
+ class DictLit(Node):
38
+ def __init__(self, pairs, line):
39
+ self.pairs = pairs # list of (key_node, value_node)
40
+ self.line = line
41
+
42
+ class Identifier(Node):
43
+ def __init__(self, name, line):
44
+ self.name = name
45
+ self.line = line
46
+
47
+ class BinOp(Node):
48
+ def __init__(self, op, left, right, line):
49
+ self.op = op
50
+ self.left = left
51
+ self.right = right
52
+ self.line = line
53
+
54
+ class UnaryOp(Node):
55
+ def __init__(self, op, operand, line):
56
+ self.op = op
57
+ self.operand = operand
58
+ self.line = line
59
+
60
+ class LogicalOp(Node):
61
+ def __init__(self, op, left, right, line):
62
+ self.op = op
63
+ self.left = left
64
+ self.right = right
65
+ self.line = line
66
+
67
+ class Assign(Node):
68
+ def __init__(self, target, value, line, op="="):
69
+ self.target = target
70
+ self.value = value
71
+ self.op = op
72
+ self.line = line
73
+
74
+ class Call(Node):
75
+ def __init__(self, callee, args, line):
76
+ self.callee = callee
77
+ self.args = args
78
+ self.line = line
79
+
80
+ class Index(Node):
81
+ def __init__(self, obj, index, line):
82
+ self.obj = obj
83
+ self.index = index
84
+ self.line = line
85
+
86
+ class GetAttr(Node):
87
+ def __init__(self, obj, name, line):
88
+ self.obj = obj
89
+ self.name = name
90
+ self.line = line
91
+
92
+ class FunctionExpr(Node):
93
+ """Anonymous function (used internally for fun declarations too)."""
94
+ def __init__(self, params, body, line, name=None):
95
+ self.params = params
96
+ self.body = body
97
+ self.line = line
98
+ self.name = name
99
+
100
+
101
+ # ---------- Statements ----------
102
+
103
+ class LetStmt(Node):
104
+ def __init__(self, name, value, line):
105
+ self.name = name
106
+ self.value = value
107
+ self.line = line
108
+
109
+ class ExprStmt(Node):
110
+ def __init__(self, expr, line):
111
+ self.expr = expr
112
+ self.line = line
113
+
114
+ class Block(Node):
115
+ def __init__(self, statements, line):
116
+ self.statements = statements
117
+ self.line = line
118
+
119
+ class IfStmt(Node):
120
+ def __init__(self, branches, else_block, line):
121
+ # branches: list of (condition, block)
122
+ self.branches = branches
123
+ self.else_block = else_block
124
+ self.line = line
125
+
126
+ class WhileStmt(Node):
127
+ def __init__(self, condition, body, line):
128
+ self.condition = condition
129
+ self.body = body
130
+ self.line = line
131
+
132
+ class DoWhileStmt(Node):
133
+ def __init__(self, body, condition, line):
134
+ self.body = body
135
+ self.condition = condition
136
+ self.line = line
137
+
138
+ class SwitchStmt(Node):
139
+ def __init__(self, subject, cases, default_block, line):
140
+ # cases: list of (value_expr, block)
141
+ self.subject = subject
142
+ self.cases = cases
143
+ self.default_block = default_block
144
+ self.line = line
145
+
146
+ class ForStmt(Node):
147
+ def __init__(self, var_name, iterable, body, line):
148
+ self.var_name = var_name
149
+ self.iterable = iterable
150
+ self.body = body
151
+ self.line = line
152
+
153
+ class FunDecl(Node):
154
+ def __init__(self, name, params, body, line):
155
+ self.name = name
156
+ self.params = params
157
+ self.body = body
158
+ self.line = line
159
+
160
+ class ReturnStmt(Node):
161
+ def __init__(self, value, line):
162
+ self.value = value
163
+ self.line = line
164
+
165
+ class BreakStmt(Node):
166
+ def __init__(self, line):
167
+ self.line = line
168
+
169
+ class ContinueStmt(Node):
170
+ def __init__(self, line):
171
+ self.line = line
172
+
173
+ class ClassDecl(Node):
174
+ def __init__(self, name, methods, line):
175
+ self.name = name
176
+ self.methods = methods # list of FunDecl
177
+ self.line = line
178
+
179
+ class Program(Node):
180
+ def __init__(self, statements):
181
+ self.statements = statements
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ IndLan - A programming language implemented in Python.
4
+
5
+ Usage:
6
+ indlan myprogram.ind # run a file
7
+ indlan # start REPL
8
+ indlan --version # show version
9
+ """
10
+
11
+ import sys
12
+ import os
13
+
14
+ from . import __version__
15
+ from .lexer import tokenize, LexError
16
+ from .ind_parser import parse, ParseError
17
+ from .interpreter import Interpreter, IndLanRuntimeError
18
+
19
+
20
+ def print_banner():
21
+ lines = [
22
+ "Welcome to IndLan",
23
+ "Made by Bhavya S Solanki",
24
+ ]
25
+ width = max(len(line) for line in lines) + 4
26
+ top = "+" + "-" * (width - 2) + "+"
27
+ print(top)
28
+ for line in lines:
29
+ padding = width - 2 - len(line)
30
+ left = padding // 2
31
+ right = padding - left
32
+ print("|" + " " * left + line + " " * right + "|")
33
+ print(top)
34
+
35
+
36
+ def run_source(source, interpreter):
37
+ try:
38
+ tokens = tokenize(source)
39
+ program = parse(tokens)
40
+ interpreter.run(program)
41
+ except LexError as e:
42
+ print(e, file=sys.stderr)
43
+ except ParseError as e:
44
+ print(e, file=sys.stderr)
45
+ except IndLanRuntimeError as e:
46
+ print(e, file=sys.stderr)
47
+
48
+
49
+ def run_file(path):
50
+ if not os.path.exists(path):
51
+ print(f"IndLan: file not found: {path}", file=sys.stderr)
52
+ sys.exit(1)
53
+ print_banner()
54
+ with open(path, "r", encoding="utf-8") as f:
55
+ source = f.read()
56
+ interpreter = Interpreter()
57
+ run_source(source, interpreter)
58
+
59
+
60
+ def repl():
61
+ print_banner()
62
+ print("IndLan REPL (type 'exit' to quit)")
63
+ interpreter = Interpreter()
64
+ while True:
65
+ try:
66
+ line = input("indlan> ")
67
+ except (EOFError, KeyboardInterrupt):
68
+ print()
69
+ break
70
+ if line.strip() in ("exit", "quit"):
71
+ break
72
+ if not line.strip():
73
+ continue
74
+ run_source(line, interpreter)
75
+
76
+
77
+ def main():
78
+ args = sys.argv[1:]
79
+ if args and args[0] in ("-v", "--version"):
80
+ print(f"IndLan {__version__}")
81
+ return
82
+ if args and args[0] in ("-h", "--help"):
83
+ print(__doc__)
84
+ return
85
+ if args:
86
+ run_file(args[0])
87
+ else:
88
+ repl()
89
+
90
+
91
+ if __name__ == "__main__":
92
+ main()
@@ -0,0 +1,70 @@
1
+ // IndLan Hindi keyword test - agar/nahito, jabtak, pratyek, karo-jabtak, vibhag
2
+
3
+ maano umar = 20
4
+
5
+ agar umar < 13 {
6
+ chhap("Bachha ho")
7
+ } nahito_agar umar < 20 {
8
+ chhap("Teenager ho")
9
+ } nahito {
10
+ chhap("Adult ho")
11
+ }
12
+
13
+ chhap("== jabtak loop ==")
14
+ maano i = 0
15
+ jabtak i < 5 {
16
+ chhap("i =", i)
17
+ i += 1
18
+ }
19
+
20
+ chhap("== pratyek loop ==")
21
+ pratyek n mein range(5) {
22
+ agar n == 3 {
23
+ jaari
24
+ }
25
+ chhap("n =", n)
26
+ }
27
+
28
+ chhap("== karo-jabtak (do-while) ==")
29
+ maano j = 0
30
+ karo {
31
+ chhap("j =", j)
32
+ j += 1
33
+ } jabtak j < 3
34
+
35
+ chhap("== vibhag (switch) ==")
36
+ maano din = 3
37
+ vibhag din {
38
+ sthiti 1 {
39
+ chhap("Somvaar")
40
+ }
41
+ sthiti 2 {
42
+ chhap("Mangalvaar")
43
+ }
44
+ sthiti 3 {
45
+ chhap("Budhvaar")
46
+ }
47
+ anyatha {
48
+ chhap("Pata nahi")
49
+ }
50
+ }
51
+
52
+ chhap("== function aur class ==")
53
+ kaam jodo(a, b) {
54
+ vapas a + b
55
+ }
56
+ chhap("jodo(4, 5) =", jodo(4, 5))
57
+
58
+ varg Animal {
59
+ kaam init(naam, awaaz) {
60
+ yeh.naam = naam
61
+ yeh.awaaz = awaaz
62
+ }
63
+ kaam bolo() {
64
+ chhap(yeh.naam, "bolta hai", yeh.awaaz)
65
+ }
66
+ }
67
+ maano kutta = naya Animal("Kutta", "Bhow")
68
+ kutta.bolo()
69
+
70
+ chhap("Sab kaam ho gaya!")
@@ -0,0 +1,24 @@
1
+ // if / elif / else example in IndLan
2
+
3
+ let age = 20
4
+
5
+ if age < 13 {
6
+ print("You are a child")
7
+ } elif age < 20 {
8
+ print("You are a teenager")
9
+ } else {
10
+ print("You are an adult")
11
+ }
12
+
13
+ // another example with score grading
14
+ let score = 75
15
+
16
+ if score >= 90 {
17
+ print("Grade: A")
18
+ } elif score >= 75 {
19
+ print("Grade: B")
20
+ } elif score >= 50 {
21
+ print("Grade: C")
22
+ } else {
23
+ print("Grade: F")
24
+ }
@@ -0,0 +1,97 @@
1
+ // IndLan - New Features Showcase
2
+ // ================================
3
+
4
+ // 1. Exponentiation (**)
5
+ print("== Exponentiation ==")
6
+ let base = 2
7
+ let power = 10
8
+ print(f"{base} ** {power} = {base ** power}")
9
+ print("3 ** 3 =", 3 ** 3)
10
+
11
+ // 2. F-strings
12
+ print("\n== F-strings ==")
13
+ let name = "Bhavya"
14
+ let age = 17
15
+ print(f"Hello {name}, you are {age} years old!")
16
+ print(f"Next year you will be {age + 1}.")
17
+ maano dost = "Rahul"
18
+ chhap(f"Namaste {dost}! Kya haal hai?")
19
+
20
+ // 3. input_int / input_float / input_bool / char
21
+ // (uncomment to test interactively)
22
+ // let n = input_int("Enter a number: ")
23
+ // print(f"You entered: {n}, doubled: {n * 2}")
24
+ // let b = input_bool("Are you happy? (true/false): ")
25
+ // print(f"Happy: {b}")
26
+
27
+ // 4. bool() and char()
28
+ print("\n== bool() and char() ==")
29
+ print("bool(0) =", bool(0))
30
+ print("bool(42) =", bool(42))
31
+ print("bool(\"\") =", bool(""))
32
+ print("bool(\"hi\") =", bool("hi"))
33
+ print("char(65) =", char(65))
34
+ print("char(97) =", char(97))
35
+ print("char('Z') =", char("Z"))
36
+
37
+ // 5. Math builtins
38
+ print("\n== Math ==")
39
+ print("abs(-42) =", abs(-42))
40
+ print("sqrt(144) =", sqrt(144))
41
+ print("floor(3.9) =", floor(3.9))
42
+ print("ceil(3.1) =", ceil(3.1))
43
+ print("round(3.567, 2) =", round(3.567, 2))
44
+ print("max(1, 9, 3) =", max(1, 9, 3))
45
+ print("min([5, 2, 8]) =", min([5, 2, 8]))
46
+
47
+ // 6. String methods
48
+ print("\n== String Methods ==")
49
+ let s = " Hello, IndLan World! "
50
+ print(s.strip())
51
+ print(s.strip().lower())
52
+ print(s.strip().upper())
53
+ print(s.strip().replace("World", "India"))
54
+ print(s.strip().startswith("Hello"))
55
+ print(s.strip().endswith("!"))
56
+ let words = "apple,banana,cherry"
57
+ let parts = words.split(",")
58
+ print("split:", parts)
59
+ print("find 'banana':", words.find("banana"))
60
+
61
+ // 7. List methods
62
+ print("\n== List Methods ==")
63
+ let nums = [5, 3, 8, 1, 4]
64
+ sort(nums)
65
+ print("sorted:", nums)
66
+ reverse(nums)
67
+ print("reversed:", nums)
68
+ insert(nums, 0, 100)
69
+ print("after insert(0, 100):", nums)
70
+ remove(nums, 100)
71
+ print("after remove(100):", nums)
72
+ print("has(nums, 8):", has(nums, 8))
73
+ print("has(nums, 99):", has(nums, 99))
74
+
75
+ // 8. String repetition and negative index
76
+ print("\n== String repeat & negative index ==")
77
+ print("ha" * 4)
78
+ let arr = [10, 20, 30, 40, 50]
79
+ print("arr[-1] =", arr[-1])
80
+ print("arr[-2] =", arr[-2])
81
+
82
+ // 9. type()
83
+ print("\n== type() ==")
84
+ print(type(42))
85
+ print(type(3.14))
86
+ print(type("hello"))
87
+ print(type(true))
88
+ print(type([1, 2]))
89
+ print(type({"a": 1}))
90
+ print(type(null))
91
+
92
+ // 10. has() on dict and string
93
+ print("\n== has() on dicts and strings ==")
94
+ let d = {"x": 1, "y": 2}
95
+ print("has(d, 'x'):", has(d, "x"))
96
+ print("has(d, 'z'):", has(d, "z"))
97
+ print("has('IndLan', 'Lan'):", has("IndLan", "Lan"))