-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetting-started.html
More file actions
487 lines (438 loc) · 36.6 KB
/
getting-started.html
File metadata and controls
487 lines (438 loc) · 36.6 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Getting Started — The SMOL Language documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/basic_mod.css?v=0.7.0-1" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="https://unpkg.com/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
<script src="_static/js/theme.js"></script>
<script src="_static/js/petite-vue.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="The SMOL Language Manual" href="language.html" />
<link rel="prev" title="Introduction" href="introduction.html" />
</head><body data-dark_mode_code_blocks="true">
<div id="top_nav">
<nav>
<p id="toggle_sidebar">
<a href="#" title="Toggle sidebar">|||</a>
</p>
<h1><a href="index.html" title="Go to homepage">SMOL</a></h1>
<a id="source_link" href="https://github.com/smolang/SemanticObjects/">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
<path fill="white" d="M 244.8,8 C 106.1,8 0,113.3 0,252 c 0,110.9 69.8,205.8 169.5,239.2 12.8,2.3 17.3,-5.6 17.3,-12.1 0,-6.2 -0.3,-40.4 -0.3,-61.4 0,0 -70,15 -84.7,-29.8 0,0 -11.4,-29.1 -27.8,-36.6 0,0 -22.9,-15.7 1.6,-15.4 0,0 24.9,2 38.6,25.8 21.9,38.6 58.6,27.5 72.9,20.9 2.3,-16 8.8,-27.1 16,-33.7 -55.9,-6.2 -112.3,-14.3 -112.3,-110.5 0,-27.5 7.6,-41.3 23.6,-58.9 -2.6,-6.5 -11.1,-33.3 2.6,-67.9 20.9,-6.5 69,27 69,27 20,-5.6 41.5,-8.5 62.8,-8.5 21.3,0 42.8,2.9 62.8,8.5 0,0 48.1,-33.6 69,-27 13.7,34.7 5.2,61.4 2.6,67.9 16,17.7 25.8,31.5 25.8,58.9 0,96.5 -58.9,104.2 -114.8,110.5 9.2,7.9 17,22.9 17,46.4 0,33.7 -0.3,75.4 -0.3,83.6 0,6.5 4.6,14.4 17.3,12.1 C 428.2,457.8 496,362.9 496,252 496,113.3 383.5,8 244.8,8 Z"/>
</svg>
</a>
<a id="mode_toggle" href="#" @click.prevent="handleClick" :title="mode">
<template v-if="mode == 'light'">
<svg width="100%" height="100%" viewBox="0 0 79 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g id="mode_light"><rect id="Bounds" x="0" y="-0" width="78.623" height="79.049" style="fill:none;"/><circle cx="39.311" cy="39.524" r="15.734" style="fill:#fff;"/><g id="beams"><g id="beam"><path id="beam1" serif:id="beam" d="M44.212,4.901c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,-0 -4.9,2.196 -4.9,4.901l-0,9.614c-0,2.705 2.196,4.901 4.9,4.901c2.705,0 4.901,-2.196 4.901,-4.901l0,-9.614Z" style="fill:#fff;"/></g><g id="beam2" serif:id="beam"><path id="beam3" serif:id="beam" d="M67.48,18.073c1.913,-1.912 1.913,-5.018 0,-6.931c-1.912,-1.912 -5.018,-1.912 -6.931,0l-6.798,6.799c-1.912,1.912 -1.912,5.018 0,6.931c1.913,1.912 5.018,1.912 6.931,-0l6.798,-6.799Z" style="fill:#fff;"/></g><g id="beam4" serif:id="beam"><path id="beam5" serif:id="beam" d="M25.728,61.108c1.912,-1.913 1.912,-5.018 -0,-6.931c-1.913,-1.913 -5.019,-1.913 -6.931,-0l-6.799,6.798c-1.912,1.913 -1.912,5.019 0,6.931c1.913,1.913 5.019,1.913 6.931,0l6.799,-6.798Z" style="fill:#fff;"/></g><g id="beam6" serif:id="beam"><path id="beam7" serif:id="beam" d="M60.682,54.177c-1.913,-1.913 -5.018,-1.913 -6.931,-0c-1.912,1.913 -1.912,5.018 0,6.931l6.798,6.798c1.913,1.913 5.019,1.913 6.931,0c1.913,-1.912 1.913,-5.018 0,-6.931l-6.798,-6.798Z" style="fill:#fff;"/></g><g id="beam8" serif:id="beam"><path id="beam9" serif:id="beam" d="M4.901,34.623c-2.705,0 -4.901,2.196 -4.901,4.901c0,2.705 2.196,4.901 4.901,4.901l9.614,0c2.705,0 4.901,-2.196 4.901,-4.901c0,-2.705 -2.196,-4.901 -4.901,-4.901l-9.614,0Z" style="fill:#fff;"/></g><g id="beam10" serif:id="beam"><path id="beam11" serif:id="beam" d="M44.212,64.534c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,-0 -4.9,2.196 -4.9,4.901l-0,9.614c-0,2.705 2.196,4.901 4.9,4.901c2.705,-0 4.901,-2.196 4.901,-4.901l0,-9.614Z" style="fill:#fff;"/></g><g id="beam12" serif:id="beam"><path id="beam13" serif:id="beam" d="M18.929,11.142c-1.912,-1.912 -5.018,-1.912 -6.931,0c-1.912,1.913 -1.912,5.019 0,6.931l6.799,6.799c1.912,1.912 5.018,1.912 6.931,-0c1.912,-1.913 1.912,-5.019 -0,-6.931l-6.799,-6.799Z" style="fill:#fff;"/></g><g id="beam14" serif:id="beam"><path id="beam15" serif:id="beam" d="M64.108,34.623c-2.705,0 -4.901,2.196 -4.901,4.901c-0,2.705 2.196,4.901 4.901,4.901l9.614,0c2.705,0 4.901,-2.196 4.901,-4.901c-0,-2.705 -2.196,-4.901 -4.901,-4.901l-9.614,0Z" style="fill:#fff;"/></g></g></g></svg>
</template>
<template v-if="mode == 'dark'">
<svg width="100%" height="100%" viewBox="0 0 79 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g id="mode_dark"><rect id="Bounds" x="0" y="-0" width="78.623" height="79.049" style="fill:none;"/><circle cx="39.311" cy="39.524" r="15.734" style="fill:#fff;"/><g id="beams"><g id="beam"><path id="beam1" serif:id="beam" d="M44.212,14.515c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,0 -4.901,2.196 -4.901,4.901c0,2.705 2.197,4.901 4.901,4.901c2.705,0 4.901,-2.196 4.901,-4.901Z" style="fill:#fff;"/></g><g id="beam2" serif:id="beam"><path id="beam3" serif:id="beam" d="M60.662,24.892c1.902,-1.902 1.902,-4.99 0,-6.892l-0.04,-0.039c-1.901,-1.902 -4.989,-1.902 -6.891,-0c-1.901,1.901 -1.901,4.989 0,6.891l0.04,0.04c1.902,1.901 4.989,1.901 6.891,-0Z" style="fill:#fff;"/></g><g id="beam4" serif:id="beam"><path id="beam5" serif:id="beam" d="M25.732,61.103c1.91,-1.91 1.91,-5.011 0,-6.921l-0.009,-0.01c-1.91,-1.91 -5.012,-1.91 -6.921,-0c-1.91,1.91 -1.91,5.011 -0,6.921l0.01,0.01c1.909,1.91 5.011,1.91 6.92,-0Z" style="fill:#fff;"/></g><g id="beam6" serif:id="beam"><path id="beam7" serif:id="beam" d="M60.672,54.167c-1.907,-1.907 -5.004,-1.907 -6.911,0l-0.02,0.02c-1.907,1.907 -1.907,5.004 0,6.911c1.907,1.907 5.004,1.907 6.911,-0l0.02,-0.02c1.907,-1.907 1.907,-5.004 0,-6.911Z" style="fill:#fff;"/></g><g id="beam8" serif:id="beam"><path id="beam9" serif:id="beam" d="M14.52,34.623c-2.702,0 -4.896,2.194 -4.896,4.896l0,0.01c0,2.702 2.194,4.896 4.896,4.896c2.702,0 4.896,-2.194 4.896,-4.896l-0,-0.01c-0,-2.702 -2.194,-4.896 -4.896,-4.896Z" style="fill:#fff;"/></g><g id="beam10" serif:id="beam"><path id="beam11" serif:id="beam" d="M44.212,64.534c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,-0 -4.901,2.196 -4.901,4.901c0,2.704 2.197,4.9 4.901,4.9c2.705,0 4.901,-2.196 4.901,-4.9Z" style="fill:#fff;"/></g><g id="beam12" serif:id="beam"><path id="beam13" serif:id="beam" d="M25.73,17.943c-1.911,-1.911 -5.015,-1.911 -6.926,0l-0.005,0.005c-1.911,1.911 -1.911,5.015 0,6.926c1.911,1.911 5.015,1.911 6.926,0l0.005,-0.005c1.911,-1.911 1.911,-5.014 -0,-6.926Z" style="fill:#fff;"/></g><g id="beam14" serif:id="beam"><path id="beam15" serif:id="beam" d="M64.098,34.623c-2.699,0 -4.891,2.192 -4.891,4.892l-0,0.019c-0,2.699 2.192,4.891 4.891,4.891c2.7,0 4.892,-2.192 4.892,-4.891l0,-0.019c0,-2.7 -2.192,-4.892 -4.892,-4.892Z" style="fill:#fff;"/></g></g></g></svg>
</template>
<template v-if="mode == 'darkest'">
<svg width="100%" height="100%" viewBox="0 0 79 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g id="mode_darkest"><rect id="Bounds" x="0" y="-0" width="78.623" height="79.049" style="fill:none;"/><path d="M39.315,23.791c8.684,-0 15.734,7.05 15.734,15.733c0,8.684 -7.05,15.734 -15.734,15.734c-8.683,0 -15.733,-7.05 -15.733,-15.734c-0,-8.683 7.05,-15.733 15.733,-15.733Zm0,4.737c6.069,0 10.997,4.927 10.997,10.996c-0,6.069 -4.928,10.996 -10.997,10.996c-6.068,0 -10.996,-4.927 -10.996,-10.996c0,-6.069 4.928,-10.996 10.996,-10.996Z" style="fill:#fff;"/><g id="beams"><g id="beam"><path id="beam1" serif:id="beam" d="M44.216,14.515c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,0 -4.9,2.196 -4.9,4.901c-0,2.705 2.196,4.901 4.9,4.901c2.705,0 4.901,-2.196 4.901,-4.901Z" style="fill:#fff;"/></g><g id="beam2" serif:id="beam"><path id="beam3" serif:id="beam" d="M60.666,24.892c1.902,-1.902 1.902,-4.99 0,-6.892l-0.04,-0.039c-1.901,-1.902 -4.989,-1.902 -6.891,-0c-1.901,1.901 -1.901,4.989 0,6.891l0.04,0.04c1.902,1.901 4.99,1.901 6.891,-0Z" style="fill:#fff;"/></g><g id="beam4" serif:id="beam"><path id="beam5" serif:id="beam" d="M25.737,61.103c1.909,-1.91 1.909,-5.011 -0,-6.921l-0.01,-0.01c-1.91,-1.91 -5.011,-1.91 -6.921,-0c-1.91,1.91 -1.91,5.011 -0,6.921l0.01,0.01c1.91,1.91 5.011,1.91 6.921,-0Z" style="fill:#fff;"/></g><g id="beam6" serif:id="beam"><path id="beam7" serif:id="beam" d="M60.676,54.167c-1.907,-1.907 -5.004,-1.907 -6.911,0l-0.02,0.02c-1.907,1.907 -1.907,5.004 0,6.911c1.907,1.907 5.004,1.907 6.911,-0l0.02,-0.02c1.907,-1.907 1.907,-5.004 0,-6.911Z" style="fill:#fff;"/></g><g id="beam8" serif:id="beam"><path id="beam9" serif:id="beam" d="M14.524,34.623c-2.702,0 -4.896,2.194 -4.896,4.896l0,0.01c0,2.702 2.194,4.896 4.896,4.896c2.702,0 4.896,-2.194 4.896,-4.896l0,-0.01c0,-2.702 -2.194,-4.896 -4.896,-4.896Z" style="fill:#fff;"/></g><g id="beam10" serif:id="beam"><path id="beam11" serif:id="beam" d="M44.216,64.534c0,-2.705 -2.196,-4.901 -4.901,-4.901c-2.704,-0 -4.9,2.196 -4.9,4.901c-0,2.704 2.196,4.9 4.9,4.9c2.705,0 4.901,-2.196 4.901,-4.9Z" style="fill:#fff;"/></g><g id="beam12" serif:id="beam"><path id="beam13" serif:id="beam" d="M25.734,17.943c-1.911,-1.911 -5.015,-1.911 -6.926,0l-0.005,0.005c-1.911,1.911 -1.911,5.015 0,6.926c1.911,1.911 5.015,1.911 6.926,0l0.005,-0.005c1.911,-1.911 1.911,-5.014 0,-6.926Z" style="fill:#fff;"/></g><g id="beam14" serif:id="beam"><path id="beam15" serif:id="beam" d="M64.103,34.623c-2.7,0 -4.892,2.192 -4.892,4.892l-0,0.019c-0,2.699 2.192,4.891 4.892,4.891c2.699,0 4.891,-2.192 4.891,-4.891l0,-0.019c0,-2.7 -2.192,-4.892 -4.891,-4.892Z" style="fill:#fff;"/></g></g></g></svg>
</template>
</a>
<script>
(function() {
const LOCAL_STORAGE_KEY = 'piccoloThemeMode'
var initialMode = localStorage.getItem(LOCAL_STORAGE_KEY)
if (initialMode) {
// Make sure the value in local storage is valid
if (['light', 'dark', 'darkest'].indexOf(initialMode) == -1) {
initialMode = 'light'
localStorage.setItem(LOCAL_STORAGE_KEY, initialMode)
}
} else {
// Check if the client prefers dark mode
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
initialMode = 'dark'
} else {
initialMode = 'light'
}
localStorage.setItem(LOCAL_STORAGE_KEY, initialMode)
}
document.documentElement.dataset.mode = initialMode
PetiteVue.createApp({
'mode': initialMode,
handleClick() {
let currentMode = this.mode
if (currentMode == 'light') {
this.mode = 'dark'
} else if (currentMode == 'dark') {
this.mode = 'darkest'
} else if (currentMode == 'darkest') {
this.mode = 'light'
}
document.documentElement.dataset.mode = this.mode
localStorage.setItem(LOCAL_STORAGE_KEY, this.mode)
console.log(this.mode)
}
}).mount('#mode_toggle')
})()
</script>
<p class="mobile_search_link">
<a href="search.html" title="Search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 65 64" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">
<path d="M14.873 40.009c-2.315-3.943-3.642-8.532-3.642-13.429C11.231 11.91 23.141 0 37.811 0s26.58 11.91 26.58 26.58-11.91 26.58-26.58 26.58a26.44 26.44 0 0 1-14.277-4.161L9.739 62.794a3.12 3.12 0 0 1-4.413 0L.913 58.382c-1.217-1.218-1.217-3.196 0-4.413l13.96-13.96zM37.811 8.054c10.225 0 18.526 8.301 18.526 18.526s-8.301 18.526-18.526 18.526-18.526-8.301-18.526-18.526S27.586 8.054 37.811 8.054z" fill="#fff" />
</svg>
</a>
</p>
<div class="searchbox_wrapper">
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</nav>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"><ul class="current">
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="language.html">Language Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="internals.html">Internals</a></li>
<li class="toctree-l1"><a class="reference internal" href="publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="lab.html">Digital Twin Lab</a></li>
</ul>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this heading">¶</a></h1>
<section id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">¶</a></h2>
<p>Currently, SMOL is best installed from source.</p>
<p>SMOL needs a Java JDK (version 11 or later) to be installed. The smol source
code can be checked out via:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="n">git</span><span class="w"> </span><span class="n">clone</span><span class="w"> </span><span class="n">https</span><span class="p">:</span><span class="c1">//github.com/smolang/SemanticObjects.git</span>
</pre></div>
</div>
<p>or by downloading and unpacking the zip archive from
<a class="reference external" href="https://github.com/smolang/SemanticObjects/archive/refs/heads/master.zip">https://github.com/smolang/SemanticObjects/archive/refs/heads/master.zip</a>.</p>
<p>After obtaining the source code, change into that directory and execute the command:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="p">.</span><span class="o">/</span><span class="n">gradlew</span><span class="w"> </span><span class="n">assemble</span>
</pre></div>
</div>
<p>After a successful build, the SMOL REPL can be started in that directory via:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="n">java</span><span class="w"> </span><span class="o">-</span><span class="n">jar</span><span class="w"> </span><span class="n">build</span><span class="o">/</span><span class="n">libs</span><span class="o">/</span><span class="n">smol</span><span class="p">.</span><span class="na">jar</span>
</pre></div>
</div>
<section id="editor-support">
<h3>Editor Support<a class="headerlink" href="#editor-support" title="Permalink to this heading">¶</a></h3>
<p>There is basic support for SMOL for the following editors:</p>
<ul>
<li><p><a class="reference external" href="https://github.com/atom/atom">Atom</a></p>
<p>Supports syntax highlighting. Source, installation instructions at <a class="reference external" href="https://github.com/smolang/SemanticObjects/tree/master/editor-support/atom">https://github.com/smolang/SemanticObjects/tree/master/editor-support/atom</a></p>
</li>
<li><p><a class="reference external" href="https://www.gnu.org/software/emacs/">Emacs</a></p>
<p>Adds support for syntax highlighting and for running a SMOL REPL inside Emacs. Source, installation instructions at <a class="reference external" href="https://github.com/smolang/SemanticObjects/tree/master/editor-support/emacs">https://github.com/smolang/SemanticObjects/tree/master/editor-support/emacs</a></p>
</li>
<li><p><a class="reference external" href="https://code.visualstudio.com">Visual Studio Code</a></p>
<p>Supports syntax highlighting. Source, installation instructions at <a class="reference external" href="https://github.com/smolang/smol-vs-code">https://github.com/smolang/smol-vs-code</a>. Latest release at <a class="reference external" href="https://github.com/smolang/smol-vs-code/releases/latest">https://github.com/smolang/smol-vs-code/releases/latest</a>.</p>
</li>
</ul>
</section>
</section>
<section id="running-a-simple-smol-program">
<h2>Running a Simple SMOL Program<a class="headerlink" href="#running-a-simple-smol-program" title="Permalink to this heading">¶</a></h2>
<p>SMOL itself is started from the command line and is typically used via an
interactive prompt (a.k.a. <a class="reference internal" href="glossary.html#term-REPL"><span class="xref std std-term">REPL</span></a>).</p>
<p>Here is a SMOL program that prints the canonical message:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="n">main</span>
<span class="w"> </span><span class="nf">print</span><span class="p">(</span><span class="s">"Hello world!"</span><span class="p">);</span>
<span class="n">end</span>
</pre></div>
</div>
<p>To run this code, save it in a file <code class="docutils literal notranslate"><span class="pre">hello-world.smol</span></code>, and run it from the
REPL:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="n">MO</span><span class="o">></span><span class="w"> </span><span class="n">read</span><span class="w"> </span><span class="n">hello</span><span class="o">-</span><span class="n">world</span><span class="p">.</span><span class="na">smol</span>
<span class="n">MO</span><span class="o">></span><span class="w"> </span><span class="n">auto</span>
<span class="s">"Hello world!"</span>
<span class="n">MO</span><span class="o">></span>
</pre></div>
</div>
<p>Instead of separate <code class="docutils literal notranslate"><span class="pre">read</span></code> and <code class="docutils literal notranslate"><span class="pre">auto</span></code> commands, you can also use
<code class="docutils literal notranslate"><span class="pre">reada</span></code>; see <a class="reference internal" href="#repl"><span class="std std-ref">The SMOL interactive REPL</span></a> for a full list of commands.</p>
<p>Here is a more involved example, involving classes and breakpoints:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="kd">class</span> <span class="nf">Hello</span><span class="p">(</span><span class="n">String</span><span class="w"> </span><span class="n">message</span><span class="p">)</span>
<span class="w"> </span><span class="n">Unit</span><span class="w"> </span><span class="nf">say_hello</span><span class="p">()</span>
<span class="w"> </span><span class="n">print</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="na">message</span><span class="p">);</span>
<span class="w"> </span><span class="n">end</span>
<span class="n">end</span>
<span class="n">main</span>
<span class="w"> </span><span class="nf">print</span><span class="p">(</span><span class="s">"Creating class ..."</span><span class="p">);</span>
<span class="w"> </span><span class="n">Hello</span><span class="w"> </span><span class="n">hello</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">Hello</span><span class="p">(</span><span class="s">"Hello world!"</span><span class="p">);</span>
<span class="w"> </span><span class="n">breakpoint</span><span class="p">;</span>
<span class="w"> </span><span class="n">hello</span><span class="p">.</span><span class="na">say_hello</span><span class="p">();</span>
<span class="n">end</span>
</pre></div>
</div>
<p>Since the program will stop execution at the breakpoint, the runtime state can
be queried from the REPL:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="n">MO</span><span class="o">></span><span class="w"> </span><span class="n">reada</span><span class="w"> </span><span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">rudi</span><span class="o">/</span><span class="n">Source</span><span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">hello</span><span class="o">-</span><span class="n">world</span><span class="p">.</span><span class="na">smol</span>
<span class="s">"Creating class ..."</span>
<span class="n">MO</span><span class="o">></span><span class="w"> </span><span class="n">query</span><span class="w"> </span><span class="n">SELECT</span><span class="w"> </span><span class="o">?</span><span class="n">obj</span><span class="w"> </span><span class="o">?</span><span class="n">message</span><span class="w"> </span><span class="n">WHERE</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">?</span><span class="n">obj</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">prog</span><span class="p">:</span><span class="n">Hello</span><span class="p">.</span><span class="w"> </span><span class="o">?</span><span class="n">obj</span><span class="w"> </span><span class="n">prog</span><span class="p">:</span><span class="n">Hello_message</span><span class="w"> </span><span class="o">?</span><span class="n">message</span><span class="p">.</span><span class="w"> </span><span class="p">}</span>
<span class="o">--------------------------------------------------------------------------------------</span>
<span class="o">|</span><span class="w"> </span><span class="n">obj</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">message</span><span class="w"> </span><span class="o">|</span>
<span class="o">======================================================================================</span>
<span class="o">|</span><span class="w"> </span><span class="o"><</span><span class="n">https</span><span class="p">:</span><span class="c1">//github.com/Edkamb/SemanticObjects/Run1660809137988#obj3> | "Hello world!" |</span>
<span class="o">--------------------------------------------------------------------------------------</span>
<span class="n">MO</span><span class="o">></span><span class="w"> </span><span class="n">auto</span>
<span class="s">"Hello world!"</span>
<span class="n">MO</span><span class="o">></span>
</pre></div>
</div>
<p>Runtime state is queried using the SPARQL query language, both from the REPL
and in the program.</p>
</section>
<section id="smol-command-line-parameters">
<h2>SMOL Command-Line Parameters<a class="headerlink" href="#smol-command-line-parameters" title="Permalink to this heading">¶</a></h2>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span>Options:
-e, -l, --execute, --load
-j, --jenaReasoner TEXT Set value of the internally used reasoner to
'off', 'rdfs', or 'owl' (default -> 'owl')
-s, --sparqlEndpoint TEXT url for SPARQL endpoint
-b, --back PATH path to a file containing OWL class definitions
as background knowledge.
-d, --domain TEXT prefix for domain:.
-i, --input PATH path to a .smol file which is loaded on startup.
-r, --replay PATH path to a file containing a series of REPL
commands.
-o, --outdir PATH path to a directory used to create data files.
-v, --verbose Verbose output.
-m, --materialize Materialize triples and dump to file.
-q, --useQueryType Activates the type checker for access
-p, --prefixes VALUE Extra prefixes, given as a list -p PREFIX1=URI1
-p PREFIX2=URI2
-h, --help Show this message and exit
</pre></div>
</div>
</section>
<section id="the-smol-interactive-repl">
<span id="repl"></span><h2>The SMOL interactive REPL<a class="headerlink" href="#the-smol-interactive-repl" title="Permalink to this heading">¶</a></h2>
<p>SMOL programs are run and queried via the <a class="reference internal" href="glossary.html#term-REPL"><span class="xref std std-term">REPL</span></a>. Currently, the
REPL offers the following commands:</p>
<section id="general-commands">
<h3>General Commands<a class="headerlink" href="#general-commands" title="Permalink to this heading">¶</a></h3>
<table class="docutils align-left">
<thead>
<tr class="row-odd"><th class="head"><p>Command</p></th>
<th class="head"><p>Description</p></th>
<th class="head"><p>Parameters</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">exit</span></code></p></td>
<td><p>exits the REPL</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">verbose</span></code> <em>enabled</em></p></td>
<td><p>Sets verbose output to on or off</p></td>
<td><p><em>enabled</em>: <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">outdir</span></code> <em>path</em></p></td>
<td><p>Sets or prints the directory where SMOL write data files</p></td>
<td><p><em>path</em>: a directory name; if omitted, print the current value</p></td>
</tr>
</tbody>
</table>
</section>
<section id="commands-for-running-smol">
<h3>Commands for Running SMOL<a class="headerlink" href="#commands-for-running-smol" title="Permalink to this heading">¶</a></h3>
<table class="docutils align-left">
<thead>
<tr class="row-odd"><th class="head"><p>Command</p></th>
<th class="head"><p>Description</p></th>
<th class="head"><p>Parameters</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">read</span></code> <em>file</em></p></td>
<td><p>reads a SMOL file</p></td>
<td><p><em>file</em>: Path to the <code class="docutils literal notranslate"><span class="pre">.smol</span></code> file</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">reada</span></code> <em>file</em></p></td>
<td><p>reads and runs the given file</p></td>
<td><p><em>file</em>: Path to the <code class="docutils literal notranslate"><span class="pre">.smol</span></code> file</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">auto</span></code></p></td>
<td><p>starts or continues execution of the currently-loaded smol file until
the next breakpoint</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">step</span></code></p></td>
<td><p>executes the next statement</p></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="commands-for-querying-smol">
<span id="querying-smol"></span><h3>Commands for Querying SMOL<a class="headerlink" href="#commands-for-querying-smol" title="Permalink to this heading">¶</a></h3>
<table class="docutils align-left">
<thead>
<tr class="row-odd"><th class="head"><p>Command</p></th>
<th class="head"><p>Description</p></th>
<th class="head"><p>Parameters</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">eval</span></code> <em>expression</em></p></td>
<td><p>evaluates a smol expression in the current program state</p></td>
<td><p><em>expression</em>: a smol expression</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">query</span></code> <em>query</em></p></td>
<td><p>executes a SPARQL query in the current program state</p></td>
<td><p><em>query</em>: The SPARQL query to execute</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">source</span></code> <em>source</em> <em>enabled</em></p></td>
<td><p>Set which sources to include (true) or exclude (false) when querying</p></td>
<td><ul class="simple">
<li><p><em>source</em>: <code class="docutils literal notranslate"><span class="pre">heap</span></code> or <code class="docutils literal notranslate"><span class="pre">staticTable</span></code> or <code class="docutils literal notranslate"><span class="pre">vocabularyFile</span></code> or
<code class="docutils literal notranslate"><span class="pre">externalOntology</span></code></p></li>
<li><p><em>enabled</em>: <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code></p></li>
</ul>
</td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">reasoner</span></code> <em>reasoner</em></p></td>
<td><p>Specify which Jena reasoner to use, or turn it off</p></td>
<td><p><em>reasoner</em>: <code class="docutils literal notranslate"><span class="pre">off</span></code> or <code class="docutils literal notranslate"><span class="pre">rdfs</span></code> or <code class="docutils literal notranslate"><span class="pre">owl</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">class</span></code> <em>class</em></p></td>
<td><p>List all members of a class</p></td>
<td><p><em>class</em>: class expression in Manchester Syntax, e.g., <code class="docutils literal notranslate"><span class="pre"><smol:Class></span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">plot</span></code> <em>role</em> <em>port</em> <em>from</em> <em>to</em></p></td>
<td><p>Plots data from the given output port of an <a class="reference internal" href="glossary.html#term-FMO"><span class="xref std std-term">FMO</span></a> in the given interval.
In order to use this command, gnuplot must be installed.</p></td>
<td><ul class="simple">
<li><p><em>role</em>: The <a class="reference internal" href="glossary.html#term-FMO"><span class="xref std std-term">FMO</span></a> to plot data from, as named by its <code class="docutils literal notranslate"><span class="pre">role</span></code> field.</p></li>
<li><p><em>port</em>: The output port of the FMO to be plotted</p></li>
<li><p><em>from</em>: (optional) the starting time of the plot</p></li>
<li><p><em>to</em>: (optional) the end time of the plot</p></li>
</ul>
</td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">dump</span></code> <em>file</em></p></td>
<td><p>Create file in <code class="docutils literal notranslate"><span class="pre">outdir</span></code> containing the current heap state in TRTL
format</p></td>
<td><p><em>file</em> (optional): the file to create; default <code class="docutils literal notranslate"><span class="pre">output.ttl</span></code></p></td>
</tr>
</tbody>
</table>
</section>
<section id="diagnostic-commands">
<h3>Diagnostic Commands<a class="headerlink" href="#diagnostic-commands" title="Permalink to this heading">¶</a></h3>
<table class="docutils align-left">
<thead>
<tr class="row-odd"><th class="head"><p>Command</p></th>
<th class="head"><p>Description</p></th>
<th class="head"><p>Parameters</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">consistency</span></code></p></td>
<td><p>Print all classes and check that the internal ontology is consistent</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">info</span></code></p></td>
<td><p>Print static information in internal format</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">examine</span></code></p></td>
<td><p>Print state in internal format</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">guards</span></code> <em>guard</em> <em>enabled</em></p></td>
<td><p>Enables/disables guard clauses when searching for triples in the heap
or the static table. This command is mainly used for debugging and
performance measuring.</p></td>
<td><ul class="simple">
<li><p><em>guard</em>: <code class="docutils literal notranslate"><span class="pre">heap</span></code> or <code class="docutils literal notranslate"><span class="pre">staticTable</span></code></p></li>
<li><p><em>enabled</em>: <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code></p></li>
</ul>
</td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">virtual</span></code> <em>guard</em> <em>enabled</em></p></td>
<td><p>Enables/disables virtualization searching for triples in the heap or
the static table. This command is mainly used for debugging and
performance measuring.</p></td>
<td><ul class="simple">
<li><p><em>guard</em>: <code class="docutils literal notranslate"><span class="pre">heap</span></code> or <code class="docutils literal notranslate"><span class="pre">staticTable</span></code></p></li>
<li><p><em>enabled</em>: <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code></p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div id="show_right_sidebar">
<p><a class="toggle_right_sidebar" href="#"><span class="icon"><</span><span>Page contents<span></a></p>
</div>
<div id="right_sidebar">
<p><a class="toggle_right_sidebar" href="#"><span class="icon">></span><span>Page contents:<span></a></p>
<div class="page_toc">
<ul>
<li><a class="reference internal" href="#">Getting Started</a><ul>
<li><a class="reference internal" href="#installation">Installation</a><ul>
<li><a class="reference internal" href="#editor-support">Editor Support</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-a-simple-smol-program">Running a Simple SMOL Program</a></li>
<li><a class="reference internal" href="#smol-command-line-parameters">SMOL Command-Line Parameters</a></li>
<li><a class="reference internal" href="#the-smol-interactive-repl">The SMOL interactive REPL</a><ul>
<li><a class="reference internal" href="#general-commands">General Commands</a></li>
<li><a class="reference internal" href="#commands-for-running-smol">Commands for Running SMOL</a></li>
<li><a class="reference internal" href="#commands-for-querying-smol">Commands for Querying SMOL</a></li>
<li><a class="reference internal" href="#diagnostic-commands">Diagnostic Commands</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="button_nav_wrapper">
<div class="button_nav">
<div class="left">
<a href="introduction.html">
<span class="icon"><</span><span>Introduction</span></a>
</div>
<div class="right">
<a href="language.html"><span>The SMOL Language Manual</span><span class="icon">></span></a>
</div>
</div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2022-2024, Eduard Kamburjan, Rudolf Schlatte.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 6.1.3.
</div>
<p id="theme_credit">Styled using the <a href="https://github.com/piccolo-orm/piccolo_theme">Piccolo Theme</a></p>
</body>
</html>