interplane.Get Omega
Read in your language

vscode-omega

aien-dev/vscode-omega

Brought by drakestapleton

branch main Branches Tags History

vscode-omega / snippets / omega.json

105 lines · 2247 bytes Raw Blame History
1{
2 "function": {
3 "prefix": "fn",
4 "body": [
5 "fn ${1:name} ${2:x} ${3:uint} to ${4:uint}",
6 "$0",
7 "end"
8 ],
9 "description": "Function: fn NAME (PARAM TYPE)* to TYPE ... end"
10 },
11 "main": {
12 "prefix": "main",
13 "body": [
14 "fn main to int",
15 "$0",
16 "ret 0",
17 "end"
18 ],
19 "description": "Program entry; the int it returns is the exit status"
20 },
21 "if": {
22 "prefix": "if",
23 "body": [
24 "if ${1:eq ${2:a} ${3:b}}",
25 "$0",
26 "end"
27 ],
28 "description": "if CONDITION ... end"
29 },
30 "if else": {
31 "prefix": "ife",
32 "body": [
33 "if ${1:eq ${2:a} ${3:b}}",
34 "$4",
35 "else",
36 "$0",
37 "end"
38 ],
39 "description": "if CONDITION ... else ... end"
40 },
41 "while bound": {
42 "prefix": "while",
43 "body": [
44 "while ${1:ne ${2:b} 0} bound ${3:1000}",
45 "$0",
46 "end"
47 ],
48 "description": "while CONDITION bound N ... end (traps with code 4 after N passes)"
49 },
50 "for": {
51 "prefix": "for",
52 "body": [
53 "for ${1:i} ${2:ulong} ${3:10}",
54 "$0",
55 "end"
56 ],
57 "description": "for NAME TYPE COUNT ... end (NAME runs 0 .. COUNT-1)"
58 },
59 "for unroll": {
60 "prefix": "foru",
61 "body": [
62 "for ${1:i} ${2:uint} ${3:8} unroll",
63 "$0",
64 "end"
65 ],
66 "description": "OM-2: body compiled COUNT times (COUNT a number 1..64)"
67 },
68 "struct": {
69 "prefix": "struct",
70 "body": [
71 "struct ${1:P} ${2:x} ${3:long} ${4:y} ${5:long} end"
72 ],
73 "description": "One-line struct, before the first fn"
74 },
75 "layout": {
76 "prefix": "layout",
77 "body": [
78 "layout ${1:blk} ${2:8}",
79 "field ${3:lo} ${4:uint} at ${5:0} ${6|little,big|}",
80 "end"
81 ],
82 "description": "OM-2 external layout, before the first fn"
83 },
84 "text": {
85 "prefix": "text",
86 "body": [
87 "text ${1:msg} \"${2:hello}\\n\""
88 ],
89 "description": "Text literal (escapes \\n \\t \\\\ \\\")"
90 },
91 "om2 profile": {
92 "prefix": "om2",
93 "body": [
94 "om2"
95 ],
96 "description": "Opt this unit into OM-2 (must be the first line that is not a note)"
97 },
98 "note": {
99 "prefix": "note",
100 "body": [
101 "note ${0}"
102 ],
103 "description": "Comment line"
104 }
105}