@misterscan/sesi 1.1.1
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.
- package/LICENSE +21 -0
- package/README.md +191 -0
- package/bin/sesi.js +56 -0
- package/dist/ai-runtime.d.ts +15 -0
- package/dist/ai-runtime.d.ts.map +1 -0
- package/dist/ai-runtime.js +214 -0
- package/dist/ai-runtime.js.map +1 -0
- package/dist/builtins.d.ts +7 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/builtins.js +473 -0
- package/dist/builtins.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/interpreter.d.ts +36 -0
- package/dist/interpreter.d.ts.map +1 -0
- package/dist/interpreter.js +495 -0
- package/dist/interpreter.js.map +1 -0
- package/dist/lexer.d.ts +26 -0
- package/dist/lexer.d.ts.map +1 -0
- package/dist/lexer.js +340 -0
- package/dist/lexer.js.map +1 -0
- package/dist/parser.d.ts +55 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +1022 -0
- package/dist/parser.js.map +1 -0
- package/dist/types.d.ts +304 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +63 -0
- package/dist/types.js.map +1 -0
- package/docs/ARCHITECTURE.md +430 -0
- package/docs/BUILTINS.md +577 -0
- package/docs/COMPARISON.md +334 -0
- package/docs/DISTRIBUTED_SYSTEMS.md +71 -0
- package/docs/IMAGE_GENERATION.md +76 -0
- package/docs/IMPLEMENTATION_SUMMARY.md +533 -0
- package/docs/QUICKSTART.md +351 -0
- package/docs/README.md +191 -0
- package/docs/ROADMAP.md +408 -0
- package/docs/SPECIFICATION.md +462 -0
- package/docs/SYSTEMS_REASONING.md +522 -0
- package/examples/01_hello.sesi +2 -0
- package/examples/02_variables.sesi +11 -0
- package/examples/03_functions.sesi +6 -0
- package/examples/04_conditionals.sesi +6 -0
- package/examples/05_loops.sesi +12 -0
- package/examples/06_arrays_objects.sesi +18 -0
- package/examples/07_prompts.sesi +10 -0
- package/examples/08_model_call.sesi +5 -0
- package/examples/09_structured_output.sesi +7 -0
- package/examples/10_code_generation.sesi +5 -0
- package/examples/11_memory_conversation.sesi +16 -0
- package/examples/12_classification.sesi +8 -0
- package/examples/13_data_pipeline.sesi +35 -0
- package/examples/14_folder_explainer.sesi +58 -0
- package/examples/15_image_generation.sesi +17 -0
- package/main/atm_deposit.sesi +37 -0
- package/main/atm_withdraw.sesi +37 -0
- package/main/data.txt +1 -0
- package/main/math_aggregator.sesi +15 -0
- package/main/math_generator.sesi +7 -0
- package/main/math_processor.sesi +23 -0
- package/main/orchestrator.sesi +15 -0
- package/main/playground.sesi +1 -0
- package/main/setup_swarm.sesi +5 -0
- package/main/start.sesi +13 -0
- package/main/tax_calculator.sesi +15 -0
- package/main/tests/compare.sesi +23 -0
- package/main/tests/compare.ts +104 -0
- package/main/tests/debug.sesi +1 -0
- package/main/tests/demo.sesi +24 -0
- package/main/tests/primitive_validation.sesi +18 -0
- package/main/tests/test_connection.sesi +4 -0
- package/main/tests/test_failure_debug.sesi +2 -0
- package/main/tests/test_image.sesi +3 -0
- package/main/tests/test_parser_config.sesi +2 -0
- package/main/tests/test_syntax.sesi +3 -0
- package/main/tests/test_tool_call.sesi +14 -0
- package/main/tests/try.sesi +7 -0
- package/main/vault.sesi +15 -0
- package/package.json +50 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Sesi Runtime Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
**Sesi** is a high-performance **Systems Language** designed for building resilient, stateful applications. It uses a tree-walking interpreter model with asynchronous host-side model execution, but no language-level `async/await` syntax in v1.1 The architecture is optimized for coordination, distributed state management, and first-class reasoning primitives.
|
|
6
|
+
|
|
7
|
+
## Component Stack
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────┐
|
|
11
|
+
│ Sesi Program (.sesi file) │
|
|
12
|
+
└──────────────────┬──────────────────────────┘
|
|
13
|
+
│
|
|
14
|
+
┌──────────────────▼──────────────────────────┐
|
|
15
|
+
│ Lexer (src/lexer.ts) │
|
|
16
|
+
│ Converts source text → Tokens │
|
|
17
|
+
└──────────────────┬──────────────────────────┘
|
|
18
|
+
│
|
|
19
|
+
┌──────────────────▼──────────────────────────┐
|
|
20
|
+
│ Parser (src/parser.ts) │
|
|
21
|
+
│ Converts Tokens → Abstract Syntax Tree │
|
|
22
|
+
└──────────────────┬──────────────────────────┘
|
|
23
|
+
│
|
|
24
|
+
┌──────────────────▼──────────────────────────┐
|
|
25
|
+
│ Interpreter (src/interpreter.ts) │
|
|
26
|
+
│ Tree-walking interpreter │
|
|
27
|
+
│ - Evaluates expressions │
|
|
28
|
+
│ - Executes statements │
|
|
29
|
+
│ - Manages scopes/environments │
|
|
30
|
+
└──────┬───────────────────────┬──────────────┘
|
|
31
|
+
│ │
|
|
32
|
+
│ │
|
|
33
|
+
┌──────▼──────────────┐ ┌────▼────────────────┐
|
|
34
|
+
│ Builtins │ │ AI Runtime │
|
|
35
|
+
│ (src/builtins.ts) │ │ (src/ai-runtime.ts) │
|
|
36
|
+
│ │ │ │
|
|
37
|
+
│ - print() │ │ - Gemini API calls │
|
|
38
|
+
│ - len() │ │ - Memory mgmt │
|
|
39
|
+
│ - read_file() │ │ - Structured output │
|
|
40
|
+
│ - write_file() │ │ - Tool calling │
|
|
41
|
+
│ - spawn() │ │ │
|
|
42
|
+
│ - exec() │ │ │
|
|
43
|
+
│ - time() │ │ │
|
|
44
|
+
│ - random() │ │ │
|
|
45
|
+
│ - etc. │ │ │
|
|
46
|
+
└─────────────────────┘ └────┬────────────────┘
|
|
47
|
+
│
|
|
48
|
+
┌─────────▼──────────┐
|
|
49
|
+
│ Gemini API │
|
|
50
|
+
│ (@google/genai) │
|
|
51
|
+
└────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Execution Flow
|
|
55
|
+
|
|
56
|
+
### 1. Lexical Analysis (Lexer)
|
|
57
|
+
|
|
58
|
+
- **Input**: Source code string
|
|
59
|
+
- **Process**: Character-by-character tokenization
|
|
60
|
+
- Identifier and keyword recognition
|
|
61
|
+
- Number and string literal parsing
|
|
62
|
+
- Operator and delimiter recognition
|
|
63
|
+
- Comment stripping
|
|
64
|
+
- **Output**: Token stream
|
|
65
|
+
|
|
66
|
+
**Example**:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Source: let x = 10
|
|
70
|
+
Tokens: [LET, IDENTIFIER("x"), EQUAL, NUMBER(10), EOF]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Parsing (Parser)
|
|
74
|
+
|
|
75
|
+
- **Input**: Token stream
|
|
76
|
+
- **Process**: Recursive descent parsing
|
|
77
|
+
- Statement parsing (declarations, control flow)
|
|
78
|
+
- Expression parsing (operators, function calls, Reasoning constructs)
|
|
79
|
+
- AST construction
|
|
80
|
+
- Error recovery
|
|
81
|
+
- **Output**: Abstract Syntax Tree (AST)
|
|
82
|
+
|
|
83
|
+
**Example AST Node**:
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
{
|
|
87
|
+
type: 'LetStatement',
|
|
88
|
+
name: 'x',
|
|
89
|
+
value: {
|
|
90
|
+
type: 'Literal',
|
|
91
|
+
value: 10,
|
|
92
|
+
rawType: 'number'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. Interpretation (Interpreter)
|
|
98
|
+
|
|
99
|
+
- **Input**: AST
|
|
100
|
+
- **Process**: Recursive tree evaluation
|
|
101
|
+
- Statement execution in order
|
|
102
|
+
- Expression evaluation with proper operator precedence
|
|
103
|
+
- Environment/scope management with lexical scoping
|
|
104
|
+
- Blocking host-side async calls for Reasoning operations
|
|
105
|
+
- Control flow (return, break, continue)
|
|
106
|
+
- **Output**: Program side effects (print, Reasoning calls, etc.)
|
|
107
|
+
|
|
108
|
+
## Scope and Environment Management
|
|
109
|
+
|
|
110
|
+
Sesi uses **lexical scoping** with an environment chain:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
┌─────────────────────────┐
|
|
114
|
+
│ Global Environment │
|
|
115
|
+
│ - Built-in functions │
|
|
116
|
+
│ - Global variables │
|
|
117
|
+
└────────┬────────────────┘
|
|
118
|
+
│
|
|
119
|
+
┌────▼────────────────┐
|
|
120
|
+
│ Function Environment │
|
|
121
|
+
│ - Parameters │
|
|
122
|
+
│ - Local variables │
|
|
123
|
+
└────┬─────────────────┘
|
|
124
|
+
│
|
|
125
|
+
┌────▼────────────────┐
|
|
126
|
+
│ Block Environment │
|
|
127
|
+
│ - Block variables │
|
|
128
|
+
└─────────────────────┘
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Environment Lookup
|
|
132
|
+
|
|
133
|
+
1. Check current environment
|
|
134
|
+
2. Walk up parent chain until found
|
|
135
|
+
3. If not found anywhere, error
|
|
136
|
+
|
|
137
|
+
### Variable Assignment
|
|
138
|
+
|
|
139
|
+
1. Try to update in current scope
|
|
140
|
+
2. If not in current scope, try parent scopes
|
|
141
|
+
3. Update in the scope where variable was found
|
|
142
|
+
|
|
143
|
+
## Type System
|
|
144
|
+
|
|
145
|
+
Sesi has a **dynamic type system** with runtime type checking:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
RuntimeValue =
|
|
149
|
+
| number
|
|
150
|
+
| string
|
|
151
|
+
| boolean
|
|
152
|
+
| null
|
|
153
|
+
| Array<RuntimeValue>
|
|
154
|
+
| Object<string, RuntimeValue>
|
|
155
|
+
| RuntimeFunction
|
|
156
|
+
| RuntimeModule
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Type Coercion Rules
|
|
160
|
+
|
|
161
|
+
**String Concatenation** (operator `+`):
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
"Hello" + 5 → "Hello5"
|
|
165
|
+
"Age:" 30 → "Age: 30"
|
|
166
|
+
any + string → toString(any) + string
|
|
167
|
+
string + any → string + toString(any)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Numeric Operations**:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
10 + 20 → 30
|
|
174
|
+
"10" + 20 → "1020" (not numeric!)
|
|
175
|
+
10 20 → "10 20" (not numeric!)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Truthiness**:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
null → false
|
|
182
|
+
false → false
|
|
183
|
+
0 → false
|
|
184
|
+
"" → false
|
|
185
|
+
[] → true
|
|
186
|
+
{} → true
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Reasoning Integration
|
|
190
|
+
|
|
191
|
+
### Reasoning Runtime Lifecycle
|
|
192
|
+
|
|
193
|
+
1. **Initialization**:
|
|
194
|
+
- Load @google/genai SDK
|
|
195
|
+
- Validate GEMINI_API_KEY environment variable
|
|
196
|
+
2. **During Execution**:
|
|
197
|
+
- Parse model calls from AST
|
|
198
|
+
- Construct prompt from string concatenation
|
|
199
|
+
- Make async API call to Gemini
|
|
200
|
+
|
|
201
|
+
- Wait for response (blocking in v1)
|
|
202
|
+
- Validate finish reason and non-empty text
|
|
203
|
+
- Return text response to program or throw
|
|
204
|
+
|
|
205
|
+
3. **Memory Management**:
|
|
206
|
+
- Simple string buffers per memory ID
|
|
207
|
+
- Append/update operations
|
|
208
|
+
- Passed to next model call
|
|
209
|
+
|
|
210
|
+
### Model Call Flow
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
ModelCallExpression (AST)
|
|
214
|
+
│
|
|
215
|
+
├─ Evaluate prompt expression
|
|
216
|
+
├─ Extract configuration ("temperature", "max_tokens")
|
|
217
|
+
├─ Call AIRuntime.callModel()
|
|
218
|
+
│ │
|
|
219
|
+
│ ├─ Create Gemini interaction request
|
|
220
|
+
│ ├─ Send to Gemini API
|
|
221
|
+
│ ├─ Wait for response
|
|
222
|
+
│ ├─ Validate finish reason == STOP
|
|
223
|
+
│ └─ Extract text from response
|
|
224
|
+
│
|
|
225
|
+
└─ Return text to program or throw
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Error Handling (V1)
|
|
229
|
+
|
|
230
|
+
Sesi now has basic exception-style error handling in v1:
|
|
231
|
+
|
|
232
|
+
1. **Parse Errors**: Parser logs the error and synchronizes to continue parsing later statements.
|
|
233
|
+
2. **Runtime Errors**: Interpreter errors throw and can be caught with `try/catch`.
|
|
234
|
+
3. **Built-in I/O Errors**: `read_file()`, `write_file()`, and `list_dir()` throw on filesystem failure.
|
|
235
|
+
4. **Reasoning Errors**: `model()` throws when the SDK fails, when no text is returned. (Note: `MAX_TOKENS` finish reasons are now handled natively via an automatic async polling loop that prompts the model to continue where it left off, and therefore does not throw errors).
|
|
236
|
+
5. **Structured Output**: `structured_output()` attempts recovery, but currently logs parsing failures and returns `{}` if coercion still fails.
|
|
237
|
+
|
|
238
|
+
## Memory Model
|
|
239
|
+
|
|
240
|
+
### Stack
|
|
241
|
+
|
|
242
|
+
- Local variables
|
|
243
|
+
- Function parameters
|
|
244
|
+
- Scope frames
|
|
245
|
+
|
|
246
|
+
### Heap
|
|
247
|
+
|
|
248
|
+
- Arrays (dynamic)
|
|
249
|
+
- Objects (key-value maps)
|
|
250
|
+
- Strings (immutable)
|
|
251
|
+
|
|
252
|
+
### Reasoning Context
|
|
253
|
+
|
|
254
|
+
- Conversation memory per memory ID
|
|
255
|
+
- String buffers, not structured storage
|
|
256
|
+
|
|
257
|
+
## Performance Characteristics
|
|
258
|
+
|
|
259
|
+
| Operation | Time | Notes |
|
|
260
|
+
| --------------- | ----- | ------------------------- |
|
|
261
|
+
| Variable lookup | O(n) | n = scope depth |
|
|
262
|
+
| Array access | O(1) | Direct indexing |
|
|
263
|
+
| Object access | O(1) | Map lookup |
|
|
264
|
+
| Function call | O(1) | + body execution |
|
|
265
|
+
| Model call | ~2-5s | Depends on Gemini latency |
|
|
266
|
+
| Array iteration | O(n) | Foreach loop |
|
|
267
|
+
|
|
268
|
+
## Limitations (V1)
|
|
269
|
+
|
|
270
|
+
- **Interpreter Single-threaded**: Each individual Sesi process is single-threaded.
|
|
271
|
+
- **Process-level Concurrency**: Sesi uses a multi-process model via `spawn()` for concurrent task execution.
|
|
272
|
+
- **No optimization**: No bytecode or JIT.
|
|
273
|
+
- **Simple type system**: Runtime checking only.
|
|
274
|
+
- **No macro system**: No compile-time code generation
|
|
275
|
+
- **No introspection**: Can't inspect function bodies
|
|
276
|
+
- **Limited error info**: Basic error messages
|
|
277
|
+
|
|
278
|
+
## Future Architecture (V2+)
|
|
279
|
+
|
|
280
|
+
### V2 Planned Improvements
|
|
281
|
+
|
|
282
|
+
- Async/await syntax for concurrent Reasoning calls
|
|
283
|
+
- Bytecode compiler for faster execution
|
|
284
|
+
- Advanced error handling with stack traces
|
|
285
|
+
- Streaming response support
|
|
286
|
+
- Function composition and piping
|
|
287
|
+
|
|
288
|
+
### V3+ Vision
|
|
289
|
+
|
|
290
|
+
- Agent framework with state machines
|
|
291
|
+
- Knowledge base integration
|
|
292
|
+
- Advanced memory with embedding search
|
|
293
|
+
- Multi-agent orchestration
|
|
294
|
+
- Custom type definitions
|
|
295
|
+
- Macro system
|
|
296
|
+
|
|
297
|
+
## Code Organization
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
SKILLS.md # AI-agent workspace context and repo guardrails
|
|
301
|
+
index.html # Sesi-generated landing page
|
|
302
|
+
eslint.config.mjs # ESLint configuration
|
|
303
|
+
dist/ # Compiled TypeScript output
|
|
304
|
+
example.js # Helper script to run basic examples
|
|
305
|
+
example-ai.js # Helper script to run Reasoning examples
|
|
306
|
+
package.json # Dependencies & scripts
|
|
307
|
+
tsconfig.json # TypeScript configuration
|
|
308
|
+
QUICKSTART.md # Quick start guide
|
|
309
|
+
IMPLEMENTATION_SUMMARY.md # Progress and tracking
|
|
310
|
+
README.md # Project overview
|
|
311
|
+
|
|
312
|
+
src/
|
|
313
|
+
├── types.ts # Type definitions and AST
|
|
314
|
+
├── lexer.ts # Tokenization
|
|
315
|
+
├── parser.ts # AST generation
|
|
316
|
+
├── interpreter.ts # Execution engine
|
|
317
|
+
├── ai-runtime.ts # Gemini integration
|
|
318
|
+
├── builtins.ts # Built-in functions
|
|
319
|
+
└── index.ts # Main entry point
|
|
320
|
+
|
|
321
|
+
bin/
|
|
322
|
+
└── sesi.js # CLI executable
|
|
323
|
+
|
|
324
|
+
main/ # Main user scripts and debugging
|
|
325
|
+
├── playground.sesi # Main playground script
|
|
326
|
+
├── start.sesi # Beginner script
|
|
327
|
+
├── build_website.sesi # Sesi-generated landing page builder
|
|
328
|
+
└── tests/ # Additional syntax validation scripts
|
|
329
|
+
|
|
330
|
+
examples/
|
|
331
|
+
├── 01_hello.sesi # Basic example
|
|
332
|
+
├── 02_variables.sesi # Variables & operations
|
|
333
|
+
├── 03_functions.sesi # Functions with parameters
|
|
334
|
+
├── 04_conditionals.sesi # If/else control flow
|
|
335
|
+
├── 05_loops.sesi # Loops & iteration
|
|
336
|
+
├── 06_arrays_objects.sesi# Arrays & objects
|
|
337
|
+
├── 07_prompts.sesi # Prompts and string templating
|
|
338
|
+
├── 08_model_call.sesi # Basic Reasoning model calls
|
|
339
|
+
├── 09_structured_output.sesi # Schema-guided structured output with JSON recovery and empty-object fallback on failure
|
|
340
|
+
├── 10_code_generation.sesi # Reasoning-powered code gen
|
|
341
|
+
├── 11_memory_conversation.sesi # Reasoning-powered conversations
|
|
342
|
+
├── 12_classification.sesi # Classification
|
|
343
|
+
├── 13_data_pipeline.sesi # Pipeline demo
|
|
344
|
+
├── 14_folder_explainer.sesi # Directory parsing & reasoning
|
|
345
|
+
└── 15_image_generation.sesi # Image generation API test
|
|
346
|
+
|
|
347
|
+
docs/
|
|
348
|
+
├── SPECIFICATION.md # Language spec
|
|
349
|
+
├── ARCHITECTURE.md # This file
|
|
350
|
+
├── BUILTINS.md # Built-in reference
|
|
351
|
+
├── IMAGE_GENERATION.md # Image generation guide
|
|
352
|
+
├── COMPARISON.md # Language comparison showcase
|
|
353
|
+
├── SYSTEMS_REASONING.md # Integrated reasoning guide
|
|
354
|
+
├── DISTRIBUTED_SYSTEMS.md # Swarm & coordination guide
|
|
355
|
+
└── ROADMAP.md # Future plans
|
|
356
|
+
|
|
357
|
+
tests/
|
|
358
|
+
└── basic.test.ts # Test suite
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Workspace Context File
|
|
362
|
+
|
|
363
|
+
The root-level `SKILLS.md` file is part of the practical repo architecture. It is not consumed by the Sesi runtime, but it is intended to guide AI-assisted development in this workspace.
|
|
364
|
+
|
|
365
|
+
It defines repo-specific operating rules such as valid Sesi assumptions, normal execution via the global `sesi` command, and the fact that `main/` and `main/tests/` are intentional user workspace areas rather than anomalies.
|
|
366
|
+
|
|
367
|
+
## Testing Strategy
|
|
368
|
+
|
|
369
|
+
**Unit Tests** (per component):
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
// Lexer: tokenization correctness
|
|
373
|
+
// Parser: AST structure correctness
|
|
374
|
+
// Interpreter: evaluation correctness
|
|
375
|
+
// AI Runtime: Gemini integration
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Integration Tests**:
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
// Full program execution
|
|
382
|
+
// Complex Reasoning workflows
|
|
383
|
+
// Error handling
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Example Programs**:
|
|
387
|
+
|
|
388
|
+
- Basic arithmetic and control flow
|
|
389
|
+
- Functions and scoping
|
|
390
|
+
- Arrays and objects
|
|
391
|
+
- Reasoning model calls
|
|
392
|
+
- Structured output parsing
|
|
393
|
+
- Memory-based conversations
|
|
394
|
+
|
|
395
|
+
## Debugging
|
|
396
|
+
|
|
397
|
+
### Debug Output
|
|
398
|
+
|
|
399
|
+
Enable debug logging (future):
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
SESI_DEBUG=1 sesi program.sesi
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### AST Visualization
|
|
406
|
+
|
|
407
|
+
Print AST (future):
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
sesi --ast program.sesi
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Token Stream
|
|
414
|
+
|
|
415
|
+
Print tokens (future):
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
sesi --tokens program.sesi
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Conclusion
|
|
422
|
+
|
|
423
|
+
Sesi's architecture prioritizes **clarity and simplicity** over performance. The tree-walking interpreter is ideal for:
|
|
424
|
+
|
|
425
|
+
- Easy debugging
|
|
426
|
+
- Simple extensions
|
|
427
|
+
- Clear control flow
|
|
428
|
+
- Smooth Reasoning (AI) integration
|
|
429
|
+
|
|
430
|
+
As the language matures, optimizations can be added without changing the API.
|