-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsepl.html
474 lines (471 loc) · 15.4 KB
/
sepl.html
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
<!DOCTYPE html>
<html>
<head>
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="https://wunder-wulfe.github.io/sepl.html" />
<meta name="twitter:title" content="SEPL, a Programming Language" />
<meta name="twitter:description" content="A simple, educational programming language that compiles to a simpler to parse esoteric coding language." />
<meta name="twitter:image" content="https://i.gyazo.com/18b3e871c4a91f702d5f21af090c48c6.png" />
<meta name="twitter:image:alt" content="SEPL" />
<!--<meta name="theme-color" content="#281E53">-->
<link rel="stylesheet" href="sepl.css">
<script src="jquery-3.4.1.min.js"></script>
</head>
<body>
<span>
<center>
<a href="https://discord.gg/yUCtC2N" target="_blank">Discord</a> <a href="https://www.patreon.com/WunderWulfe" target="_blank">Patreon</a>
</center>
</span>
<br />
<br />
<textarea id="typer" rows=12 placeholder="Your Code Here..."></textarea>
<div id="counter">
<div id="lines">
</div>
<div id="coder">
</div>
</div>
<hr />
<button id="pressbtn" type="submit">
Execute
</button>
<button id="pressimp" type="submit" style="float:right;">
Import
</button>
<input id="pressimpd" type="file" accept=".sepl" style="display:none;">
<a id="exportfile" href="" download="Untitled.sepl">
<button id="press" type="submit" style="float:right;">
Export
</button>
</a>
<hr />
<div id="outp">
</div>
<br />
<center><a href="#" id="docs">Documentation</a></center>
<span id="tbls">
<center>
<h2>
Changelog
</h2>
</center>
<center>
<ul>
<li>(v2.0) <i>???</i> (most likely functions, array assignment, and string assignment)</li>
<li>(v1.9) Import / Export</li>
<li>(v1.8) Added dynamic scoping and arrays</li>
<li>(v1.7) Redid compiler and interpreter, added line numbers</li>
<li>(v1.6) Implemented binary operators</li>
<li>(v1.5) Introduced loops</li>
<li>(v1.4) Included Baselib</li>
<li>(v1.3) Generated more arithmetic operations</li>
<li>(v1.2) Redid website design and documentation</li>
<li>(v1.1) First public release</li>
</ul>
</center>
<center>
<h2>
Quirks
</h2>
</center>
<center>
<ol>
<li>SEPL stands for <b>S</b>imple <b>E</b>ducational <b>P</b>rogramming <b>L</b>anguage</li>
<li>SEPL isn't difficult to learn, but it is also limited to variable based operations</li>
<li>SEPL is based on languages like assembly and lua</li>
<li>All operations are designed similarly, color designating a specific operation set</li>
<li>Clear the textbox and refresh for the default script</li>
<li>Cookies will be used to store your last script</li>
<li>All variables <b>must</b> be defined before they are used</li>
<li>This language is case sensitive</li>
<li>All errors except for eternal loops occur at compile time only</li>
<li>Whitespace is the only delimiting character group</li>
<li>This is an interpreted language, first compiling to an esoteric variant</li>
<li>This language is still in development</li>
</ol>
</center>
<center>
<h2>
Types
</h2>
</center>
<table id="dctbl" cols=3>
<tr>
<th>Type</th>
<th>Examples</th>
<th>Notes</th>
</tr>
<tr>
<td>Number</td>
<td highlight>1 -2 1.492 true false</td>
<td>Numerical constants (fractional or whole)<br><b>true</b> and <b>false</b> are <b>1</b> and <b>0</b> respectively</td>
</tr>
<tr>
<td>Keyword</td>
<td highlight>def set out say eq neq gt gte lt lte and or xor not neg shf inc dec mul div pow mod int sgn arr idx psh put pop len for end</td>
<td>Instructions / commands for the interpreter</td>
</tr>
<tr>
<td>Joiner</td>
<td highlight>to frm by as wth at in</td>
<td>Used to separate keyword parameters<br>All of these are completely interchangeable<br>Use the most grammatically appropriate or sensible</td>
</tr>
<tr>
<td>Character</td>
<td highlight>"?" '?'</td>
<td>Only 1 byte characters are allowed (no unicode)<br>The compiler replaces these with their byte values<br><i>Keep in mind that in the future, SEPL will include full string support</i></td>
</tr>
<tr>
<td>Variable</td>
<td highlight>foo bar _AbC a12_3</td>
<td>These <b>must</b> start with an underscore or letter<br>They may be followed by underscores, letters, or even digits</td>
</tr>
<tr>
<td>Array</td>
<td>Stored in <b>variables<b></td>
<td>These are containers<br>More specifically, they store a list or sequence of data like numbers</td>
</tr>
<tr>
<td>Comment</td>
<td highlight># single line comment
# terminated single line comment #
# escaped \# comment
# multiline \
comment</td>
<td>Comment functionality is complicated :P<br>These are mostly used for either storing helpful information or temporarily disabling sections of code</td>
</tr>
<tr>
<td>Special Character</td>
<td highlight>\n
\t</td>
<td>\n is a newline character<br>\t is a tab character</td>
</tr>
</table>
<center>
<h2>
Scoping
</h2>
</center>
<center>
Variables exist in the scope they were defined in (within the block). Attempts to access them outside of their assigned scope will result in an error unless the scope is nested. You may 'redefine' existing variables within different blocks, but the original definition will remain after exiting the scope.<br />
</center>
<hr />
<center>
<h1>
Manual
</h1>
</center>
<hr />
<center>
<h2>
Assignment
</h2>
</center>
<table id="dctbl" cols=3>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
</tr>
<tr>
<td highlight>def</td>
<td><b>def</b>ines a variable (defaults to 0)</td>
<td highlight>def foo<br>def bar</td>
</tr>
<tr>
<td highlight>set</td>
<td><b>set</b>s a the value of a variable</td>
<td highlight>set foo to 2<br>set bar as foo</td>
</tr>
</table>
<center>
<h2>
I / O
</h2>
</center>
<table id="dctbl" cols=3>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
</tr>
<tr>
<td highlight>out</td>
<td><b>out</b>puts the value or variable given as an integer or double</td>
<td highlight>out mynum
out 'A'
out 10</td>
</tr>
<tr>
<td highlight>say</td>
<td><b>say</b>s (outputs) the value or variable given as a character</td>
<td highlight>say mychar
say 'A'
say \n</td>
</tr>
</table>
<center>
<h2>
Boolean
</h2>
</center>
<table id="dctbl" cols=4>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
<th>Operation</th>
</tr>
<tr>
<td highlight>eq</td>
<td>sets the variable to if it is <b>eq</b>ual to a value</td>
<td highlight>eq var1 wth var2
eq steps to 5</td>
<td>==</td>
</tr>
<tr>
<td highlight>neq</td>
<td>sets the variable to if it is <b>n</b>ot <b>eq</b>ual to a value</td>
<td highlight>neq phones wth laptops
neq apples to 1</td>
<td>!=</td>
</tr>
<tr>
<td highlight>gt</td>
<td>sets the variable to if it is <b>g</b>reater <b>t</b>han a value</td>
<td highlight>gt high frm low
gt counter frm 0</td>
<td>></td>
</tr>
<tr>
<td highlight>gte</td>
<td>sets the variable to if it is <b>g</b>reater <b>t</b>han or <b>e</b>qual to a value</td>
<td highlight>gte high frm low
gte counter frm 0</td>
<td>>=</td>
</tr>
<tr>
<td highlight>lt</td>
<td>sets the variable to if it is <b>l</b>ess <b>t</b>han a value</td>
<td highlight>lt low frm high
lt counter frm 0</td>
<td><</td>
</tr>
<tr>
<td highlight>lte</td>
<td>sets the variable to if it is <b>l</b>ess <b>t</b>han or <b>e</b>qual to a value</td>
<td highlight>lte low frm high
lte counter frm 0</td>
<td><=</td>
</tr>
<tr>
<td highlight>and</td>
<td>performs a bitwise <b>and</b> operation</td>
<td highlight>and bool1 wth bool2
and bits wth mask</td>
<td>&</td>
</tr>
<tr>
<td highlight>or</td>
<td>performs a bitwise <b>or</b> operation</td>
<td highlight>or bool1 wth bool2
or bits wth flag</td>
<td>|</td>
</tr>
<tr>
<td highlight>xor</td>
<td>performs a bitwise <b>xor</b> operation</td>
<td highlight>xor bool1 wth bool2
xor bits wth switch</td>
<td>^</td>
</tr>
<tr>
<td highlight>not</td>
<td>performs a boolean <b>not</b> operation, flipping the variable from truthy to falsy and vice versa</td>
<td highlight>not mybool
not pass</td>
<td>!</td>
</tr>
<tr>
<td highlight>neg</td>
<td>performs a bitwise <b>neg</b>ation</td>
<td highlight>neg mybool
neg field</td>
<td>~</td>
</tr>
<tr>
<td highlight>shf</td>
<td>performs a bitwise <b>sh</b>i<b>f</b>t to the right with positive values and left with negative ones</td>
<td highlight>shf mybool by 2
shf flagp by -7</td>
<td>>>, <<</td>
</tr>
</table>
<center>
<h2>
Arithmetic
</h2>
</center>
<table id="dctbl" cols=4>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
<th>Operation</th>
</tr>
<tr>
<td highlight>inc</td>
<td><b>inc</b>rements the variable by a value</td>
<td highlight>inc money by 1
inc subs by 500
inc count by n </td>
<td>+=</td>
</tr>
<tr>
<td highlight>dec</td>
<td><b>dec</b>rements the variable by a value</td>
<td highlight>dec counter by step
dec apples by count
dec score by 10</td>
<td>-=</td>
</tr>
<tr>
<td highlight>mul</td>
<td><b>mul</b>tiplies the values, storing the result in the initial variable</td>
<td highlight>mul binsize by 2
mul base by height
mul price by tax</td>
<td>*=</td>
</tr>
<tr>
<td highlight>div</td>
<td><b>div</b>ides the values, storing the result in the initial variable</td>
<td highlight>div binsize by 2
div total by 10
div sum by total</td>
<td>/=</td>
</tr>
<tr>
<td highlight>pow</td>
<td>raises the variable to the value'ths <b>pow</b>er</td>
<td highlight>pow mynum to 2
pow x to 3
pow a to n</td>
<td>**=</td>
</tr>
<tr>
<td highlight>mod</td>
<td>performs the <b>mod</b>ulus operator
<td highlight>mod mynum by 2</td>
<td>%=</td>
</tr>
</table>
<center>
<h2>
Baselib
</h2>
</center>
<table id="dctbl" cols=4>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
<th>Operation</th>
</tr>
<tr>
<td highlight>int</td>
<td>converts the variable into an <b>int</b>eger</td>
<td highlight>int double</td>
<td>floor</td>
</tr>
<tr>
<td highlight>sgn</td>
<td>converts the variable to its <b>s</b>i<b>gn</b></td>
<td highlight>sgn posval</td>
<td>sign</td>
</tr>
</table>
<center>
<h2>
Array
</h2>
</center>
<table id="dctbl" cols=4>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
<th>Operation</th>
</tr>
<tr>
<td highlight>arr</td>
<td>defines an <b>arr</b>ay</td>
<td highlight>arr mylist
arr mystring</td>
<td></td>
</tr>
<tr>
<td highlight>len</td>
<td>assigns the <b>length</b> of an array to a variable</td>
<td highlight>len nums to lnum
len characters to strlen</td>
<td>length</td>
</tr>
<tr>
<td highlight>idx</td>
<td><b>i</b>n<b>d</b>e<b>x</b> an array at a given position</td>
<td highlight>idx nums at lnum to temp
idx characters by counter to char</td>
<td>[]</td>
</tr>
<tr>
<td highlight>put</td>
<td><b>put</b>s a value into an array at a given position</td>
<td highlight>put num in nums at 0
put mychar in characters at charl</td>
<td>[]=</td>
</tr>
<tr>
<td highlight>psh</td>
<td><b>p</b>u<b>sh</b>es a value into an array</td>
<td highlight>psh num to nums
psh 'A' to characters</td>
<td>push</td>
</tr>
<tr>
<td highlight>pop</td>
<td><b>pop</b>s a value off of the end of an array</td>
<td highlight>pop nums to num
pop characters to lastchar</td>
<td>pop</td>
</tr>
</table>
<center>
<h2>
Control
</h2>
</center>
<table id="dctbl" cols=4>
<tr>
<th>Name</th>
<th>Usage</th>
<th>Examples</th>
<th>Operation</th>
</tr>
<tr>
<td highlight>for ... end</td>
<td>while the variable is non-zero, execute the contained code block</td>
<td highlight>for counter
out counter
dec counter by 1
end</td>
<td>while</td>
</tr>
</table>
</span>
<br /><br />
<center><a href="https://www.omfgdogs.com/" target="_blank" style="text-decoration:none !important"><img id="pupper" src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/microsoft/153/dog-face_1f436.png" width="5%" alt="pupper" /><br /><small style="font-family:'Arial', monospace;font-size:.7em;padding: 0px;">(epilepsy warning)</small></a></center><br /><br />
<script src="sepl.js"></script>
</body>
</html>