You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance TechLang with STL compatibility, dynamic arrays, and improved control flow operators; update documentation and examples for new features and error handling improvements.
### 2025-12-14: STL Compatibility + Deterministic Process Status
1174
+
1175
+
**Status:** ✅ Completed
1176
+
1177
+
### Summary
1178
+
Improved core runtime semantics to support the existing `stl/*` modules and stabilized `proc_status` behavior on Windows.
1179
+
1180
+
### Implementation Details
1181
+
- Added “store into target” forms for core string/array operations (`str_length`, `str_substring`, `str_contains`, `array_get`) so STL helpers can compute without emitting intermediate output.
1182
+
- Added dynamic arrays (`array_create <name>` with no size) that grow via `array_set` and allow sentinel `0` on out-of-bounds `array_get ... <target>`.
1183
+
- Expanded control-flow operator support to include `eq/ne/gt/lt/ge/le` aliases and allowed string equality in `if` conditions.
1184
+
- Made `proc_spawn "python" ...` use the active interpreter and made `proc_status` less flaky by doing a short internal wait when appropriate.
Copy file name to clipboardExpand all lines: docs/control-flow.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,13 @@ if score < 60
17
17
end
18
18
```
19
19
20
-
Comparisons support `==`, `!=`, `<`, `<=`, `>` and `>=`. The right-hand side accepts integers or existing variables.
20
+
Comparisons support `==`, `!=`, `<`, `<=`, `>` and `>=`.
21
+
22
+
For convenience (and for compatibility with some examples), these operator aliases are also accepted:
23
+
24
+
-`eq/ne/gt/lt/ge/le` map to `==/!=/>/</>=/<=`.
25
+
26
+
The right-hand side accepts integers or existing variables. Equality/inequality also works with string operands (for example comparing two string variables).
@@ -109,8 +113,16 @@ str_create text "techlang is awesome"
109
113
str_contains text "lang" # 1 (true)
110
114
str_contains text "python" # 0 (false)
111
115
116
+
// Store contains result into a variable (no output)
117
+
str_contains text "lang" found
118
+
print found # 1
119
+
112
120
// Get substring
113
121
str_substring text 0 8 # "techlang"
122
+
123
+
// Store substring into a string variable (no output)
124
+
str_substring text 0 8 head
125
+
print head # techlang
114
126
```
115
127
116
128
### String Operations Summary
@@ -141,6 +153,24 @@ array_push numbers 20
141
153
array_pop numbers
142
154
```
143
155
156
+
### Dynamic arrays (size optional)
157
+
158
+
You can also create a dynamic array without a fixed size:
159
+
160
+
```techlang
161
+
array_create nums
162
+
array_push nums 5
163
+
array_push nums 10
164
+
165
+
# Store into a variable instead of printing
166
+
array_get nums 1 value
167
+
print value # 10
168
+
```
169
+
170
+
For dynamic arrays, `array_set` grows the array automatically.
171
+
172
+
For dynamic arrays, out-of-bounds `array_get <array> <index> <target>` stores `0` (sentinel) into `<target>`. (Without a target, out-of-bounds reads still raise an error.)
Copy file name to clipboardExpand all lines: docs/system.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,11 @@ The process commands let you start a long-running program and interact with it l
31
31
32
32
Commands that accept a path or command string must use double quotes. All commands run relative to the interpreter's base directory, so you can reference project scripts directly.
33
33
34
+
Notes:
35
+
36
+
- On Windows, `proc_spawn "python" ...` uses the interpreter running TechLang (avoids the Microsoft Store alias) for more predictable behavior.
37
+
-`proc_status` may do a short internal wait once a process has been alive briefly, to reduce flakiness from slow process startup.
0 commit comments