Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: rishyak <[email protected]>
  • Loading branch information
rishyak committed Feb 5, 2023
0 parents commit 7855f1b
Show file tree
Hide file tree
Showing 12 changed files with 943 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
*.vsix

.DS_Store
.vscode
test
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "e15-syntax-highlighter" extension will be documented in this file.

<!-- ## [Unreleased] -->

## [1.0.0] 2023-02-05

- Initial release
674 changes: 674 additions & 0 deletions LICENCE.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# E15 Syntax Highlighter
A TextMate Grammar based syntax highlighter for NYU's pedagogical ISA, E15.

\!\[highlit\]\(images/example.png\)

## Requirements

1. Text editor that supports TextMate Grammar, such as VS Code.
26 changes: 26 additions & 0 deletions examples/example1.e15
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* OPCODE SRC DST IMMDATA */
myROM[0] = {jmp, RXX, RXX, 4'b0000};
myROM[1] = {jz, RXX, RXX, 4'b0000};
myROM[2] = {jnz, RXX, RXX, 4'b0000};
myROM[3] = {mov, Rg0, Rg1, 4'b0000};
myROM[4] = {movi, RXX, Rg0, 4'b0001};
myROM[6] = {add, Rg2, Rg3, 4'b0000};
myROM[5] = {addi, RXX, Rg1, 4'b0010};
myROM[7] = {sub, Rg0, Rg1, 4'b0000};
myROM[8] = {subi, RXX, Rg2, 4'b0011};
myROM[9] = {cmp, Rg2, Rg3, 4'b0000};
myROM[10] = {cmpi, RXX, Rg3, 4'b0100};
myROM[11] = {jmp, RXX, RXX, 4'b0000};
myROM[12] = {jmp, RXX, RXX, 4'b0000};
myROM[13] = {jmp, RXX, RXX, 4'b0000};
myROM[14] = {jmp, RXX, RXX, 4'b0000};
myROM[15] = {jmp, RXX, RXX, 4'b0000};

/*

This program does nothing but prove that
my syntax highlighter is functional

- Rishyak

*/
Binary file added images/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "};"],
["[", "]"],
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
],
}
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "e15-syntax-highlighter",
"displayName": "E15 Syntax Highlighter",
"description": "Syntax highlighter for NYU's pedagogical ISA, E15",
"version": "1.0.0",
"author": {
"name": "Rishyak",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/rishyak/extention15"
},
"main": "src/extension",
"activationEvents": [
"onLanguage:e15"
],
"engines": {
"vscode": "^1.75.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "e15",
"aliases": [
"E15",
"e15"
],
"extensions": [
".v",
".e15"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "e15",
"scopeName": "source.e15",
"path": "./syntaxes/e15.tmLanguage.json"
}
]
},
"devDependencies": {
"js-yaml": "^4.1.0"
}
}
1 change: 1 addition & 0 deletions src/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert("E15 Syntax Highlighting")
74 changes: 74 additions & 0 deletions syntaxes/e15.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "E15",
"patterns": [
{
"include": "#comment"
},
{
"include": "#rom"
},
{
"include": "#opcode"
},
{
"include": "#registers"
},
{
"include": "#numbers"
}
],
"repository": {
"comment": {
"patterns": [
{
"name": "comment.block.e15",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "comment.line.e15",
"begin": "//",
"end": "\\n"
}
]
},
"rom": {
"patterns": [
{
"name": "storage.name.myrom.e15",
"match": "\\b(myROM)\\b"
}
]
},
"opcode": {
"patterns": [
{
"name": "markup.quote.opcode.e15",
"match": "\\b(jmp|jz|jnz|mov|movi|add|addi|sub|subi|cmp|cmpi)\\b"
}
]
},
"registers": {
"patterns": [
{
"name": "variable.parameter.registers.e15",
"match": "\\b(RXX|Rg[0-3])\\b"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.immediate.e15",
"match": "(4'b\\d{4})"
},
{
"name": "constant.numeric.rom.e15",
"match": "(\\d{1,2})"
}
]
}
},
"scopeName": "source.e15"
}
36 changes: 36 additions & 0 deletions syntaxes/e15.tmLanguage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$schema: https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json
name: E15
patterns:
- include: "#comment"
- include: "#rom"
- include: "#opcode"
- include: "#registers"
- include: "#numbers"
repository:
comment:
patterns:
- name: comment.block.e15
begin: /\*
end: \*/
- name: comment.line.e15
begin: //
end: \n
rom:
patterns:
- name: storage.name.myrom.e15
match: \b(myROM)\b
opcode:
patterns:
- name: markup.quote.opcode.e15
match: \b(jmp|jz|jnz|mov|movi|add|addi|sub|subi|cmp|cmpi)\b
registers:
patterns:
- name: variable.parameter.registers.e15
match: \b(RXX|Rg[0-3])\b
numbers:
patterns:
- name: constant.numeric.immediate.e15
match: (4'b\d{4})
- name: constant.numeric.rom.e15
match: (\d{1,2})
scopeName: source.e15

0 comments on commit 7855f1b

Please sign in to comment.