-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
524 lines (464 loc) · 20 KB
/
Copy pathindex.html
File metadata and controls
524 lines (464 loc) · 20 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Gengoscript is a host-embedded scripting language for user-defined logic under explicit host control, with named types, capability-gated integration, and bounded execution.">
<link rel="canonical" href="https://gengoscript.org/">
<meta property="og:title" content="Gengoscript — Embeddable Scripting Language for Host-Controlled User Logic">
<meta property="og:description" content="Host-embedded scripting for user-defined logic under explicit host control, with named types, capability-gated integration, and bounded execution.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://gengoscript.org/">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Gengoscript — Embeddable Scripting Language for Host-Controlled User Logic">
<meta name="twitter:description" content="Host-embedded scripting for user-defined logic under explicit host control, with named types, capability-gated integration, and bounded execution.">
<title>Gengoscript — Embeddable Scripting Language for Host-Controlled User Logic</title>
<style>
:root {
--bg: #fbfaf6;
--fg: #161616;
--accent: #6b6f7a;
--code-bg: #f4f1eb;
--border: #1f2d3d;
--syntax-keyword: #9a2f5d;
--syntax-type: #245f88;
--syntax-string: #1f6a4f;
--syntax-comment: #7a7f8a;
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
--bg: #101316;
--fg: #edf1f5;
--accent: #9aa6b2;
--code-bg: #151b22;
--border: #7fb3d5;
--syntax-keyword: #ff7aa2;
--syntax-type: #7cc7ff;
--syntax-string: #7ee0a7;
--syntax-comment: #7f8a96;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #101316;
--fg: #edf1f5;
--accent: #9aa6b2;
--code-bg: #151b22;
--border: #7fb3d5;
--syntax-keyword: #ff7aa2;
--syntax-type: #7cc7ff;
--syntax-string: #7ee0a7;
--syntax-comment: #7f8a96;
}
}
* { box-sizing: border-box; }
body {
font-family: var(--font-sans);
line-height: 1.5;
color: var(--fg);
background:
radial-gradient(circle at top left, rgba(127, 179, 213, 0.10), transparent 28rem),
radial-gradient(circle at top right, rgba(154, 47, 93, 0.06), transparent 24rem),
var(--bg);
max-width: 900px;
margin: 0 auto;
padding: 4rem 2rem;
text-rendering: optimizeLegibility;
overflow-x: hidden;
}
header {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 5rem;
font-family: var(--font-mono);
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
h1 {
font-size: 1rem;
font-weight: 700;
margin: 0;
}
nav {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem 1.25rem;
}
nav a {
text-decoration: none;
color: var(--fg);
border-bottom: 1px solid transparent;
}
nav a:hover {
border-bottom: 1px solid var(--fg);
}
.theme-toggle {
background: none;
border: 1px solid var(--border);
color: var(--fg);
font-family: var(--font-mono);
font-size: 0.75rem;
text-transform: uppercase;
padding: 0.25rem 0.5rem;
cursor: pointer;
transition: all 0.2s;
}
.theme-toggle:hover {
background: var(--fg);
color: var(--bg);
}
section {
margin-bottom: 5rem;
display: grid;
grid-template-columns: 200px 1fr;
gap: 2rem;
}
@media (max-width: 768px) {
section {
grid-template-columns: 1fr;
gap: 1rem;
}
.section-label {
margin-bottom: 0.5rem;
}
}
.section-label {
font-family: var(--font-mono);
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--fg);
}
.section-content {
font-size: 1rem;
min-width: 0;
}
h2 {
font-size: 1.25rem;
font-weight: 600;
margin: 0 0 1.5rem 0;
line-height: 1.2;
}
p {
margin: 0 0 1.5rem 0;
max-width: 60ch;
}
.hero-text {
font-size: 1.5rem;
line-height: 1.3;
font-weight: 500;
margin-bottom: 2rem;
}
.features-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 3rem 2rem;
}
.examples-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1.5rem;
margin-top: 2rem;
}
.example-card {
border: 1px solid rgba(31, 45, 61, 0.12);
padding: 1.25rem;
background: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .example-card {
border-color: rgba(127, 179, 213, 0.28);
background: rgba(21, 27, 34, 0.34);
}
.example-card h3 {
font-family: var(--font-mono);
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
margin: 0 0 0.75rem 0;
}
.example-card p {
color: var(--accent);
font-size: 0.95rem;
margin-bottom: 1rem;
}
.example-card pre {
margin: 0;
padding: 1.25rem;
font-size: 0.82rem;
}
@media (max-width: 600px) {
.features-grid {
grid-template-columns: 1fr;
}
body {
padding: 2.5rem 1rem;
}
header {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
margin-bottom: 3rem;
}
nav {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
width: 100%;
gap: 0.75rem;
}
nav a,
.theme-toggle {
margin: 0;
width: 100%;
text-align: center;
padding: 0.5rem 0.75rem;
border: 1px solid var(--border);
}
pre {
padding: 1rem;
font-size: 0.78rem;
}
}
.feature h3 {
font-family: var(--font-mono);
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
margin: 0 0 0.75rem 0;
}
.feature p {
font-size: 0.95rem;
color: var(--accent);
margin: 0;
}
pre {
background: var(--code-bg);
padding: 2rem;
margin: 0 0 2rem 0;
overflow-x: auto;
max-width: 100%;
font-family: var(--font-mono);
font-size: 0.9rem;
border-left: 2px solid var(--border);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
code {
font-family: inherit;
}
footer {
margin-top: 8rem;
padding-top: 2rem;
font-family: var(--font-mono);
font-size: 0.75rem;
text-transform: uppercase;
color: var(--accent);
display: flex;
justify-content: space-between;
}
.cta {
font-family: var(--font-mono);
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
text-decoration: none;
color: var(--fg);
border: 1px solid var(--border);
padding: 0.75rem 1.5rem;
display: inline-block;
transition: all 0.2s;
}
.cta:hover {
background: var(--fg);
color: var(--bg);
}
.doc-link {
text-decoration: underline;
color: inherit;
text-underline-offset: 4px;
}
/* Syntax Highlighting */
.k { font-weight: 700; color: var(--syntax-keyword); } /* Keyword */
.t { font-weight: 700; color: var(--syntax-type); } /* Type */
.s { color: var(--syntax-string); } /* String */
.c { color: var(--syntax-comment); font-style: italic; } /* Comment */
</style>
</head>
<body>
<header>
<h1>Gengoscript</h1>
<nav>
<a href="https://github.com/gengoscript/gengo">Source</a>
<a href="https://github.com/gengoscript/gengo/releases">Releases</a>
<a href="https://docs.gengoscript.org">Docs</a>
<a href="https://playground.gengoscript.org">Playground</a>
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme">SYSTEM</button>
</nav>
</header>
<script>
const toggle = document.getElementById('theme-toggle');
const root = document.documentElement;
const systemQuery = window.matchMedia('(prefers-color-scheme: dark)');
const getTheme = () => localStorage.getItem('theme') || 'auto';
const updateToggleLabel = (theme) => {
if (theme === 'auto') {
const effective = systemQuery.matches ? 'DARK' : 'LIGHT';
toggle.textContent = `SYSTEM (${effective})`;
} else {
toggle.textContent = theme.toUpperCase();
}
};
const setTheme = (theme) => {
if (theme === 'auto') {
root.removeAttribute('data-theme');
} else {
root.setAttribute('data-theme', theme);
}
updateToggleLabel(theme);
localStorage.setItem('theme', theme);
};
toggle.addEventListener('click', () => {
const current = getTheme();
if (current === 'auto') setTheme('light');
else if (current === 'light') setTheme('dark');
else setTheme('auto');
});
systemQuery.addEventListener('change', () => {
if (getTheme() === 'auto') updateToggleLabel('auto');
});
// Initialize
setTheme(getTheme());
</script>
<main>
<section id="name">
<div class="section-label">Name</div>
<div class="section-content">
<p class="hero-text">gengoscript — an embeddable scripting language for host applications that need user-defined logic without ambient machine access.</p>
<p>Constraints live in the language, bad values fail at construction, and system access exists only when the host exposes it.</p>
</div>
</section>
<section id="synopsis">
<div class="section-label">Synopsis</div>
<div class="section-content">
<p>Gengoscript gives hosts constrained domain values, explicit imports, and user-defined logic that can reach only the capabilities the host exposes.</p>
<pre><code>std := <span class="k">import</span>(<span class="s">"std"</span>)
<span class="k">type</span> Port <span class="t">int</span> <span class="k">range</span> 1..65535
<span class="k">type</span> Region <span class="t">string</span> <span class="k">predicate</span> <span class="k">func</span>(s) {
<span class="k">return</span> s == <span class="s">"eu-west"</span> <span class="k">or</span> s == <span class="s">"us-east"</span>
}
<span class="k">type</span> RolloutPercent <span class="t">int</span> <span class="k">range</span> 0..100
<span class="k">type</span> Decision <span class="t">variant</span> {
allow,
deny(reason <span class="t">string</span>),
}
<span class="k">pub func</span> decide_deploy(
raw_port <span class="t">int</span>,
raw_region <span class="t">string</span>,
raw_rollout <span class="t">int</span>,
) Decision {
port := Port(raw_port)
region := Region(raw_region)
rollout := RolloutPercent(raw_rollout)
<span class="k">if</span> port != Port(443) {
<span class="k">return</span> Decision.deny(<span class="s">"only https is allowed"</span>)
}
<span class="k">if</span> region != Region(<span class="s">"eu-west"</span>) {
<span class="k">return</span> Decision.deny(<span class="s">"region not enabled"</span>)
}
<span class="k">if</span> rollout > RolloutPercent(25) {
<span class="k">return</span> Decision.deny(<span class="s">"rollout exceeds safe limit"</span>)
}
<span class="k">return</span> Decision.allow
}</code></pre>
<div class="examples-grid">
<div class="example-card">
<h3>Domain Rules</h3>
<p>Make invalid values fail where they enter the script instead of leaking further into host-side code.</p>
<pre><code><span class="k">type</span> Currency <span class="t">string</span> <span class="k">predicate</span> <span class="k">func</span>(s) {
<span class="k">return</span> s == <span class="s">"USD"</span> <span class="k">or</span> s == <span class="s">"EUR"</span>
}
<span class="k">type</span> Discount <span class="t">int</span> <span class="k">range</span> 0..100
currency := Currency(<span class="s">"EUR"</span>)
sale := Discount(15)</code></pre>
</div>
<div class="example-card">
<h3>Policy Logic</h3>
<p>Decision logic can carry domain constraints directly instead of relying on the host to validate every input first.</p>
<pre><code><span class="k">type</span> EventCode <span class="t">int</span> <span class="k">predicate</span> <span class="k">func</span>(x) {
<span class="k">return</span> x <span class="k">rem</span> 2 == 0
}
<span class="k">type</span> SourceId <span class="t">string</span> <span class="k">predicate</span> <span class="k">func</span>(s) {
<span class="k">return</span> s == <span class="s">"sensor-a"</span> <span class="k">or</span> s == <span class="s">"sensor-b"</span>
}
<span class="k">pub func</span> accept(code <span class="t">int</span>, source <span class="t">string</span>) <span class="t">bool</span> {
c := EventCode(code)
s := SourceId(source)
<span class="k">return</span> c == EventCode(42) <span class="k">and</span> s == SourceId(<span class="s">"sensor-a"</span>)
}</code></pre>
</div>
<div class="example-card">
<h3>Host-Granted Access</h3>
<p>Imports are explicit. Filesystem, HTTP, and host modules exist only when the embedding application exposes them.</p>
<pre><code>http := <span class="k">import</span>(<span class="s">"cap:http"</span>)
cfg := <span class="k">import</span>(<span class="s">"host:deploy"</span>)
resp, err := http.get(cfg.healthcheck_url())
ok := err == <span class="k">null</span></code></pre>
</div>
</div>
</div>
</section>
<section id="description">
<div class="section-label">Description</div>
<div class="section-content">
<p>Gengoscript is a host-embedded language for running untrusted or user-supplied scripts under explicit host control. Scripts get language utilities through <code>std</code>, but filesystem, network, and host integration exist only if the embedding application grants them.</p>
<p>Each runtime instance is isolated and host-configured. The host decides which capability modules and host modules exist, whether script I/O is enabled, and what instruction, heap, stack, and frame limits apply to execution.</p>
<div class="features-grid">
<div class="feature">
<h3>Capabilities</h3>
<p>Filesystem, HTTP, and other system access are opt-in. Scripts can import only the capability and host modules the application exposes.</p>
</div>
<div class="feature">
<h3>Nominal Types</h3>
<p>Domain rules live in the script itself. Range types, predicates, and subtypes let bad values fail at construction instead of later in host-side validation.</p>
</div>
<div class="feature">
<h3>Embedding</h3>
<p>Embed from Zig through the runtime API or from other hosts through the C-compatible engine surface. Load a script, call exported functions, or drive the engine directly through calls such as <code>engine_run</code> and <code>engine_call</code>.</p>
</div>
<div class="feature">
<h3>Bounded Execution</h3>
<p>Instruction budgets, heap limits, stack limits, and per-instance isolation let hosts bound script cost and contain failure scope.</p>
</div>
</div>
</div>
</section>
<section id="quickstart">
<div class="section-label">Quickstart</div>
<div class="section-content">
<p>Install from the published artifacts on <a href="https://github.com/gengoscript/gengo/releases" class="doc-link">GitHub Releases</a>, or build the CLI from source when you want the latest tree. Gengoscript requires Zig 0.16.0 for source builds.</p>
<p>Use the native CLI for local development and REPL work. Build the WASI target when you want the WebAssembly runtime described in the docs, or when you want to run the CLI through <code>wasmtime</code>.</p>
<pre><code><span class="c"># Build CLI from source</span>
zig build -Dpreset=1m cli
<span class="c"># Build WASI runtime</span>
zig build -Dpreset=1m wasi
<span class="c"># Execute</span>
./zig-out/bin/gengo script.gengo
<span class="c"># Run the WASI build with wasmtime</span>
wasmtime --dir . ./build/gengo-cli.wasm -- script.gengo</code></pre>
<p>Installation is documented through published artifacts and explicit build steps, not remote shell bootstrap scripts.</p>
<p>Start with the <a href="https://playground.gengoscript.org" class="doc-link">Playground</a> for a quick feel, the <a href="https://docs.gengoscript.org" class="doc-link">docs</a> for the language and embedding model, or <a href="https://github.com/gengoscript/gengo" class="doc-link">GitHub</a> for the source tree and releases.</p>
<div style="margin-top: 2rem; display: flex; gap: 1rem; flex-wrap: wrap;">
<a href="https://github.com/gengoscript/gengo" class="cta">View on GitHub</a>
<a href="https://playground.gengoscript.org" class="cta" style="background: transparent; color: var(--fg);">Open Playground</a>
</div>
</div>
</section>
</main>
<footer>
<span>Gengoscript</span>
<a href="https://github.com/gengoscript/gengo/blob/main/LICENSE" class="doc-link">MIT License</a>
</footer>
</body>
</html>