techscript 1.0.3__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 (30) hide show
  1. techscript-1.0.3/LICENSE +21 -0
  2. techscript-1.0.3/PKG-INFO +510 -0
  3. techscript-1.0.3/README.md +482 -0
  4. techscript-1.0.3/pyproject.toml +41 -0
  5. techscript-1.0.3/setup.cfg +4 -0
  6. techscript-1.0.3/setup.py +57 -0
  7. techscript-1.0.3/src/techscript/__init__.py +2 -0
  8. techscript-1.0.3/src/techscript/__main__.py +5 -0
  9. techscript-1.0.3/src/techscript/ast_nodes.py +239 -0
  10. techscript-1.0.3/src/techscript/builtins.py +298 -0
  11. techscript-1.0.3/src/techscript/cli.py +190 -0
  12. techscript-1.0.3/src/techscript/environment.py +75 -0
  13. techscript-1.0.3/src/techscript/errors.py +153 -0
  14. techscript-1.0.3/src/techscript/interpreter.py +674 -0
  15. techscript-1.0.3/src/techscript/lexer.py +336 -0
  16. techscript-1.0.3/src/techscript/parser.py +637 -0
  17. techscript-1.0.3/src/techscript/repl.py +86 -0
  18. techscript-1.0.3/src/techscript/tokens.py +132 -0
  19. techscript-1.0.3/src/techscript/transpiler.py +290 -0
  20. techscript-1.0.3/src/techscript/web.py +143 -0
  21. techscript-1.0.3/src/techscript.egg-info/PKG-INFO +510 -0
  22. techscript-1.0.3/src/techscript.egg-info/SOURCES.txt +28 -0
  23. techscript-1.0.3/src/techscript.egg-info/dependency_links.txt +1 -0
  24. techscript-1.0.3/src/techscript.egg-info/entry_points.txt +2 -0
  25. techscript-1.0.3/src/techscript.egg-info/requires.txt +6 -0
  26. techscript-1.0.3/src/techscript.egg-info/top_level.txt +1 -0
  27. techscript-1.0.3/tests/test_interpreter.py +249 -0
  28. techscript-1.0.3/tests/test_lexer.py +147 -0
  29. techscript-1.0.3/tests/test_parser.py +184 -0
  30. techscript-1.0.3/tests/test_transpiler.py +58 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TechScript Team
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.
@@ -0,0 +1,510 @@
1
+ Metadata-Version: 2.4
2
+ Name: techscript
3
+ Version: 1.0.3
4
+ Summary: TechScript โ€” A simple, friendly programming language (.txs)
5
+ Author: TechScript Team
6
+ License: MIT
7
+ Keywords: programming-language,interpreter,transpiler,techscript
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Software Development :: Interpreters
15
+ Classifier: Topic :: Software Development :: Compilers
16
+ Classifier: Intended Audience :: Education
17
+ Classifier: Intended Audience :: Developers
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: pytest-cov; extra == "dev"
24
+ Requires-Dist: black; extra == "dev"
25
+ Requires-Dist: flake8; extra == "dev"
26
+ Dynamic: license-file
27
+ Dynamic: requires-python
28
+
29
+ # ๐Ÿ‰ TechScript
30
+
31
+ <p align="center">
32
+ <img src="assets/logo.png" alt="TechScript Dragon Logo" width="220">
33
+ </p>
34
+
35
+ <p align="center">
36
+ <strong>A friendly programming language that reads like plain English โ€” and now builds websites too!</strong>
37
+ </p>
38
+
39
+ <p align="center">
40
+ <img src="https://img.shields.io/badge/version-v1.0.1-7c3aed?style=flat-square">
41
+ <img src="https://img.shields.io/badge/python-3.10%2B-blue?style=flat-square">
42
+ <img src="https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-green?style=flat-square">
43
+ <img src="https://img.shields.io/badge/license-MIT-orange?style=flat-square">
44
+ </p>
45
+
46
+ ---
47
+
48
+ ## ๐Ÿค” What is TechScript? (Explain Like I'm 10)
49
+
50
+ Imagine you want to tell a computer to do something. Normally, computers only understand confusing code like this:
51
+
52
+ ```javascript
53
+ const x = document.getElementById('name');
54
+ if (x !== null && x.value.length > 0) { ... }
55
+ ```
56
+
57
+ **TechScript makes that feel like writing a sentence:**
58
+
59
+ ```
60
+ make name = ask "What is your name? "
61
+ say f"Hello, {name}!"
62
+ ```
63
+
64
+ That's it. **No semicolons. No brackets. No confusing symbols.** Just simple words that make sense.
65
+
66
+ TechScript is:
67
+ - ๐ŸŸข **A programming language** โ€” you can write code that runs on your computer
68
+ - ๐ŸŒ **A web builder** โ€” you can build full websites with it (no HTML or CSS needed!)
69
+ - ๐Ÿ **Powered by Python** โ€” works on any computer that has Python installed
70
+ - ๐Ÿ“ฆ **One command** โ€” `tech run yourfile.txs` and your program runs instantly
71
+
72
+ ---
73
+
74
+ ## ๐Ÿš€ What Can TechScript Do?
75
+
76
+ | What you want to do | TechScript can do it? |
77
+ |---|---|
78
+ | Print text to screen | โœ… `say "Hello!"` |
79
+ | Ask the user a question | โœ… `make answer = ask "Your name? "` |
80
+ | Do math | โœ… `say 10 + 5 * 2` |
81
+ | Make decisions | โœ… `when age > 18 { say "Adult" }` |
82
+ | Loop (repeat stuff) | โœ… `each i in 1..10 { say i }` |
83
+ | Make functions (reusable code) | โœ… `build greet(name) { say f"Hi {name}!" }` |
84
+ | Make classes/objects | โœ… `model Dog { ... }` |
85
+ | Handle errors | โœ… `attempt { ... } catch err { ... }` |
86
+ | Build a website | โœ… `use web` + `page.run()` |
87
+ | Replace HTML | โœ… `page.h1("Title")`, `page.div([...])` |
88
+ | Replace CSS | โœ… `page.style("body", { "color": "white" })` |
89
+ | Replace JavaScript | โœ… `page.script("function hello() {...}")` |
90
+ | Replace React/Vue | โœ… Built-in state management via JS in `page.script()` |
91
+
92
+ ---
93
+
94
+ ## ๐ŸชŸ Install on Windows (Easy โ€” No Terminal Needed!)
95
+
96
+ ### Option 1: One-Click Installer (Recommended for Beginners)
97
+
98
+ 1. Go to the [๐Ÿ“ฅ Releases page](../../releases/latest)
99
+ 2. Download **`TechScript-Setup.exe`**
100
+ 3. Double-click it โ€” it will install everything automatically!
101
+ 4. Open **PowerShell** (press `Win + X` โ†’ "Windows PowerShell") and type:
102
+
103
+ ```
104
+ tech version
105
+ ```
106
+
107
+ You should see: `TechScript v1.0.1` ๐ŸŽ‰
108
+
109
+ **What the installer does automatically:**
110
+ - โœ… Puts `tech.exe` on your computer
111
+ - โœ… Makes the `tech` command available everywhere in your terminal
112
+ - โœ… Registers `.txs` files so they know they belong to TechScript
113
+ - โœ… Installs the VS Code extension for syntax highlighting
114
+
115
+ ### Option 2: Using pip (If you already have Python)
116
+
117
+ ```powershell
118
+ pip install techscript
119
+ ```
120
+
121
+ ---
122
+
123
+ ## ๐Ÿง Install on Linux (Ubuntu, Kali, Arch, etc.)
124
+
125
+ ### Super Simple โ€” Just paste this in your terminal:
126
+
127
+ ```bash
128
+ curl -fsSL https://raw.githubusercontent.com/Tcode-Moti/TechScript/main/scripts/install.sh | bash
129
+ ```
130
+
131
+ **Or manually:**
132
+
133
+ ```bash
134
+ # Step 1: Make sure Python 3.10+ is installed
135
+ python3 --version
136
+
137
+ # Step 2: Install TechScript
138
+ pip3 install techscript
139
+
140
+ # Step 3: Test it
141
+ tech version
142
+ ```
143
+
144
+ ---
145
+
146
+ ## ๐ŸŽ Install on macOS
147
+
148
+ ```bash
149
+ # If you have Homebrew and Python:
150
+ pip3 install techscript
151
+
152
+ # OR use the one-line installer:
153
+ curl -fsSL https://raw.githubusercontent.com/Tcode-Moti/TechScript/main/scripts/install.sh | bash
154
+ ```
155
+
156
+ ---
157
+
158
+ ## ๐Ÿ“ฑ Install on Android (Termux)
159
+
160
+ ```bash
161
+ pkg install python
162
+ pip install techscript
163
+ tech version
164
+ ```
165
+
166
+ ---
167
+
168
+ ## โœ๏ธ Your First TechScript Program
169
+
170
+ Create a new file called `hello.txs` (you can use Notepad, VS Code, or any text editor):
171
+
172
+ ```
173
+ # This is a comment โ€” the computer ignores it
174
+ # The 'say' keyword means "print this to the screen"
175
+
176
+ say "Hello, World!"
177
+ say "I am learning TechScript!"
178
+ say "It is very easy to read ๐Ÿ˜Š"
179
+ ```
180
+
181
+ Now run it:
182
+ ```
183
+ tech run hello.txs
184
+ ```
185
+
186
+ **Output:**
187
+ ```
188
+ Hello, World!
189
+ I am learning TechScript!
190
+ It is very easy to read ๐Ÿ˜Š
191
+ ```
192
+
193
+ ---
194
+
195
+ ## ๐Ÿ“– Language Guide (With Explanations for Beginners)
196
+
197
+ ### ๐Ÿ“ฆ Variables โ€” Storing Information
198
+
199
+ A variable is like a box where you put something to use later.
200
+
201
+ ```
202
+ # 'make' creates a new box called 'name' and puts "Alice" inside
203
+ make name = "Alice"
204
+
205
+ # 'keep' creates a CONSTANT โ€” a box you can NEVER change
206
+ keep PI = 3.14159
207
+
208
+ # You can store numbers, text, lists, anything!
209
+ make age = 25
210
+ make items = [1, 2, 3, 4, 5] # A list (like a shopping list)
211
+ make info = { "city": "Delhi" } # A dictionary (like a phone book)
212
+ ```
213
+
214
+ ---
215
+
216
+ ### ๐Ÿ–จ๏ธ Output โ€” Talking to the User
217
+
218
+ ```
219
+ say "Hello!" # Prints: Hello!
220
+ say "Name:", name # Prints: Name: Alice
221
+ say f"My name is {name}!" # f-strings insert variables: My name is Alice!
222
+ say 10 + 5 # Prints: 15
223
+ ```
224
+
225
+ ---
226
+
227
+ ### ๐Ÿ’ฌ Input โ€” Asking the User a Question
228
+
229
+ ```
230
+ make name = ask "What is your name? "
231
+ say f"Nice to meet you, {name}!"
232
+ ```
233
+
234
+ When run, it pauses and waits for the user to type something.
235
+
236
+ ---
237
+
238
+ ### ๐Ÿ”€ Conditions โ€” Making Decisions
239
+
240
+ Think of this like: "IF this is true, do that. Otherwise, do this other thing."
241
+
242
+ ```
243
+ make age = 20
244
+
245
+ when age >= 18 {
246
+ say "You are an adult!"
247
+ } or when age >= 13 {
248
+ say "You are a teenager!"
249
+ } else {
250
+ say "You are a child!"
251
+ }
252
+ ```
253
+
254
+ ---
255
+
256
+ ### ๐Ÿ” Loops โ€” Doing Things Repeatedly
257
+
258
+ **`each` loop** โ€” do something for every item in a list:
259
+
260
+ ```
261
+ # Count from 1 to 5
262
+ each i in 1..5 {
263
+ say f"Count: {i}"
264
+ }
265
+
266
+ # Go through each item in a list
267
+ each fruit in ["apple", "banana", "mango"] {
268
+ say f"I like {fruit}!"
269
+ }
270
+ ```
271
+
272
+ **`repeat` loop** โ€” keep doing something while a condition is true:
273
+
274
+ ```
275
+ make x = 1
276
+ repeat x <= 5 {
277
+ say x
278
+ x = x + 1
279
+ }
280
+ ```
281
+
282
+ ---
283
+
284
+ ### ๐Ÿ”ง Functions โ€” Reusable Code Blocks
285
+
286
+ A function is a piece of code you write once and can use many times.
287
+
288
+ ```
289
+ # 'build' creates a function. 'name' is the input it receives.
290
+ build greet(name, greeting = "Hello") {
291
+ say f"{greeting}, {name}!"
292
+ }
293
+
294
+ # Call the function:
295
+ greet("Alice") # Prints: Hello, Alice!
296
+ greet("Bob", "Hi there") # Prints: Hi there, Bob!
297
+ greet("Charlie", "Hey") # Prints: Hey, Charlie!
298
+ ```
299
+
300
+ ---
301
+
302
+ ### ๐Ÿ—๏ธ Classes โ€” Blueprints for Objects
303
+
304
+ A class is like a blueprint for creating things (called objects).
305
+
306
+ ```
307
+ # Define what a "Dog" is
308
+ model Dog {
309
+ build init(self, name, breed) {
310
+ self.name = name # Every dog has a name
311
+ self.breed = breed # Every dog has a breed
312
+ }
313
+ build speak(self) {
314
+ say f"{self.name} says: Woof! Woof!"
315
+ }
316
+ build info(self) {
317
+ say f"{self.name} is a {self.breed}"
318
+ }
319
+ }
320
+
321
+ # Create two dogs (two "objects" from the Dog blueprint)
322
+ make rex = Dog("Rex", "German Shepherd")
323
+ make buddy = Dog("Buddy", "Golden Retriever")
324
+
325
+ rex.speak() # Rex says: Woof! Woof!
326
+ rex.info() # Rex is a German Shepherd
327
+ buddy.speak() # Buddy says: Woof! Woof!
328
+ ```
329
+
330
+ ---
331
+
332
+ ### โš ๏ธ Error Handling โ€” Catching Mistakes Gracefully
333
+
334
+ What if something goes wrong? Instead of crashing, you can handle it:
335
+
336
+ ```
337
+ attempt {
338
+ # Try to do this risky thing
339
+ make result = 10 / 0 # Division by zero!
340
+ } catch err {
341
+ # If anything goes wrong, come here instead of crashing
342
+ say f"Oops! Something went wrong: {err.message}"
343
+ }
344
+
345
+ say "Program continues normally after the error!"
346
+ ```
347
+
348
+ ---
349
+
350
+ ## ๐ŸŒ Building Websites with TechScript (New in v1.0.1!)
351
+
352
+ This is the most exciting feature โ€” you can build a **complete running website** using only TechScript. No HTML. No CSS. No JavaScript files. Just one `.txs` file!
353
+
354
+ ### How it works
355
+
356
+ 1. Write `use web` at the top โ€” this loads the web module
357
+ 2. Create a page with `make page = WebPage("My Title")`
358
+ 3. Add styling, content, and scripts
359
+ 4. Call `page.run()` โ€” your browser opens automatically! ๐Ÿš€
360
+
361
+ ### Simple Website Example
362
+
363
+ ```
364
+ use web
365
+
366
+ # Create a page with a title
367
+ make page = WebPage("My First Website")
368
+
369
+ # Add CSS styles (like a style sheet)
370
+ page.style("body", {
371
+ "background": "#0f0f11", # Dark background
372
+ "color": "#eeeeee", # White text
373
+ "font-family": "sans-serif", # Clean font
374
+ "text-align": "center",
375
+ "padding": "60px"
376
+ })
377
+
378
+ # Add JavaScript (for interactive buttons)
379
+ page.script("""
380
+ function sayHello() {
381
+ alert('Hello from TechScript! ๐Ÿ‰');
382
+ }
383
+ """)
384
+
385
+ # Build the page layout
386
+ page.body([
387
+ page.h1("Welcome to My Website! ๐Ÿ‰"),
388
+ page.p("This website was built 100% in TechScript."),
389
+ page.p("No HTML. No CSS files. No React. Just TechScript!"),
390
+ page.button("Click Me!", { "onclick": "sayHello()" })
391
+ ])
392
+
393
+ # Run the server โ€” browser opens automatically!
394
+ page.run()
395
+ ```
396
+
397
+ **Run it:**
398
+ ```
399
+ tech run my_website.txs
400
+ ```
401
+
402
+ That's it! Your browser opens and shows your website. Press `Ctrl+C` to stop the server.
403
+
404
+ ---
405
+
406
+ ## ๐Ÿ› ๏ธ All CLI Commands
407
+
408
+ | Command | What it does | Example |
409
+ |---|---|---|
410
+ | `tech run file.txs` | Run a TechScript file | `tech run hello.txs` |
411
+ | `tech run file.txs --debug` | Run with debug info | `tech run calc.txs --debug` |
412
+ | `tech check file.txs` | Check for errors without running | `tech check myapp.txs` |
413
+ | `tech repl` | Open interactive mode (type and run live) | `tech repl` |
414
+ | `tech transpile file.txs` | Convert your code to Python | `tech transpile hello.txs` |
415
+ | `tech version` or `tech -V` | Show installed version | `tech -V` |
416
+
417
+ ---
418
+
419
+ ## ๐Ÿ“‹ All Example Programs
420
+
421
+ Run any of these to see TechScript in action:
422
+
423
+ | File | What it does | Run it |
424
+ |---|---|---|
425
+ | `examples/hello.txs` | Prints Hello World | `tech run examples/hello.txs` |
426
+ | `examples/fibonacci.txs` | Calculates Fibonacci numbers | `tech run examples/fibonacci.txs` |
427
+ | `examples/fizzbuzz.txs` | The classic FizzBuzz challenge | `tech run examples/fizzbuzz.txs` |
428
+ | `examples/classes.txs` | Dogs and cats using OOP | `tech run examples/classes.txs` |
429
+ | `examples/calculator.txs` | Simple calculator | `tech run examples/calculator.txs` |
430
+ | `examples/guessing_game.txs` | Guess the number game | `tech run examples/guessing_game.txs` |
431
+ | `examples/web_app_simple.txs` | Simple dark-theme website | `tech run examples/web_app_simple.txs` |
432
+ | `examples/web_complete.txs` | Full showcase: counter, API, form | `tech run examples/web_complete.txs` |
433
+
434
+ ---
435
+
436
+ ## ๐ŸŽจ VS Code / Cursor Editor Extension
437
+
438
+ Get **syntax highlighting**, **code snippets**, and the **๐Ÿ‰ dragon file icon** for `.txs` files:
439
+
440
+ **Method 1 โ€” Command line (fastest):**
441
+ ```bash
442
+ code --install-extension vscode-extension/techscript-1.0.2.vsix
443
+ ```
444
+
445
+ **Method 2 โ€” Using the GUI:**
446
+ 1. Open VS Code
447
+ 2. Press `Ctrl+Shift+X` to open Extensions
448
+ 3. Click the `ยทยทยท` menu (top right of the Extensions panel)
449
+ 4. Select **"Install from VSIX..."**
450
+ 5. Choose `vscode-extension/techscript-1.0.2.vsix`
451
+
452
+ After installing, all your `.txs` files will have the dragon icon and coloured syntax! ๐ŸŽจ
453
+
454
+ ---
455
+
456
+ ## โœจ v1.0.1 Changelog โ€” What's New vs v1.0.0
457
+
458
+ | Feature | v1.0.0 | v1.0.1 |
459
+ |---|---|---|
460
+ | Basic scripting (say, make, loops) | โœ… | โœ… |
461
+ | Functions, classes, error handling | โœ… | โœ… |
462
+ | 80+ built-in functions | โœ… | โœ… |
463
+ | VS Code extension (syntax + icons) | โœ… | โœ… Updated to v1.0.2 |
464
+ | `use web` โ€” Build websites | โŒ | โœ… **NEW** |
465
+ | No HTML/CSS/JS needed | โŒ | โœ… **NEW** |
466
+ | Browser opens automatically | โŒ | โœ… **NEW** |
467
+ | Auto port selection (no conflicts) | โŒ | โœ… **NEW** |
468
+ | Windows one-click Setup.exe | โŒ | โœ… **NEW** |
469
+ | Mac/Linux one-line install script | โŒ | โœ… **NEW** |
470
+ | Auto PATH setup | โŒ | โœ… **NEW** |
471
+ | Reactive counter demo | โŒ | โœ… **NEW** |
472
+ | Live API fetch example | โŒ | โœ… **NEW** |
473
+ | Contact form example | โŒ | โœ… **NEW** |
474
+
475
+ ---
476
+
477
+ ## ๐Ÿ“š Documentation
478
+
479
+ | Document | Description |
480
+ |---|---|
481
+ | [Quick Start Guide](docs/QUICKSTART.md) | Simple step-by-step install for all platforms |
482
+ | [Language Cheat Sheet](docs/REFERENCE.md) | All keywords, functions, and syntax at a glance |
483
+ | [Web Module Guide](docs/WEB_MODULE.md) | How to build websites with TechScript |
484
+
485
+ ---
486
+
487
+ ## ๐ŸŒ Platform Support
488
+
489
+ | Platform | Status | Install Method |
490
+ |---|---|---|
491
+ | **Windows 10/11** | โœ… Fully supported | `TechScript-Setup.exe` or pip |
492
+ | **macOS** | โœ… Fully supported | `install.sh` or pip |
493
+ | **Linux** (Ubuntu, Kali, Arch) | โœ… Fully supported | `install.sh` or pip |
494
+ | **Android (Termux)** | โœ… Works | pip |
495
+
496
+ **Minimum requirement:** Python 3.10 or newer.
497
+
498
+ ---
499
+
500
+ ## ๐Ÿ“„ License
501
+
502
+ MIT License โ€” free to use, share, and modify. See [LICENSE](LICENSE).
503
+
504
+ ---
505
+
506
+ <p align="center">
507
+ <img src="assets/logo.png" alt="TechScript Dragon" width="80">
508
+ <br>
509
+ <strong>Made with ๐Ÿ‰ by the TechScript Team</strong>
510
+ </p>