Skip to main content

A syntax parser for the MIPS Instruction Set Architecture.

Project description

tree-sitter-mips

Tree-sitter grammar for the MIPS assembly language.

Getting started

Building with npm

First, run npm install to install the tree-sitter cli. Next, build the grammar using npm run build, which generates the necessary parser files, or use it to parse a file with npm run parse $file.

Building without npm

Install tree-sitter (e.g. nix-shell -p tree-sitter).
Build the grammar using tree-sitter generate and parse a file with tree-sitter parse $file.

Integration in Neovim

To use tree-sitter-mips in neovim, the plugin nvim-treesitter is required.

Installing the lastest grammar from this repo involves the following three steps:

  1. Update your Neovim config for nvim-treesitter to refer to tree-sitter-mips. Add this to your tree-sitter config in neovim:
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.mips = {
  install_info = {
    url = 'https://github.com/omeyenburg/tree-sitter-mips', -- You can use a local path
    branch = 'main',
    files = { 'src/parser.c' },
    generate_requires_npm = false,
    requires_generate_from_grammar = false,
  },
  filetype = 'asm',
}
  1. Tree-sitter should automatically install tree-sitter-mips for you when you open a .asm file. If not, run :TSInstall mips inside Neovim.
  2. Copy the files from ./queries/ to the neovim config directory at $XDG_CONFIG_HOME/nvim/queries/mips/ - see the Adding queries section of the nvim-treesitter README. They are required to enable highlighting.
mkdir -p $XDG_CONFIG_HOME/nvim/queries/mips/
cp ./queries/* $XDG_CONFIG_HOME/nvim/queries/mips/

Alternatives

If you are looking for a more general grammar for assembly, check out tree-sitter-asm which supports features of other instruction sets, yet it lacks some specific features of MIPS.

Further resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_mips-0.1.3.tar.gz (30.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_mips-0.1.3-cp39-abi3-win_arm64.whl (22.0 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_mips-0.1.3-cp39-abi3-win_amd64.whl (23.0 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_mips-0.1.3-cp39-abi3-musllinux_1_2_x86_64.whl (40.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

tree_sitter_mips-0.1.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (43.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_mips-0.1.3-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (40.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_mips-0.1.3-cp39-abi3-macosx_11_0_arm64.whl (22.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_mips-0.1.3-cp39-abi3-macosx_10_9_x86_64.whl (21.7 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_mips-0.1.3.tar.gz.

File metadata

  • Download URL: tree_sitter_mips-0.1.3.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree_sitter_mips-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f7d0bc0141569a5ee1a354bf0756ba99a5bf1e27771e35500b514cc38f8dbeec
MD5 7dd075ad1ed9f3245878a3364ea4d1e1
BLAKE2b-256 7b6e8cb23d2636328c9d1ff8196168e9b8a09ba3979503fe66a7afefeb0236e0

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 6ef300795ab30bf9fce363ecb9afab9ab10252582b7765e19578a737893b003a
MD5 154f0274924c321cca9735b03d8f160f
BLAKE2b-256 f421286c6f858d0d37431ea4d2a5c5c2d5424956cd242dc36904d4fbdf5e28fd

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7a610e0ed4cdbc515d34584cafcd6974dad3605ff0c35e33814c2e519edd22d4
MD5 157a0c55c4b4705f56916673e34e9383
BLAKE2b-256 cb8fbfe37cfdf944c9aa1c440155f8fc809ad545dea1988cc7ed06e9b502838b

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 583ca8582470b011643e656aae049ba188b8224b17e1604a009783f3992d7bef
MD5 f85828015eda3b4a5a69abd1bb694241
BLAKE2b-256 13f0c62781d3fa9559a4c0948aff23b35ca79e9d86f5a3f8a2d86ae49a9de936

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a2a411b68d727e44909cd99f87e5ff165e769fe326880ad609d947318c283289
MD5 866e7f962216826c95b89a74a6926986
BLAKE2b-256 1cbe650ef2a7917314d2408a2137879acb23e723038d02ac47f8c68fd70c300a

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b08aa4fb94830a00b31125fe520827fbf4e8858426cf0314433e37a63a22593b
MD5 4c0478b790b505bf7369f4228a1fef7d
BLAKE2b-256 490e9906457a3dc431f3531a6775e00d77b9895396642234bdda375dc4739bb3

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a93c312425caca6ce6e9d452be234c6b50863009a01773ee5a3dc5a08a97f73
MD5 fa0bb270eb32b700cc0c6a9fa7e05863
BLAKE2b-256 b5ce3d0927bdf574b87e19c52f58db05eaa5eaa7ab58a9309b0e7c9fe984db4e

See more details on using hashes here.

File details

Details for the file tree_sitter_mips-0.1.3-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mips-0.1.3-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 760f56aa85ff985a9a7376036772debb2aadc2f1fe61b2a668bced5286ac761a
MD5 43fcf5ee97d5ba1a87c794dbfb765de2
BLAKE2b-256 e6fb134de166d6777b306bdaec92758d09a2abcc7127ddf979d46c824004f856

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page