From 4bc8cfc7d146af4280c89e9f464db0a4c4e32a45 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 20 May 2018 06:59:28 -0500 Subject: [PATCH] Initial Commit --- .gitignore | 3 + additon.t8 | 11 ++++ grammars/t8-assembly.cson | 94 +++++++++++++++++++++++++++ package.json | 13 ++++ settings/language-t8-assembly.cson | 6 ++ snippets/language-t8-assembly.cson | 7 ++ spec/language-t8-assembly-spec.coffee | 16 +++++ 7 files changed, 150 insertions(+) create mode 100644 .gitignore create mode 100644 additon.t8 create mode 100644 grammars/t8-assembly.cson create mode 100644 package.json create mode 100644 settings/language-t8-assembly.cson create mode 100644 snippets/language-t8-assembly.cson create mode 100644 spec/language-t8-assembly-spec.coffee diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ade14b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +npm-debug.log +node_modules diff --git a/additon.t8 b/additon.t8 new file mode 100644 index 0000000..1a16fd8 --- /dev/null +++ b/additon.t8 @@ -0,0 +1,11 @@ +LODIP 0,0x13 +LOADP 1,0 +ARITI ADD,14,14,1 +LODIP 0,0x13 +LOADP 2,0 +ARITI ADD,14,14,1 +ARITH ADD,0,1,2 +STORP 0,0 +HLT +0x6 +0x9 diff --git a/grammars/t8-assembly.cson b/grammars/t8-assembly.cson new file mode 100644 index 0000000..f868233 --- /dev/null +++ b/grammars/t8-assembly.cson @@ -0,0 +1,94 @@ +# If this is your first time writing a language grammar, check out: +# - https://flight-manual.atom.io/hacking-atom/sections/creating-a-grammar/ + +'scopeName': 'source.t8-assembly' +'name': 'T8 Assembly' +'fileTypes': [ + 't8' +] +'patterns': [ + { + 'match': '\\bLOAD\\b' + 'name': 'keyword.other.masm.load' + }, + { + 'match': '\\bSTOR\\b' + 'name': 'keyword.other.masm.stor' + }, + { + 'match': '\\bLOADP\\b' + 'name': 'keyword.other.masm.loadp' + }, + { + 'match': '\\bSTORP\\b' + 'name': 'keyword.other.masm.storp' + }, + { + 'match': '\\bLODI\\b' + 'name': 'keyword.other.masm.lodi' + }, + { + 'match': '\\bLODIP\\b' + 'name': 'keyword.other.masm.lodip' + }, + { + 'match': '\\bARITH\\b' + 'name': 'keyword.other.masm.arith' + }, + { + 'match': '\\bARITI\\b' + 'name': 'keyword.other.masm.ariti' + }, + { + 'match': '\\bMOV\\b' + 'name': 'keyword.other.masm.mov' + }, + { + 'match': '\\bJMPC\\b' + 'name': 'keyword.control.masm.jmpc' + }, + { + 'match': '\\bCALL\\b' + 'name': 'keyword.control.masm.call' + }, + { + 'match': '\\bHLT\\b' + 'name': 'keyword.control.masm.hlt' + }, + { + 'match': '\\bRET\\b' + 'name': 'keyword.control.masm.ret' + }, + { + 'match': '\\bIN\\b' + 'name': 'keyword.other.masm.in' + }, + { + 'match': '\\bOUT\\b' + 'name': 'keyword.other.masm.out' + }, + { + 'match': '\\bPUSH\\b' + 'name': 'keyword.other.masm.push' + }, + { + 'match': '\\bPOP\\b' + 'name': 'keyword.other.masm.pop' + }, + { + 'match': "\\bADD\\b" + 'name': 'keyword.other.masm.add' + }, + { + 'match': '#.*' + 'name': 'comment.line.number-sign' + }, + { + 'match': '\\b\\d+\\b' + 'name': 'constant.numeric.masm' + }, + { + 'match': '\\b0x[0-9a-fA-F]+\\b' + 'name': 'constant.numeric.masm' + } +] diff --git a/package.json b/package.json new file mode 100644 index 0000000..ba096e3 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "language-t8-assembly", + "version": "0.0.0", + "description": "This is the atom package for my T8 cpu's assembly language (see pjht/t8)", + "keywords": [ + "language", + "grammar" + ], + "repository": "https://github.com/pjht/language-t8-assembly", + "engines": { + "atom": ">=1.0.0 <2.0.0" + } +} diff --git a/settings/language-t8-assembly.cson b/settings/language-t8-assembly.cson new file mode 100644 index 0000000..ad3f62d --- /dev/null +++ b/settings/language-t8-assembly.cson @@ -0,0 +1,6 @@ +# If you want some examples of settings, check out: +# https://github.com/atom/language-gfm/blob/master/settings/gfm.cson + +'.source.t8-assembly': + 'editor': + 'commentStart': '#' diff --git a/snippets/language-t8-assembly.cson b/snippets/language-t8-assembly.cson new file mode 100644 index 0000000..053ef3c --- /dev/null +++ b/snippets/language-t8-assembly.cson @@ -0,0 +1,7 @@ +# If you want some example snippets, check out: +# https://github.com/atom/language-javascript/blob/master/snippets/javascript.cson + +'.source.t8-assembly': + 'Method documentation': + 'prefix': 'doc' + 'body': '@@ ${1:method} - ${2:description}' diff --git a/spec/language-t8-assembly-spec.coffee b/spec/language-t8-assembly-spec.coffee new file mode 100644 index 0000000..42cd4a6 --- /dev/null +++ b/spec/language-t8-assembly-spec.coffee @@ -0,0 +1,16 @@ +# If you want an example of language specs, check out: +# https://github.com/atom/language-javascript/blob/master/spec/javascript-spec.coffee + +describe "T8Assembly grammar", -> + grammar = null + + beforeEach -> + waitsForPromise -> + atom.packages.activatePackage("language-t8-assembly") + + runs -> + grammar = atom.syntax.grammarForScopeName("source.t8-assembly") + + it "parses the grammar", -> + expect(grammar).toBeTruthy() + expect(grammar.scopeName).toBe "source.t8-assembly"