added v2.0

This commit is contained in:
Michael Schröder
2023-01-11 11:13:09 +01:00
parent 2a5a64ca91
commit 971b323822
584 changed files with 159319 additions and 0 deletions

View File

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.asm set filetype=hack_asm

View File

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.vm set filetype=hack_vm

View File

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.hdl set filetype=hdl

View File

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.jack set filetype=jack

2
tools/vim/syntax/c.vim Normal file
View File

@@ -0,0 +1,2 @@
syn match cType "pair "
syn match cType "number "

View File

@@ -0,0 +1,32 @@
" Vim syntax file
" Language: Hack Assembly
" Maintainer: Severyn Kozak
" Latest Revision: 15 November 2014
if version < 600
syntax clear
endif
setl iskeyword+=.,$,:
syn keyword hackAsmDestination A M D AM MD AD AMD null
syn keyword hackAsmJump JGT JEQ JGE JLT JNE JLE JMP
syn match hackAsmComment "\/\/.*$"
syn match hackAsmLabel "(\k\+)"
syn match hackAsmMathOp "[+-]"
syn match hackAsmBitwiseOp "[&|]"
syn match hackAsmAInstruction "@\k\+"
syn match hackAsmCInstruction "[=;]"
syn match hackAsmConstant "-1\|0\|1"
hi link hackAsmDestination Identifier
hi link hackAsmJump Function
hi link hackAsmConstant Constant
hi link hackAsmComment Comment
hi link hackAsmLabel Label
hi link hackAsmMathOp Operator
hi link hackAsmBitwiseOp Operator
hi link hackAsmAInstruction PreProc
hi link hackAsmCInstruction Operator

View File

@@ -0,0 +1,29 @@
" Vim syntax file
" Language: Hack Virtual Machine
" Maintainer: Severyn Kozak
" Latest Revision: 02 December 2014
if version < 600
syntax clear
endif
setl iskeyword+=.,:
setl iskeyword+=-
syn keyword hackVmMathLogicOp add sub neg eq gt lt or not
syn keyword hackVmMemoryOp push pop
syn keyword hackVmMemorySegments argument local static constant this that
\ pointer temp
syn keyword hackVmProgramFlowOp label goto if-goto
syn keyword hackVmFunctionCallOp function call return
syn match hackVmComment "\/\/.*$"
syn match hackVmNumber "\v(\w)@<!\d+"
hi link hackVmComment Comment
hi link hackVmMathLogicOp Operator
hi link hackVmMemoryOp Statement
hi link hackVmMemorySegments Identifier
hi link hackVmProgramFlowOp Conditional
hi link hackVmFunctionCallOp Function
hi link hackVmNumber Number

49
tools/vim/syntax/hdl.vim Normal file
View File

@@ -0,0 +1,49 @@
" Vim syntax file
" Language: HDL
" Maintainer: Severyn Kozak
" Latest Revision: 11 November 2014
if version < 600
syntax clear
endif
" The `.hdl` extension is reserved for the `vhdl` filetype, and, by the time
" this plugin is sourced, Vim has already loaded the `vhdl` ftplugin files,
" which contain some undesired settings. The fullproof way to ignore them is to
" prevent Vim from ever setting the `vhdl` filetype, which can only be done by
" having the user specify the following:
"
" au BufNewFile,BufRead *.hdl setfiletype hdl
"
" in their vimrc, which is messy. Best to let the plugin do the work just by
" explicitly overriding the settings that we don't want, like the following.
setl indentexpr=
setl formatoptions+=or
let b:current_syntax = "hdl"
let did_load_filetypes = 1
syn match _hdl_comment_inline "\/\/.*"
syn match _hdl_delimiter "[,;:.]"
syn match _hdl_assignment "="
syn match _hdl_number "\v(\w)@<!\d+"
syn match _hdl_surrounding "[[\](){}]"
syn match _hdl_pin_name "\a[a-zA-Z0-9]*\ze=" contains=ALL
syn region _hdl_comment_block start="/\*" end="*/"
syn keyword _hdl_builtin_chip Add16 ALU And And16 ARegister Bit DFF DMux
\ DMux4Way DMux8Way DRegister Mux4Way16 Mux8Way16 FullAdder HalfAdder Inc16
\ Keyboard Mux Mux16 Or Or16 Or8Way PC RAM RAM16K RAM4K RAM512 RAM64 ROM32K
\ Screen Xor RAM8 Register RegisterWithGUI Nand Not Not16
syn keyword _hdl_section CHIP PARTS IN OUT
syn keyword _hdl_constant true false
hi link _hdl_comment_block Comment
hi link _hdl_comment_inline Comment
hi link _hdl_builtin_chip Constant
hi link _hdl_section Label
hi link _hdl_delimiter Comment
hi link _hdl_surrounding Delimiter
hi link _hdl_number Number
hi link _hdl_constant Constant
hi link _hdl_assignment Operator
hi link _hdl_pin_name Identifier

33
tools/vim/syntax/jack.vim Normal file
View File

@@ -0,0 +1,33 @@
" Vim syntax file
" Language: Jack
" Maintainer: Severyn Kozak
" Latest Revision: 01 January 2015
if version < 600
syntax clear
endif
syn keyword jackDeclaration var static field class
syn keyword jackStatement let if else while do return
syn keyword jackVarType int char boolean void
syn keyword jackFuncType constructor function method
syn keyword jackConstant true false null this
syn match jackOp "[-+*/&|<>=~]"
syn match jackString '"[^"\n]*"'
syn match jackNumber "\d\+"
syn match jackDelimiter "[.,;]"
syn match jackSurroundingElement "[{}()\[\]]"
syn match jackCommentInline "\/\/.*"
syn region jackCommentBlock start="/\*" end="*/"
hi link jackOp Operator
hi link jackSurroundingElement Delimiter
hi link jackVarType Type
hi link jackFuncType Function
hi link jackDeclaration Statement
hi link jackStatement Statement
hi link jackConstant Constant
hi link jackNumber Number
hi link jackCommentInline Comment
hi link jackCommentBlock Comment
hi link jackDelimiter Comment

View File

@@ -0,0 +1,49 @@
"Vim syntax file
"Language: nand2tetris Hardware Description Language
"Maintainer: Christopher Noussis
"Latest Revision: 14 January 2015
"TODO: Fix syntax names to work with accepted style convention
"syn keyword [languageName][SyntaxElementName]
if exists("b:current_syntax")
finish
endif
"Comments.
syn match hdlComment "\/\/.*$"
syn region hdlComment start='\/\*' end='\*\/'
syn region hdlComment start='\/\*\*' end='\*\/'
"The all-caps basic language keywords.
syn keyword basicKeywords CHIP PARTS IN OUT BUILTIN CLOCKED
"Builtin chips.
syn keyword builtInChips Nand Not And Or Xor Mux DMux
syn keyword builtInChips Not16 And16 Or16 Mux16
syn keyword builtInChips Or8Way Mux4Way16 Mux8Way16 DMux4Way DMux8Way
syn keyword builtInChips HalfAdder FullAdder Add16 ALU Inc16
syn keyword builtInChips DFF Bit Register ARegister DRegister
syn keyword builtInChips RAM8 RAM64 RAM512 RAM4K RAM16K
syn keyword builtInChips PC ROM32K Screen Keyboard
"External
syn keyword extPin in out nextgroup=busNumber
syn match busNumber '\[\d*\]' "TODO: Make it so the braces are not matched.
syn region hdlInterface start='{' end='}' fold transparent
"Internal
syn region hdlImplementation start=':' end='}' fold transparent
syn region partInterface start='(' end=')' contains=connection, extPin
"syn match connection '\w\+(\[\d+\])\*=\w\+(\[\d+\])\*'
syn match connection '\w\+=\@=' contained
syn match connection '=\@<=\w\+' contained
let b:current_syntax = 'chip'
"Syntax Highlighting
hi def link hdlComment Comment
hi def link basicKeywords Statement
hi def link builtInChips Special
hi def link extPin Type
hi def link busNumber Constant
hi def link connection Identifier