Skip to content

Commit 9c4d618

Browse files
author
Tanmoy
committed
Pip Update v1.0.4.3 - Pre-installed examples and wrapper sync
1 parent 53e1b11 commit 9c4d618

52 files changed

Lines changed: 3030 additions & 10 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
recursive-include techscript_wrapper/examples *.txs
2+
include README.md
3+
include LICENSE
4+
recursive-include docs *.md

build/lib/techscript_wrapper/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import urllib.request
55
import subprocess
66

7-
VERSION = "1.0.2"
7+
VERSION = "1.0.4.3"
88
REPO = "Tcode-Motion/techscript"
99

1010
def download_binary():
@@ -14,7 +14,7 @@ def download_binary():
1414
# Define asset name based on OS Architecture
1515
asset_name = None
1616
if system == "windows":
17-
asset_name = "techscriptv1.0.2.exe"
17+
asset_name = "techscriptv1.0.4.3.exe"
1818
elif system == "linux":
1919
asset_name = "tech-linux-x64" # Placeholder for future linux release
2020
elif system == "darwin":
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
say "=== TechScript v1.0.2 Native VM Performance Benchmark ==="
2+
say "Running 1,000,000 iterations inside Rust Bytecode VM..."
3+
4+
make i = 0
5+
repeat i < 1000000 {
6+
i = i + 1
7+
}
8+
9+
say f"Completed 1 million iterations! Final loop count is: {i}"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ── TechScript v1.0.3 — Math Module Demo ──────────────
2+
# Run: tech run 08_math_module.txs
3+
4+
say "═══ Math Module Demo ═══"
5+
say ""
6+
7+
# ── Constants ──
8+
say f"π = {math.PI}"
9+
say f"e = {math.E}"
10+
say f"τ = {math.TAU}"
11+
say f"∞ = {math.INF}"
12+
13+
say ""
14+
15+
# ── Trigonometry ──
16+
say f"sin(π/2) = {math.sin(math.PI / 2)}"
17+
say f"cos(0) = {math.cos(0)}"
18+
say f"tan(π/4) = {math.tan(math.PI / 4)}"
19+
20+
say ""
21+
22+
# ── Power & Roots ──
23+
say f"sqrt(144) = {math.sqrt(144)}"
24+
say f"cbrt(27) = {math.cbrt(27)}"
25+
say f"pow(2,10) = {math.pow(2, 10)}"
26+
27+
say ""
28+
29+
# ── Logarithms ──
30+
say f"log(100) = {math.log(100)}"
31+
say f"log2(1024) = {math.log2(1024)}"
32+
say f"log10(10000) = {math.log10(10000)}"
33+
34+
say ""
35+
36+
# ── Integer Math ──
37+
say f"factorial(10) = {math.factorial(10)}"
38+
say f"gcd(48, 18) = {math.gcd(48, 18)}"
39+
say f"lcm(12, 8) = {math.lcm(12, 8)}"
40+
say f"fibonacci(10) = {math.fibonacci(10)}"
41+
42+
say ""
43+
44+
# ── Statistics ──
45+
make data = [10, 20, 30, 40, 50]
46+
say f"mean({data}) = {math.mean(data)}"
47+
say f"sum({data}) = {sum(data)}"
48+
say f"min({data}) = {min(data)}"
49+
say f"max({data}) = {max(data)}"
50+
51+
say ""
52+
say "Done! ✅"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ── TechScript v1.0.3 — String Operations Demo ──────
2+
# Run: tech run 09_string_ops.txs
3+
4+
say "═══ String Operations Demo ═══"
5+
say ""
6+
7+
make text = " Hello, TechScript World! "
8+
9+
say f"Original: '{text}'"
10+
say f"upper(): '{upper(text)}'"
11+
say f"lower(): '{lower(text)}'"
12+
say f"trim(): '{trim(text)}'"
13+
say f"len(): {len(text)}"
14+
15+
say ""
16+
17+
# ── Search & Replace ──
18+
make sentence = "TechScript is fast, TechScript is fun"
19+
say f"contains 'fast': {contains(sentence, 'fast')}"
20+
say f"find 'fun': index {find(sentence, 'fun')}"
21+
say f"replace: {replace(sentence, 'fun', 'powerful')}"
22+
23+
say ""
24+
25+
# ── Split & Join ──
26+
make csv = "apple,banana,cherry,date"
27+
make fruits = split(csv, ",")
28+
say f"split('{csv}', ','): {fruits}"
29+
say f"join(fruits, ' | '): {join(fruits, ' | ')}"
30+
31+
say ""
32+
33+
# ── Characters ──
34+
make word = "Hello"
35+
say f"chars('{word}'): {chars(word)}"
36+
say f"reverse: {join(reverse(chars(word)), '')}"
37+
38+
say ""
39+
say "Done! ✅"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# ── TechScript v1.0.3 — JSON Module Demo ─────────────
2+
# Run: tech run 10_json_module.txs
3+
4+
say "═══ JSON Module Demo ═══"
5+
say ""
6+
7+
# ── Encoding ──
8+
make user = {
9+
"name": "Tanmoy",
10+
"age": 22,
11+
"skills": ["Rust", "Python", "TechScript"],
12+
"active": true
13+
}
14+
15+
make json_str = json.encode(user)
16+
say f"json.encode: {json_str}"
17+
18+
say ""
19+
make pretty = json.encode_pretty(user)
20+
say "json.encode_pretty:"
21+
say pretty
22+
23+
say ""
24+
25+
# ── Decoding ──
26+
make raw = '{"language":"TechScript","version":1.03,"native":true}'
27+
make parsed = json.decode(raw)
28+
say f"json.decode: {parsed}"
29+
say f"Language: {parsed.language}"
30+
say f"Version: {parsed.version}"
31+
say f"Native: {parsed.native}"
32+
33+
say ""
34+
35+
# ── Round-trip ──
36+
make original = [1, 2, 3, {"nested": true}]
37+
make encoded = json.encode(original)
38+
make decoded = json.decode(encoded)
39+
say f"Round-trip: {original} → '{encoded}' → {decoded}"
40+
41+
say ""
42+
say "Done! ✅"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ── TechScript v1.0.3 — Crypto Module Demo ───────────
2+
# Run: tech run 11_crypto_module.txs
3+
4+
say "═══ Crypto Module Demo ═══"
5+
say ""
6+
7+
# ── SHA-256 Hashing ──
8+
make message = "Hello, TechScript!"
9+
make hash = crypto.sha256(message)
10+
say f"Message: {message}"
11+
say f"SHA-256: {hash}"
12+
13+
say ""
14+
15+
# ── Different inputs = totally different hashes ──
16+
say "Same word, tiny change:"
17+
say f" sha256('hello') = {crypto.sha256('hello')}"
18+
say f" sha256('hello.') = {crypto.sha256('hello.')}"
19+
say f" sha256('Hello') = {crypto.sha256('Hello')}"
20+
21+
say ""
22+
23+
# ── Base64 Encoding/Decoding ──
24+
make secret = "TechScript v1.0.3 is blazing fast!"
25+
make encoded = crypto.base64_encode(secret)
26+
make decoded = crypto.base64_decode(encoded)
27+
say f"Original: {secret}"
28+
say f"Base64 Encode: {encoded}"
29+
say f"Base64 Decode: {decoded}"
30+
31+
say ""
32+
33+
# ── MD5 Hash ──
34+
say f"MD5('test'): {crypto.md5('test')}"
35+
36+
say ""
37+
say "Done! ✅"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ── TechScript v1.0.3 — Date Module Demo ─────────────
2+
# Run: tech run 12_date_module.txs
3+
4+
say "═══ Date & Time Module Demo ═══"
5+
say ""
6+
7+
# ── Current Date/Time ──
8+
say f"Now: {date.now}"
9+
say f"Year: {date.year}"
10+
say f"Month: {date.month}"
11+
say f"Day: {date.day}"
12+
say f"Hour (UTC): {date.hour}"
13+
say f"Minute: {date.minute}"
14+
say f"Second: {date.second}"
15+
16+
say ""
17+
18+
# ── Unix Timestamps ──
19+
say f"Unix (secs): {date.unix}"
20+
say f"Unix (ms): {date.unix_ms}"
21+
22+
say ""
23+
24+
# ── Practical: Measure execution time ──
25+
make start = time_ms()
26+
make total = 0
27+
each i in 1..100000 {
28+
total = total + i
29+
}
30+
make elapsed = time_ms() - start
31+
say f"Sum of 1..100000 = {total}"
32+
say f"Computed in {elapsed}ms"
33+
34+
say ""
35+
say "Done! ✅"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ── TechScript v1.0.3 — File System Module Demo ─────
2+
# Run: tech run 13_fs_module.txs
3+
4+
say "═══ File System Module Demo ═══"
5+
say ""
6+
7+
# ── Current Working Directory ──
8+
say f"Current dir: {fs.cwd}"
9+
10+
say ""
11+
12+
# ── Write a file ──
13+
make filename = "_test_output.txt"
14+
fs.write(filename, "Hello from TechScript v1.0.3!\nLine 2\nLine 3")
15+
say f"Wrote '{filename}'"
16+
17+
# ── Check if it exists ──
18+
say f"Exists: {fs.exists(filename)}"
19+
20+
# ── Read it back ──
21+
make content = fs.read(filename)
22+
say f"Content: {content}"
23+
24+
# ── File size ──
25+
say f"Size: {fs.size(filename)} bytes"
26+
27+
say ""
28+
29+
# ── Append to file ──
30+
fs.append(filename, "\nLine 4 — appended!")
31+
say f"After append: {fs.read(filename)}"
32+
33+
say ""
34+
35+
# ── List directory ──
36+
say "Files in current dir:"
37+
make files = fs.list_dir(".")
38+
each f in files {
39+
say f" → {f}"
40+
}
41+
42+
say ""
43+
44+
# ── Clean up ──
45+
fs.delete(filename)
46+
say f"Deleted '{filename}'. Exists: {fs.exists(filename)}"
47+
48+
say ""
49+
say "Done! ✅"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ── TechScript v1.0.3 — OS Module Demo ───────────────
2+
# Run: tech run 14_os_module.txs
3+
4+
say "═══ OS Module Demo ═══"
5+
say ""
6+
7+
# ── System Information ──
8+
say f"OS Name: {os.name}"
9+
say f"Architecture:{os.arch}"
10+
say f"Process ID: {os.pid}"
11+
12+
say ""
13+
14+
# ── Environment Variables ──
15+
say f"USERNAME: {os.env_get('USERNAME')}"
16+
say f"TEMP: {os.env_get('TEMP')}"
17+
say f"HOME: {os.env_get('USERPROFILE')}"
18+
19+
say ""
20+
21+
# ── Command Line Args ──
22+
say f"CLI Args: {os.args}"
23+
24+
say ""
25+
26+
# ── Run a system command ──
27+
say "Running 'echo Hello from OS module':"
28+
make output = os.popen("echo Hello from OS module")
29+
say f" Output: {trim(output)}"
30+
31+
say ""
32+
say "Done! ✅"

0 commit comments

Comments
 (0)