dist_agent_lang 1.0.5

A hybrid programming language for decentralized and centralized network integration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
# DAL (Distributed Agent Language) - Public Documentation Index

**Version:** 1.0.5  
**Last Updated:** 2026-02-08  
**Optimized for:** Human developers and AI/LLM assistants

---

## 📋 Quick Navigation

| Section | Description | Target Audience |
|---------|-------------|-----------------|
| [Getting Started]#getting-started | Installation, first program | New users, AI assistants |
| [Language Reference]#language-reference | Syntax, types, operators | All developers, LLMs |
| [Standard Library]#standard-library-stdlib | All stdlib modules | Developers, AI code generation |
| [Package Management]#package-management | Installing, dependencies | Developers, DevOps |
| [CLI Reference]#cli-reference | Command-line tools | Developers, automation |
| [Templates & Marketplace]#templates--marketplace | Agent templates, sharing | Advanced users |
| [Examples]#examples | Code samples | Learning, AI training data |
| [API Reference]#api-reference | Programmatic access | Integrations, tools |

---

## 🚀 Getting Started

### Installation

**Quick Install (Recommended):**
```bash
curl -sSf https://dist_agent_lang.org/install.sh | sh
```

**Or download binaries:**
- Linux: https://dist_agent_lang.org/downloads/dal-linux-x64
- macOS: https://dist_agent_lang.org/downloads/dal-macos-x64
- Windows: https://dist_agent_lang.org/downloads/dal-windows-x64.exe

**Verify Installation:**
```bash
dal --version
# Output: dist_agent_lang v1.0.5
```

### Your First DAL Program

**hello.dal:**
```dal
function main() {
    log::info("Hello, DAL!");
}
```

**Run it:**
```bash
dal run hello.dal
```

**Output:**
```
🚀 Running dist_agent_lang file: hello.dal
✅ Tokenization successful! Generated 10 tokens
✅ Parsing successful! Generated 1 statements
[INFO] "Hello, DAL!"
✅ Execution successful!
```

---

## 📚 Language Reference

### Core Concepts

**DAL is:**
- **Multi-paradigm:** Services, functions, imperative
- **Strongly-typed:** Type safety at runtime
- **Blockchain-native:** Built-in chain, crypto, auth
- **AI-first:** Native agent and AI support
- **Web-friendly:** HTTP, templates, middleware

### File: [docs/syntax.md]./syntax.md

---

## 📦 Package Management

**➡️ [Packaging & Distribution Guide (PACKAGING.md)](./PACKAGING.md)**

Learn about:
- Installation methods (curl, direct download, package managers)
- Edition comparison (Community, Professional, Enterprise)
- Updates and versioning
- System requirements
- Configuration
- Troubleshooting

---

## 📦 Standard Library (stdlib)

### Overview

DAL's standard library provides built-in functionality across multiple domains:

| Module | Purpose | Key Functions |
|--------|---------|---------------|
| **chain** | Blockchain operations | `deploy()`, `call()`, `get_balance()` |
| **crypto** | Cryptography | `hash()`, `sign()`, `verify()`, `encrypt()` |
| **auth** | Authentication | `create_user()`, `login()`, `validate_token()` |
| **db** | Database operations | `query()`, `connect()`, `migrate()` |
| **ai** | AI/ML operations | `generate_text()`, `classify()`, `embed()` |
| **agent** | Agent orchestration | `create()`, `coordinate()`, `communicate()` |
| **iot** | IoT device management | `connect_device()`, `read_sensor()` |
| **oracle** | Oracle data feeds | `fetch()`, `stream()`, `verify()` |
| **web** | HTTP operations | `get_request()`, `post_request()` |
| **log** | Logging | `info()`, `warn()`, `error()` |
| **config** | Configuration | `get_env()`, `get_database_config()` |
| **cloudadmin** | Cloud management | `authorize()`, `grant()`, `audit_log()` |
| **trust** | Trust & permissions | `validate_hybrid_trust()`, `authorize()` |
| **aml** | Anti-money laundering | `perform_check()`, `get_status()` |
| **kyc** | Know Your Customer | `verify()`, `get_verification()` |
| **mold** | Agent molds & templates | `load()`, `spawn_from()`, `list()`, `get_info()`, `use_mold()` |

### Detailed References

**📘 [Complete Standard Library Reference (STDLIB_REFERENCE.md)](./STDLIB_REFERENCE.md)**

This comprehensive, machine-readable reference includes:
- All stdlib modules with complete function signatures
- Parameter types and return types
- Usage examples for every function
- Error handling patterns
- Best practices for AI code generation

**Individual Module Guides:**
- [Chain Module]./guides/API_REFERENCE.md#chain-module
- [Crypto Module]./guides/API_REFERENCE.md#crypto-module
- [Auth Module]./guides/API_REFERENCE.md#auth-module
- [Agent Module]./guides/API_REFERENCE.md#agent-module
- [AI Module]./guides/AI_FEATURES_GUIDE.md
- [CloudAdmin Module]./guides/CLOUDADMIN_GUIDE.md
- [Mold Module]./STDLIB_REFERENCE.md#mold-module

---

## 🎯 Package Management

### Binary Distribution

**Current Model:**
- DAL is distributed as compiled binaries
- Includes full standard library
- No source code access (proprietary)

### Installing DAL

**System Requirements:**
- Linux: x86_64, kernel 3.2+
- macOS: 10.15+ (Catalina or later)
- Windows: Windows 10+ (64-bit)

**Install Locations:**
```
Linux/macOS:
/usr/local/bin/dal              # Binary executable
/usr/local/lib/dal/             # Runtime libraries
/usr/local/share/dal/docs/      # Documentation

Windows:
C:\Program Files\DAL\dal.exe
C:\Program Files\DAL\lib\
C:\Program Files\DAL\docs\
```

### Updating DAL

```bash
# Check for updates
dal version --check

# Update to latest version
dal upgrade

# Update to specific version
dal upgrade --version 1.0.5
```

---

## 🔧 CLI Reference

### Core Commands

| Command | Description | Example |
|---------|-------------|---------|
| `run <file>` | Execute DAL file | `dal run app.dal` |
| `parse <file>` | Parse and validate | `dal parse app.dal` |
| `test <file>` | Run tests | `dal test app.test.dal` |
| `web <file>` | Run web app | `dal web server.dal` |
| `convert <file>` | Solidity to DAL | `dal convert Token.sol` |
| `analyze <file>` | Analyze Solidity | `dal analyze Token.sol` |
| `help` | Show help | `dal help` |
| `version` | Show version | `dal version` |

### Planned Commands (Future)

See [CLI Expansion Plan](./development/stdlib_implementation_plans/09_CLI_EXPANSION_PLAN.md) for upcoming features:
- `dal fmt` - Code formatting
- `dal lint` - Code linting
- `dal new` - Project scaffolding
- `dal agent create` - Agent creation
- `dal cloud` - Cloud management
- And many more...

---

## 🤖 Templates & Marketplace

### Agent Templates

Reusable configurations for AI agents that can be shared, sold, and instantiated at scale.

**Example:**
```bash
# Install template from marketplace
dal agent template install username/fraud_detector

# Create agent from template
dal agent create --template username/fraud_detector my_detector

# Create fleet from template
dal agent fleet create --template username/fraud_detector fraud_team --agents 50
```

**See:** [Agent Template Marketplace Guide](../dist_agent_lang/docs/development/AGENT_TEMPLATE_MARKETPLACE.md)

---

## 💡 Examples

### Complete Examples

1. **[DeFi Token]./tutorials/01_defi_token.md**
   - ERC20-compatible token
   - Minting, burning, transfers
   - Blockchain integration

2. **[AI Trading Agent]./tutorials/02_ai_trading_agent.md**
   - AI-powered trading
   - Market analysis
   - Risk management

3. **[Hybrid Marketplace]./tutorials/03_hybrid_marketplace_cloudadmin.md**
   - Centralized + decentralized
   - Cloud admin integration
   - Payment processing

### Code Snippets Library

**Blockchain Operations:**
```dal
@chain("ethereum")
service Token {
    function deploy() {
        let result = chain::deploy("MyToken", "{}");
        log::info("Deployed: " + result.address);
    }
}
```

**AI Agent Creation:**
```dal
import stdlib::agent;

function create_fraud_detector() {
    let config = {
        "name": "FraudDetector",
        "type": "ai",
        "role": "Detect fraudulent transactions"
    };
    
    let agent_ctx = agent::spawn(config);
    log::info("Agent created: " + agent_ctx.agent_id);
}
```

**Database Query:**
```dal
import stdlib::db;

function get_users() {
    let conn = db::connect("postgresql://localhost/mydb");
    let result = db::query(conn, "SELECT * FROM users");
    return result;
}
```

**Cloud Admin:**
```dal
import stdlib::cloudadmin;

function check_access() {
    let authorized = cloudadmin::authorize("user_123", "write", "resource_456");
    if !authorized {
        log::error("Access denied");
    }
}
```

---

## 🔌 API Reference

### For AI/LLM Assistants

**When generating DAL code, reference:**

1. **Syntax:** [docs/syntax.md]./syntax.md
2. **Attributes:** [docs/attributes.md]./attributes.md
3. **Stdlib API:** [docs/guides/API_REFERENCE.md]./guides/API_REFERENCE.md
4. **Best Practices:** [docs/guides/BEST_PRACTICES.md]./guides/BEST_PRACTICES.md
5. **Examples:** [docs/examples/]../examples/

### Common Patterns

**Service Definition:**
```dal
@trust("hybrid")
@chain("ethereum")
service MyService {
    var state: String = "initial";
    
    function initialize() {
        state = "ready";
    }
    
    function process(data: String) -> String {
        return "Processed: " + data;
    }
}
```

**Error Handling:**
```dal
function safe_operation() {
    try {
        let result = risky_function();
        log::info("Success");
    } catch error {
        log::error("Failed: " + error);
    } finally {
        cleanup();
    }
}
```

**Agent Communication:**
```dal
function coordinate_agents() {
    let agent1 = agent::create("ai", "Analyzer");
    let agent2 = agent::create("worker", "Processor");
    
    agent::communicate(agent1.agent_id, agent2.agent_id, {
        "message_type": "task",
        "content": "Process batch 42"
    });
}
```

---

## 📖 Comprehensive Documentation Links

### For Humans

- [Quick Start Guide]./guides/QUICK_START.md
- [Installation Guide]./getting_started/INSTALLATION.md
- [Usage Guide]./USAGE_GUIDE.md
- [Best Practices]./guides/BEST_PRACTICES.md
- [Deployment Guide]./guides/DEPLOYMENT_GUIDE.md

### For AI/LLM Tools

**When assisting with DAL development:**

1. **Language Syntax:** Parse [syntax.md]./syntax.md for grammar rules
2. **Type System:** Reference [attributes.md]./attributes.md for types
3. **Stdlib Functions:** Index [API_REFERENCE.md]./guides/API_REFERENCE.md
4. **Code Examples:** Learn from [examples/]../examples/ directory
5. **Common Patterns:** Extract from [tutorials/]./tutorials/

**Optimization Hints:**
- DAL is blockchain-native: Prefer `chain::` functions over manual HTTP
- Services are stateful: Use `var` for mutable state
- Agent orchestration: Use `agent::` module for multi-agent systems
- Trust models: Always specify `@trust` attribute for services

---

## 🛠 Development Resources

### GitHub Repositories

- **Main Repository:** (Private - contact for access)
- **Examples:** https://github.com/dist_agent_lang/examples
- **Templates:** https://github.com/dist_agent_lang/templates
- **Documentation:** https://github.com/dist_agent_lang/docs

### Community

- **Discord:** https://discord.gg/dist-agent-lang
- **Forum:** https://forum.dist_agent_lang.org
- **Stack Overflow:** Tag `dist-agent-lang` or `dal`
- **Twitter:** @dal_lang

### Commercial Support

- **Enterprise Support:** support@dist_agent_lang.org
- **Training:** training@dist_agent_lang.org
- **Consulting:** consulting@dist_agent_lang.org

---

## 🔍 AI/LLM Integration Guide

### For Code Assistants (GitHub Copilot, Cursor, etc.)

**DAL File Extensions:**
- `.dal` - Standard DAL source files
- `.test.dal` - Test files

**Syntax Highlighting:**
- Use Rust syntax as base (similar structure)
- Add DAL-specific keywords: `service`, `@chain`, `@trust`, `@ai`

**Code Generation Tips:**

1. **Always import stdlib modules:**
   ```dal
   import stdlib::chain;
   import stdlib::agent;
   ```

2. **Use attributes for services:**
   ```dal
   @trust("hybrid")
   @chain("ethereum")
   service MyService { }
   ```

3. **Leverage built-in functions:**
   - Don't reinvent crypto: use `crypto::hash()`
   - Don't write HTTP clients: use `web::get_request()`
   - Don't implement auth: use `auth::create_user()`

4. **Agent orchestration patterns:**
   ```dal
   // Create → Configure → Communicate → Coordinate
   let agent = agent::create("ai", "name");
   let task = agent::create_agent_task("task_1", "description", "high");
   agent::coordinate(agent.agent_id, task, "task_distribution");
   ```

### For Documentation Tools

**Indexed Sections:**
- Language: [syntax.md]./syntax.md
- Standard Library: [API_REFERENCE.md]./guides/API_REFERENCE.md
- Tutorials: [tutorials/]./tutorials/
- Examples: [examples/]../examples/
- CLI: [CLI_EXPANSION_PLAN.md]./development/stdlib_implementation_plans/09_CLI_EXPANSION_PLAN.md

**Machine-Readable Format:**
- All stdlib functions documented with signatures
- Type information included
- Return types specified
- Error conditions listed

---

## 📊 Version History

| Version | Date | Highlights |
|---------|------|------------|
| **1.0.5** | 2026-02-08 | Mutation testing hardening, HTTP middleware tests, version bump |
| **1.0.3** | 2026-02-06 | mold:: stdlib, agent molds, CLI mold commands |
| **1.0.2** | 2026-01-15 | CloudAdmin module, improved stdlib |
| **1.0.1** | 2025-12-01 | Bug fixes, performance improvements |
| **1.0.0** | 2025-11-01 | Initial release |

---

## 🚦 Status & Roadmap

### Current Status

✅ **Production Ready:**
- Core runtime
- Basic stdlib (chain, crypto, auth, db)
- CLI tools (run, parse, test, web)
- Solidity conversion

🚧 **In Development:**
- Agent template marketplace
- Advanced CLI commands
- Plugin system
- LSP support

📋 **Planned:**
- Cloud-native deployment
- Advanced AI integrations
- Enterprise features
- Mobile runtime

### Release Schedule

- **1.1.0** (Q2 2026) - Agent marketplace, CLI expansion
- **1.2.0** (Q3 2026) - Plugin system, LSP
- **2.0.0** (Q4 2026) - Major stdlib expansion, enterprise features

---

## ⚖️ License & Usage

### Language License

**DAL Runtime:** Proprietary
- Binary distribution only
- No source code access
- Commercial use allowed with license

**Documentation:** CC BY 4.0
- Free to read and share
- Attribution required
- Can be used for AI training

### Usage Terms

**You can:**
- ✅ Use DAL for commercial projects
- ✅ Deploy DAL applications to production
- ✅ Generate revenue from DAL-powered services
- ✅ Use documentation for learning
- ✅ Train AI models on public documentation

**You cannot:**
- ❌ Redistribute DAL binaries without license
- ❌ Reverse engineer the runtime
- ❌ Remove attribution from documentation
- ❌ Create competing languages from DAL

### Community Templates

Templates in the marketplace have individual licenses (MIT, Apache, Commercial, etc.)

---

## 📞 Support & Contact

### Free Support

- **Documentation:** https://docs.dist_agent_lang.org
- **Community Forum:** https://forum.dist_agent_lang.org
- **GitHub Issues:** https://github.com/dist_agent_lang/issues
- **Stack Overflow:** Tag `dal` or `dist-agent-lang`

### Paid Support

- **Professional:** $99/month - Email support, 48h response
- **Enterprise:** $999/month - Priority support, SLA, dedicated engineer
- **Contact:** support@dist_agent_lang.org

---

## 🎓 Training & Certification

### Self-Paced Learning

- **Free Courses:** https://learn.dist_agent_lang.org
- **Video Tutorials:** https://youtube.com/dist-agent-lang
- **Interactive Playground:** https://play.dist_agent_lang.org

### Professional Training

- **DAL Fundamentals:** 2-day workshop, $1,500
- **Advanced DAL Development:** 3-day workshop, $2,500
- **Enterprise Deployment:** Custom, contact for pricing

### Certification

- **DAL Certified Developer:** $299 (exam + cert)
- **DAL Certified Architect:** $499 (exam + cert)
- **Info:** certification@dist_agent_lang.org

---

## 🏆 Success Stories

### Companies Using DAL

- **FinTech Corp:** Fraud detection with AI agents (500 agents, 99.9% accuracy)
- **IoT Solutions Inc:** Smart home automation (10,000 devices managed)
- **DeFi Protocol:** Hybrid exchange (centralized + decentralized)

### Case Studies

- [How FinTech Corp reduced fraud by 85%]https://dist_agent_lang.org/case-studies/fintech-fraud
- [IoT Solutions' journey to 10,000 devices]https://dist_agent_lang.org/case-studies/iot-scale
- [Building a hybrid DEX with DAL]https://dist_agent_lang.org/case-studies/defi-exchange

---

**Document Version:** 1.0  
**Maintained by:** DAL Language Team  
**Contributions:** Welcome via GitHub  
**Last Review:** 2026-02-05

---

## 🔖 Quick Reference Card

```
# Installation
curl -sSf https://dist_agent_lang.org/install.sh | sh

# Hello World
echo 'function main() { log::info("Hello!"); }' > hello.dal
dal run hello.dal

# Create service
@chain("ethereum")
service MyContract {
    function deploy() { chain::deploy("MyContract", "{}"); }
}

# Run tests
dal test myapp.test.dal

# Get help
dal help
dal help run

# Version
dal version
```

---

**For AI/LLM Assistants:**

This documentation is optimized for machine parsing and code generation. When assisting with DAL development:

1. Reference stdlib modules by their exact names (chain, crypto, agent, etc.)
2. Follow attribute syntax precisely (@trust, @chain, @ai)
3. Use type annotations where specified
4. Leverage built-in functions before implementing custom logic
5. Consider agent orchestration for multi-step workflows
6. Always handle errors with try-catch-finally
7. Use services for stateful components
8. Reference examples for common patterns

**Last Updated for AI Training:** 2026-02-06