Web-Ide mit aufgenommen
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"If-then Statement": {
|
||||
"prefix": [
|
||||
"if",
|
||||
"then",
|
||||
"condition"
|
||||
],
|
||||
"body": [
|
||||
"\t${1:$LINE_COMMENT D = condition}",
|
||||
"\t@${2:IF_END}",
|
||||
"\tD;JEQ",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"(${2:IF_END})"
|
||||
],
|
||||
"description": "An if-then statement."
|
||||
},
|
||||
"If-then-else Statement": {
|
||||
"prefix": [
|
||||
"if",
|
||||
"then",
|
||||
"else",
|
||||
"elif",
|
||||
"condition"
|
||||
],
|
||||
"body": [
|
||||
"\t${1:$LINE_COMMENT D = condition}",
|
||||
"\t@${2:IF_ELSE}",
|
||||
"\tD;JEQ",
|
||||
"\t${4:$LINE_COMMENT code}",
|
||||
"\t@${3:IF_END}",
|
||||
"\t0;JMP",
|
||||
"(${2:IF_ELSE})",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"(${3:IF_END})"
|
||||
],
|
||||
"description": "An if-then-else statement."
|
||||
},
|
||||
"While Loop": {
|
||||
"prefix": [
|
||||
"repeat",
|
||||
"loop",
|
||||
"for",
|
||||
"while"
|
||||
],
|
||||
"body": [
|
||||
"(${1:LOOP})",
|
||||
"\t${2:$LINE_COMMENT D = condition}",
|
||||
"\t@${3:LOOP_END}",
|
||||
"\tD;JEQ",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"\t@${1:LOOP}",
|
||||
"\t0;JMP",
|
||||
"(${3:LOOP_END})"
|
||||
],
|
||||
"description": "A while loop."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"asm"
|
||||
],
|
||||
"name": "Hack Assembly Language",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#declaration"
|
||||
},
|
||||
{
|
||||
"include": "#A-instruction"
|
||||
},
|
||||
{
|
||||
"include": "#destination"
|
||||
},
|
||||
{
|
||||
"include": "#boolean"
|
||||
},
|
||||
{
|
||||
"include": "#jump"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"declaration": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Label declaration",
|
||||
"match": "\\(([^ \\/]*)\\)",
|
||||
"name": "storage.type",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Label",
|
||||
"match": "[a-zA-Z\\_\\.\\$\\:]+[a-zA-Z\\_\\.\\$\\:\\d]*",
|
||||
"name": "variable.other"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"A-instruction": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "@XXX instruction",
|
||||
"match": "\\@([^ \\/]*)",
|
||||
"name": "keyword.operator",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "R10|R11|R12|R13|R14|R15|R0|R1|R2|R3|R4|R5|R6|R7|R8|R9|SP|LCL|ARG|THIS|THAT|SCREEN|KBD",
|
||||
"name": "variable.language"
|
||||
},
|
||||
{
|
||||
"comment": "A-instruction string argument",
|
||||
"match": "[a-zA-Z\\_\\.\\$\\:]+[a-zA-Z\\_\\.\\$\\:\\d]*",
|
||||
"name": "variable.other"
|
||||
},
|
||||
{
|
||||
"match": "\\d+",
|
||||
"name": "constant.numeric"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"destination": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Left-hand side",
|
||||
"match": "null|M|D|A|MD|AM|AD|AMD",
|
||||
"name": "variable.language"
|
||||
}
|
||||
]
|
||||
},
|
||||
"jump": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Jump type",
|
||||
"match": "JGT|JLE|JEQ|JLT|JNE|JMP|JGE",
|
||||
"name": "keyword.control"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Inline comment",
|
||||
"begin": "\\/\\/",
|
||||
"end": "\\n",
|
||||
"name": "comment.line.double-slash"
|
||||
},
|
||||
{
|
||||
"comment": "Multiline comment",
|
||||
"begin": "\\/\\*",
|
||||
"end": "\\*\\/",
|
||||
"name": "comment.block"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.asm"
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"cmp",
|
||||
"out"
|
||||
],
|
||||
"name": "CMP/OUT",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#border"
|
||||
},
|
||||
{
|
||||
"include": "#variable"
|
||||
},
|
||||
{
|
||||
"include": "#value"
|
||||
},
|
||||
{
|
||||
"include": "#placeholder"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"border": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Vertical table border",
|
||||
"name": "keyword.operator",
|
||||
"match": "\\|"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "The variable identifier (table header)",
|
||||
"name": "support.variable",
|
||||
"match": "[a-zA-Z]+"
|
||||
}
|
||||
]
|
||||
},
|
||||
"value": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "The value of a certain variable at a given time",
|
||||
"name": "constant.numeric",
|
||||
"match": "-*\\d+\\+*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"placeholder": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "List of wildcard characters",
|
||||
"name": "constant.language",
|
||||
"match": "\\*+"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.cmp"
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"fileTypes": ["hack"],
|
||||
"name": "Hack Machine Language",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#a"
|
||||
},
|
||||
{
|
||||
"include": "#c"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"a": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "0-value",
|
||||
"begin": "\\b0",
|
||||
"end": "\\b",
|
||||
"name": "comment",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "value",
|
||||
"match": "[01]{15}\\b",
|
||||
"name": "constant.numeric"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"c": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "1-??-a-comp-dest-jump",
|
||||
"match": "\\b1[01]{2}([01]{1})([01]{6})([01]{3})([01]{3})\\b",
|
||||
"name": "comment",
|
||||
"captures": {
|
||||
"1": {
|
||||
"comment": "control",
|
||||
"name": "keyword.control"
|
||||
},
|
||||
"2": {
|
||||
"comment": "op",
|
||||
"name": "keyword.operarator"
|
||||
},
|
||||
"3": {
|
||||
"comment": "dest",
|
||||
"name": "variable.language"
|
||||
},
|
||||
"4": {
|
||||
"comment": "jump",
|
||||
"name": "keyword.control"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.hack"
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
{
|
||||
"CHIP Class": {
|
||||
"body": [
|
||||
"CHIP $1 {",
|
||||
" IN $2;",
|
||||
" OUT $3;",
|
||||
"",
|
||||
" PARTS:",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "Create CHIP class.\n",
|
||||
"prefix": "CHIP"
|
||||
},
|
||||
"Chip Add16": {
|
||||
"body": [
|
||||
"Add16(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": [
|
||||
"* Adds two 16-bit values.\n* The most significant carry bit is ignored.\n"
|
||||
],
|
||||
"prefix": "Add16"
|
||||
},
|
||||
"Chip ALU": {
|
||||
"body": [
|
||||
"ALU(x=$1, y=$2, zx=$3, nx=$4, zy=$5, ny=$6, f=$7, no=$8, out=$9, zr=$10, ng=$11);"
|
||||
],
|
||||
"description": [
|
||||
"* the ALU manipulates the x and y.\n"
|
||||
],
|
||||
"prefix": "ALU"
|
||||
},
|
||||
"Chip And": {
|
||||
"body": [
|
||||
"And(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* And gate:\n* out = 1 if (a == 1 and b == 1)\n* 0 otherwise\n",
|
||||
"prefix": "And"
|
||||
},
|
||||
"Chip And16": {
|
||||
"body": [
|
||||
"And16(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* 16-bit bitwise And:\n* for i = 0..15: out[i] = (a[i] and b[i])\n",
|
||||
"prefix": "And16"
|
||||
},
|
||||
"Chip ARegister": {
|
||||
"body": [
|
||||
"ARegister(in=$1, load=$2, out=$3);"
|
||||
],
|
||||
"description": "* A 16-Bit register called \"A Register\"\n",
|
||||
"prefix": "ARegister"
|
||||
},
|
||||
"Chip Bit": {
|
||||
"body": [
|
||||
"Bit(in=$1, load=$2, out=$3);"
|
||||
],
|
||||
"description": "* 1-bit register:\n* If load[t] == 1 then out[t+1] = in[t]\n* else out does not change (out[t+1] = out[t])\n",
|
||||
"prefix": "Bit"
|
||||
},
|
||||
"Chip DFF": {
|
||||
"body": [
|
||||
"DFF(in=$1, out=$2);"
|
||||
],
|
||||
"description": "* Data Flip-flop:\n* out(t) = in(t-1)\n* where t is the current time unit, or clock cycle.\n",
|
||||
"prefix": "DFF"
|
||||
},
|
||||
"Chip DMux": {
|
||||
"body": [
|
||||
"DMux(in=$1, sel=$2, a=$3, b=$4);"
|
||||
],
|
||||
"description": "* Demultiplexor:\n* {a, b} = {in, 0} if sel == 0\n* {0, in} if sel == 1\n",
|
||||
"prefix": "DMux"
|
||||
},
|
||||
"Chip DMux4Way": {
|
||||
"body": [
|
||||
"DMux4Way(in=$1, sel=$2, a=$3, b=$4, c=$5, d=$6);"
|
||||
],
|
||||
"description": "* 4-way demultiplexor:\n* {a, b, c, d} = {in, 0, 0, 0} if sel == 00\n* {0, in, 0, 0} if sel == 01\n* {0, 0, in, 0} if sel == 10\n* {0, 0, 0, in} if sel == 11\n",
|
||||
"prefix": "DMux4Way"
|
||||
},
|
||||
"Chip DMux8Way": {
|
||||
"body": [
|
||||
"DMux8Way(in=$1, sel=$2, a=$3, b=$4, c=$5, d=$6, e=$7, f=$8, g=$9, h=$10);"
|
||||
],
|
||||
"description": "* 8-way demultiplexor:\n* {a, b, c, d, e, f, g, h} = {in, 0, 0, 0, 0, 0, 0, 0} if sel == 000\n* {0, in, 0, 0, 0, 0, 0, 0} if sel == 001\n* etc.\n* {0, 0, 0, 0, 0, 0, 0, in} if sel == 111\n",
|
||||
"prefix": "DMux8Way"
|
||||
},
|
||||
"Chip DRegister": {
|
||||
"body": [
|
||||
"DRegister(in=$1, load=$2, out=$3);"
|
||||
],
|
||||
"description": "* A 16-Bit register called \"D Register\"\n",
|
||||
"prefix": "DRegister"
|
||||
},
|
||||
"Chip FullAdder": {
|
||||
"body": [
|
||||
"FullAdder(a=$1, b=$2, c=$3, sum=$4, carry=$5);"
|
||||
],
|
||||
"description": "* Full adder:\n* Computes sum, the least significant bit of a + b + c, and carry, the most significant bit of a + b + c.\n",
|
||||
"prefix": "FullAdder"
|
||||
},
|
||||
"Chip HalfAdder": {
|
||||
"body": [
|
||||
"HalfAdder(a=$1, b=$2, sum=$3, carry=$4);"
|
||||
],
|
||||
"description": "* Half adder:\n* Computes sum, the least significnat bit of a + b, and carry, the most significnat bit of a + b.\n",
|
||||
"prefix": "HalfAdder"
|
||||
},
|
||||
"Chip Inc16": {
|
||||
"body": [
|
||||
"Inc16(in=$1, out=$2);"
|
||||
],
|
||||
"description": "* 16-bit incrementer:\n* out = in + 1 (arithmetic addition)\n",
|
||||
"prefix": "Inc16"
|
||||
},
|
||||
"Chip Keyboard": {
|
||||
"body": [
|
||||
"Keyboard(out=$1);"
|
||||
],
|
||||
"description": "* The keyboard (memory map).\n* Outputs the code of the currently pressed key\n",
|
||||
"prefix": "Keyboard"
|
||||
},
|
||||
"Chip Mux": {
|
||||
"body": [
|
||||
"Mux(a=$1, b=$2, sel=$3, out=$4);"
|
||||
],
|
||||
"description": "* Multiplexor:\n* If sel == 1 then out = b else out = a.\n",
|
||||
"prefix": "Mux"
|
||||
},
|
||||
"Chip Mux16": {
|
||||
"body": [
|
||||
"Mux16(a=$1, b=$2, sel=$3, out=$4);"
|
||||
],
|
||||
"description": "* 16-bit multiplexor:\n* for i = 0..15 out[i] = a[i] if sel == 0\n* b[i] if sel == 1\n",
|
||||
"prefix": "Mux16"
|
||||
},
|
||||
"Chip Mux4Way16": {
|
||||
"body": [
|
||||
"Mux4Way16(a=$1, b=$2, c=$3, d=$4, sel=$5, out=$6);"
|
||||
],
|
||||
"description": "* 4-way 16-bit multiplexor:\n* out = a if sel == 00\n* b if sel == 01\n* c if sel == 10\n* d if sel == 11\n",
|
||||
"prefix": "Mux4Way16"
|
||||
},
|
||||
"Chip Mux8Way16": {
|
||||
"body": [
|
||||
"Mux8Way16(a=$1, b=$2, c=$3, d=$4, e=$5, f=$6, g=$7, h=$8, sel=$9, out=$10);"
|
||||
],
|
||||
"description": "* 8-way 16-bit multiplexor:\n* out = a if sel == 000\n* b if sel == 001\n* etc.\n* h if sel == 111\n",
|
||||
"prefix": "Mux8Way16"
|
||||
},
|
||||
"Chip Nand": {
|
||||
"body": [
|
||||
"Nand(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* Nand gate:\n* out = a Nand b.\n",
|
||||
"prefix": "Nand"
|
||||
},
|
||||
"Chip Not": {
|
||||
"body": [
|
||||
"Not(in=$1, out=$2);"
|
||||
],
|
||||
"description": "* Not gate:\n* out = not in\n",
|
||||
"prefix": "Not"
|
||||
},
|
||||
"Chip Not16": {
|
||||
"body": [
|
||||
"Not16(in=$1, out=$2);"
|
||||
],
|
||||
"description": "* 16-bit Not:\n* for i=0..15: out[i] = not in[i]\n",
|
||||
"prefix": "Not16"
|
||||
},
|
||||
"Chip Or": {
|
||||
"body": [
|
||||
"Or(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* Or gate:\n* out = 1 if (a == 1 or b == 1)\n* 0 otherwise\n",
|
||||
"prefix": "Or"
|
||||
},
|
||||
"Chip Or16": {
|
||||
"body": [
|
||||
"Or16(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* 16-bit bitwise Or gate:\n* for i = 0..15 out[i] = a[i] or b[i].\n",
|
||||
"prefix": "Or16"
|
||||
},
|
||||
"Chip Or8Way": {
|
||||
"body": [
|
||||
"Or8Way(in=$1, out=$2);"
|
||||
],
|
||||
"description": "* 8-way Or\n* out = (in[0] or in[1] or ... or in[7])\n",
|
||||
"prefix": "Or8Way"
|
||||
},
|
||||
"Chip PC": {
|
||||
"body": [
|
||||
"PC(in=$1, load=$2, inc=$3, reset=$4, out=$5);"
|
||||
],
|
||||
"description": "* A 16-bit counter with load and reset control bits.\n* if (reset[t] == 1) out[t+1] = 0\n* else if (load[t] == 1) out[t+1] = in[t]\n* else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)\n* else out[t+1] = out[t]\n",
|
||||
"prefix": "PC"
|
||||
},
|
||||
"Chip RAM16K": {
|
||||
"body": [
|
||||
"RAM16K(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* Memory of 16K registers, each 16 bit-wide. Out holds the value stored at the memory location specified by address.\n* If load==1, then the in value is loaded into the memory location specified by address (the loaded value will be emitted to out from the next time step onward).\n",
|
||||
"prefix": "RAM16K"
|
||||
},
|
||||
"Chip RAM4K": {
|
||||
"body": [
|
||||
"RAM4K(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* Memory of 4K registers, each 16 bit-wide. Out holds the value stored at the memory location specified by address.\n* If load==1, then the in value is loaded into the memory location specified by address (the loaded value will be emitted to out from the next time step onward).\n",
|
||||
"prefix": "RAM4K"
|
||||
},
|
||||
"Chip RAM512": {
|
||||
"body": [
|
||||
"RAM512(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* Memory of 512 registers, each 16 bit-wide. Out holds the value stored at the memory location specified by address.\n* If load==1, then the in value is loaded into the memory location specified by address (the loaded value will be emitted to out from the next time step onward).\n",
|
||||
"prefix": "RAM512"
|
||||
},
|
||||
"Chip RAM64": {
|
||||
"body": [
|
||||
"RAM64(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* Memory of 64 registers, each 16 bit-wide. Out holds the value stored at the memory location specified by address.\n* If load==1, then the in value is loaded into the memory location specified by address (the loaded value will be emitted to out from the next time step onward).\n",
|
||||
"prefix": "RAM64"
|
||||
},
|
||||
"Chip RAM8": {
|
||||
"body": [
|
||||
"RAM8(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* Memory of 8 registers, each 16 bit-wide. Out holds the value stored at the memory location specified by address.\n* If load==1, then the in value is loaded into the memory location specified by address (the loaded value will be emitted to out from the next time step onward).\n",
|
||||
"prefix": "RAM8"
|
||||
},
|
||||
"Chip Register": {
|
||||
"body": [
|
||||
"Register(in=$1, load=$2, out=$3);"
|
||||
],
|
||||
"description": "* 16-bit register:\n* If load[t] == 1 then out[t+1] = in[t]\n* else out does not change\n",
|
||||
"prefix": "Register"
|
||||
},
|
||||
"Chip ROM32K": {
|
||||
"body": [
|
||||
"ROM32K(address=$1, out=$2);"
|
||||
],
|
||||
"description": "* Read-Only memory (ROM) of 16K registers, each 16-bit wide.\n* The chip is designed to facilitate data read, as follows:\n* out(t) = ROM32K[address(t)](t)\n",
|
||||
"prefix": "ROM32K"
|
||||
},
|
||||
"Chip Screen": {
|
||||
"body": [
|
||||
"Screen(in=$1, load=$2, address=$3, out=$4);"
|
||||
],
|
||||
"description": "* The Screen (memory map).\n* Functions exactly like a 16-bit 8K RAM:\n* 1. out(t)=Screen[address(t)](t)\n* 2. If load(t-1) then Screen[address(t-1)](t)=in(t-1)\n",
|
||||
"prefix": "Screen"
|
||||
},
|
||||
"Chip Xor": {
|
||||
"body": [
|
||||
"Xor(a=$1, b=$2, out=$3);"
|
||||
],
|
||||
"description": "* Exclusive-or gate:\n* out = !(a == b).\n",
|
||||
"prefix": "Xor"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"hdl"
|
||||
],
|
||||
"name": "HDL",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Block comment",
|
||||
"begin": "\\/\\*",
|
||||
"end": "\\*\\/",
|
||||
"name": "comment.block.hdl"
|
||||
},
|
||||
{
|
||||
"comment": "Line comment",
|
||||
"begin": "\\/\\/",
|
||||
"end": "\\n",
|
||||
"name": "comment.line.hdl"
|
||||
},
|
||||
{
|
||||
"comment": "keywords",
|
||||
"name": "keyword.hdl",
|
||||
"match": "IN|OUT|PARTS|BUILTIN"
|
||||
},
|
||||
{
|
||||
"comment": "true, false",
|
||||
"name": "constant.language.hdl",
|
||||
"match": "true|false"
|
||||
},
|
||||
{
|
||||
"comment": "bus index",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.hdl"
|
||||
}
|
||||
},
|
||||
"match": "\\[([\\d]+)\\]"
|
||||
},
|
||||
{
|
||||
"comment": ".. in bus slicing",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.hdl"
|
||||
}
|
||||
},
|
||||
"match": "\\[(\\d+\\.{2}\\d+)\\]"
|
||||
},
|
||||
{
|
||||
"comment": "chip name",
|
||||
"name": "storage.type.hdl",
|
||||
"match": "CHIP"
|
||||
},
|
||||
{
|
||||
"comment": "inner chip",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.hdl"
|
||||
}
|
||||
},
|
||||
"match": "([\\w\\d\\_]+)\\s*\\("
|
||||
},
|
||||
{
|
||||
"comment": "inner chip inputs and outputs",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.hdl"
|
||||
},
|
||||
"2": {
|
||||
"name": "constant.numeric.hdl"
|
||||
}
|
||||
},
|
||||
"match": "([\\w\\d\\_]+)\\s*(\\[.+\\])*="
|
||||
}
|
||||
],
|
||||
"scopeName": "source.hdl"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"Class": {
|
||||
"prefix": [
|
||||
"class",
|
||||
"struct"
|
||||
],
|
||||
"body": [
|
||||
"class ${1:Name} {",
|
||||
"\t${0:$LINE_COMMENT attributes and methods}",
|
||||
"}"
|
||||
],
|
||||
"description": "A class interface."
|
||||
},
|
||||
"Function/method": {
|
||||
"prefix": [
|
||||
"function",
|
||||
"method",
|
||||
"procedure",
|
||||
"void",
|
||||
"int",
|
||||
"String",
|
||||
"Array",
|
||||
"Char"
|
||||
],
|
||||
"body": [
|
||||
"${1|function,method|} ${2:void} ${3:name} (${4:$BLOCK_COMMENT_START arguments $BLOCK_COMMENT_END}) {",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"}"
|
||||
],
|
||||
"description": "A function/method definition."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"jack"
|
||||
],
|
||||
"name": "Jack Language",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#keyword"
|
||||
},
|
||||
{
|
||||
"include": "#constant"
|
||||
},
|
||||
{
|
||||
"include": "#declaration"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"keyword": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Keyword related to flow control",
|
||||
"match": "\\b(if|else|while|do|return)\\b",
|
||||
"name": "keyword.control"
|
||||
},
|
||||
{
|
||||
"comment": "Miscellaneous keyword",
|
||||
"match": "\\blet\\b",
|
||||
"name": "keyword.other"
|
||||
}
|
||||
]
|
||||
},
|
||||
"constant": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Numeric constant",
|
||||
"name": "constant.numeric",
|
||||
"match": "\\b[0-9]+\\b"
|
||||
},
|
||||
{
|
||||
"comment": "String literal",
|
||||
"begin": "\\\"",
|
||||
"end": "\\\"",
|
||||
"name": "string.quoted.double",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Escape characters",
|
||||
"match": "\\\\.",
|
||||
"name": "constant.character.escape"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "Language constant",
|
||||
"name": "constant.language",
|
||||
"match": "\\b(true|false|null|this)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"declaration": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Class declaration",
|
||||
"match": "\\bclass\\b",
|
||||
"name": "storage.type"
|
||||
},
|
||||
{
|
||||
"comment": "Variable declaration",
|
||||
"name": "storage.type",
|
||||
"match": "\\b(field|static|var)\\s+(\\w+)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "storage.modifier"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Function declaration",
|
||||
"begin": "\\b(constructor|function|method)\\s+([A-Za-z_][A-Za-z_0-9]*)\\s+([A-Za-z_][A-Za-z_0-9]*)\\s*\\(",
|
||||
"end": "\\)",
|
||||
"match": "meta.function",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.modifier"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\s*([A-Za-z_][A-Za-z_0-9]*)\\s+(?=[A-Za-z_][A-Za-z_0-9]*)\\b",
|
||||
"name": "storage.type"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Inline comment",
|
||||
"begin": "\\/\\/",
|
||||
"end": "\\n",
|
||||
"name": "comment.line.double-slash"
|
||||
},
|
||||
{
|
||||
"comment": "Multiline comment",
|
||||
"begin": "\\/\\*",
|
||||
"end": "\\*\\/",
|
||||
"name": "comment.block"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.jack"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": "//",
|
||||
"blockComment": ["/*", "*/"]
|
||||
},
|
||||
// symbols used as brackets
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
// symbols that are auto closed when typing
|
||||
"autoClosingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
],
|
||||
// symbols that that can be used to surround a selection
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"Repeat Loop": {
|
||||
"prefix": [
|
||||
"repeat",
|
||||
"loop",
|
||||
"while",
|
||||
"for"
|
||||
],
|
||||
"body": [
|
||||
"repeat ${1:iterations} {",
|
||||
"\t${0:$LINE_COMMENT code",
|
||||
"}"
|
||||
],
|
||||
"description": "A repeat loop."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"tst"
|
||||
],
|
||||
"name": "TST",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#instruction"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"instruction": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Everything which is not a comment is a function",
|
||||
"begin": "\\b",
|
||||
"end": "(,|;)",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Every actual instruction starts with a function",
|
||||
"name": "support.function",
|
||||
"match": "(output-file|compare-to|output-list|set|eval|output|load)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "A single bit",
|
||||
"name": "constant.numeric",
|
||||
"match": "\\s(1|0)|%B(\\d|\\.)+"
|
||||
},
|
||||
{
|
||||
"comment": "Filename with a known extension",
|
||||
"name": "string.interpolated",
|
||||
"match": "\\w+\\.(hdl|out|cmp)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Inline comment",
|
||||
"begin": "\\/\\/",
|
||||
"end": "\\n",
|
||||
"name": "comment.line.double-slash"
|
||||
},
|
||||
{
|
||||
"comment": "Multiline comment",
|
||||
"begin": "\\/\\*",
|
||||
"end": "\\*\\/",
|
||||
"name": "comment.block"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.tst"
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"If-then Statement": {
|
||||
"prefix": [
|
||||
"if",
|
||||
"then",
|
||||
"condition"
|
||||
],
|
||||
"body": [
|
||||
"\t${1:$LINE_COMMENT not-condition}",
|
||||
"\tif-goto\t${2:if_end}",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"label\t\t${2:IF_END}"
|
||||
],
|
||||
"description": "An if-then statement."
|
||||
},
|
||||
"If-then-else Statement": {
|
||||
"prefix": [
|
||||
"if",
|
||||
"then",
|
||||
"else",
|
||||
"elif",
|
||||
"condition"
|
||||
],
|
||||
"body": [
|
||||
"\t${1:$LINE_COMMENT not-condition}",
|
||||
"\tif-goto\t${2:if_else}",
|
||||
"\t${3:$LINE_COMMENT code}",
|
||||
"\tgoto\t${4:if_end}",
|
||||
"label\t\t${2:if_else}",
|
||||
"\t${0:$LINE_COMMENT code}",
|
||||
"label\t\t${4:if_end}"
|
||||
],
|
||||
"description": "An if-then-else statement."
|
||||
},
|
||||
"While Loop": {
|
||||
"prefix": [
|
||||
"repeat",
|
||||
"loop",
|
||||
"for",
|
||||
"while"
|
||||
],
|
||||
"body": [
|
||||
"label\t\t${1:loop}",
|
||||
"\t${2:$LINE_COMMENT not condition}",
|
||||
"\tif-goto\t${3:loop_end}",
|
||||
"\t${4:$LINE_COMMENT code}",
|
||||
"\tgoto\t${1:loop}",
|
||||
"label\t\t${3:loop_end}"
|
||||
],
|
||||
"description": "A while loop."
|
||||
},
|
||||
"Function": {
|
||||
"prefix": [
|
||||
"function",
|
||||
"procedure"
|
||||
],
|
||||
"body": [
|
||||
"function ${TM_FILENAME/(.*)\\..+$/$1/}.${1:name} ${2:0}",
|
||||
"\t${0:$LINE_COMMENT code}"
|
||||
],
|
||||
"description": "A function definition."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"fileTypes": [
|
||||
"vm"
|
||||
],
|
||||
"name": "Virtual Machine Language",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#arithmetic-command"
|
||||
},
|
||||
{
|
||||
"include": "#memory-access-command"
|
||||
},
|
||||
{
|
||||
"include": "#program-flow-command"
|
||||
},
|
||||
{
|
||||
"include": "#function-calling-command"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"arithmetic-command": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Performs arithmetic and logical operations on the stack.",
|
||||
"match": "\\b(add|sub|neg|eq|gt|lt|and|or|not|shiftleft|shiftright)\\b",
|
||||
"name": "keyword.operator"
|
||||
}
|
||||
]
|
||||
},
|
||||
"memory-access-command": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Transfers data between the stack and virtual memory segments.",
|
||||
"match": "\\b(push|pop)\\s+([^ \\/]*)\\s+(\\d+)\\b",
|
||||
"name": "keyword.operator",
|
||||
"captures": {
|
||||
"2": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Segment",
|
||||
"match": "[a-zA-Z\\_\\.\\$\\:]+[a-zA-Z\\_\\.\\$\\:\\d]*",
|
||||
"name": "storage.type"
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Location",
|
||||
"match": "\\d+",
|
||||
"name": "constant.numeric"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"program-flow-command": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Facilitates conditional and unconditional branching operations.",
|
||||
"match": "\\b(label|goto|if-goto)\\s+([^ \\/]*)\\b",
|
||||
"name": "keyword.control",
|
||||
"captures": {
|
||||
"2": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Label",
|
||||
"match": "[a-zA-Z\\_\\.\\$\\:]+[a-zA-Z\\_\\.\\$\\:\\d]*",
|
||||
"name": "entity.name.section"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-calling-command": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Defines/calls functions.",
|
||||
"match": "\\b(function|call)\\s+([^ \\/]*)\\s+(\\w+)\\b",
|
||||
"name": "keyword.control",
|
||||
"captures": {
|
||||
"2": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Function name",
|
||||
"match": "[a-zA-Z\\_\\.\\$\\:]+[a-zA-Z\\_\\.\\$\\:\\d]*",
|
||||
"name": "entity.name.function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Number of local variables/arguments passed",
|
||||
"match": "\\d+",
|
||||
"name": "constant.numeric"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Returns from functions.",
|
||||
"match": "return",
|
||||
"name": "keyword.control"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Inline comment",
|
||||
"begin": "\\/\\/",
|
||||
"end": "\\n",
|
||||
"name": "comment.line.double-slash"
|
||||
},
|
||||
{
|
||||
"comment": "Multiline comment",
|
||||
"begin": "\\/\\*",
|
||||
"end": "\\*\\/",
|
||||
"name": "comment.block"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.vm"
|
||||
}
|
||||
Reference in New Issue
Block a user