Skip to main content

IT systems are growing in complexity and the threat from cyberattacks is increasing. Threat modeling is a process that can be used to analyze potential attacks to IT systems in order to facilitate secure design. Meta Attack Language (MAL) is a threat modeling language framework for the creation of domain specific languages (DSL). MAL is developed at KTH Royal Institute of Technology.

Project description

tree-sitter-mal

MAL grammar for tree-sitter. Used in the MAL-toolbox to parse MAL languages.

References

Usage

Install tree sitter CLI to be able to use this grammar. Then, run tree-sitter generate to generate the parser from the grammar and tree-sitter test to test the parser, as well as the syntax highlighting and code navigation queries.

To see the parse tree the parser generates, use the command tree-sitter parse.

To use the highlight through the command line, make sure you have a config file initialized. Then, you can use your own highlighting colors or copy the ones in the repository, specialized for MAL. Lastly, use tree-sitter highlight to generate an output, see the docs for more information.

For more commands see tree sitter CLI docs and the tree-sitter-mal Wiki.

NeoVim Manual Installation

[!NOTE] Tested for NeoVim v0.11.1.

Using nvim-treesitter

  1. Install the grammar. Simply add the following Lua snippet to your configuration (init.lua or respective package config)
    local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
    parser_config.mal = {
      install_info = {
        url = "https://github.com/Tobiky/tree-sitter-mal", -- local path or git repo
        files = {"src/parser.c"},
        branch = "main",
        generate_requires_npm = false,
        requires_generate_from_grammar = false,
      },
      filetype = "mal",
    }
    vim.filetype.add({
        extension = {
            mal = "mal",
        },
    })
    
  2. Install the queries. Find the query installation folder (it will be in your runtime path, :h rtp). You can find various locations by using e.g. find ~ -type d -and -iname "queries" (NOTE: This example only looks at files installed in your home directory). An example of the path can be $HOME/.local/share/nvim/lazy/nvim-treesitter/ if you are using the Lazy PM. Install the files from queries into a directory named after the language (cp -r queries $NVIM_TREESITTER_QUERIES/mal/).
  3. Verify that everything is installed by running a healthcheck :checkhealth nvim-treesitter, the table will list if the grammar and highlighting has been found.
  4. Configure Nvim to start tree-sitter. Here is an example using auto-commands:
    vim.api.nvim_create_autocmd( 'FileType', { pattern = 'mal',
        callback = function(args)
            vim.treesitter.start(args.buf, 'mal')
        end
    })
    

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_mal-1.2.4.tar.gz (34.4 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_mal-1.2.4-cp39-abi3-win_arm64.whl (23.7 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_mal-1.2.4-cp39-abi3-win_amd64.whl (25.0 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_x86_64.whl (34.1 kB view details)

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

tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_aarch64.whl (34.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_mal-1.2.4-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (35.1 kB view details)

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

tree_sitter_mal-1.2.4-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (34.1 kB view details)

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

tree_sitter_mal-1.2.4-cp39-abi3-macosx_11_0_arm64.whl (22.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_mal-1.2.4-cp39-abi3-macosx_10_9_x86_64.whl (21.5 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_mal-1.2.4.tar.gz.

File metadata

  • Download URL: tree_sitter_mal-1.2.4.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tree_sitter_mal-1.2.4.tar.gz
Algorithm Hash digest
SHA256 c511d0a3ae03f3ac49be8958c1106ac4fafde083957605c02e5c7dba44abb946
MD5 c41c5354fed8fc3bc3b11fdbb8a87065
BLAKE2b-256 a0b56822205037fb5ff88cadfc0a27e22d4cc704ce9b81771d88206dd1c07939

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 e7447ae2b06fa80d95aec17c121b22e612990bdc8f31d5b9a11bb43267518ad1
MD5 ca1adf4ca68e89caa919325bc86e75c7
BLAKE2b-256 eafcbc26aa48c9e69fda7188b44a56ee3087116398832af7bf8a688fd5f606ce

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ea09b72bd54060dbd2c572e15ea75594a979ea99e67304401d5e79d6720abdfe
MD5 406b422a0714ac94d146b246d49a7603
BLAKE2b-256 2df8a444153770d39ca7e985a9d17f700dd90e7e3acc0db308cc6b92605cf945

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9f3a568d93cbf020a1fe99f4d0d7a1d664d1a8680c64a472bd940d103db417a0
MD5 77d558606f79d0ba89c22a5250a2d1ed
BLAKE2b-256 38802aafb77755a865bc5a9174b561d21f64f5ca38b373b048ae050d07b58af5

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ec7ba004f33406d93dc71413b57574fb410298a785812b3e42a650ba02982ec3
MD5 7919fd1e386e2f5d91355cedf58acd06
BLAKE2b-256 18595e3433dbb8ad530549604cb0bbdbd2ee766d066a22aa1f31cdc5337e773c

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 61e8399a7d6647ce0d1730ff91fb458131e9a71f60d0c4696fd4c78fbef0e896
MD5 90dbdef2ca548757208662b0d251a101
BLAKE2b-256 cae797b5bbb41cb2795f7d7805b8be62524860766e33b1d1c6e879a97a7a946e

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c2116fa2b5837311a31a6a0a513eeba64c28487f7c9333813526fbe600642894
MD5 c04b6f6ce3da4ed9099c5d0fff3c9d2e
BLAKE2b-256 abf9391e5326188ddb0aedcf0888ce447f492606cdf6c67f1b937f54a91ccade

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02285dd4a03a8fa11c5fa385255c6fe6b84d4877ffcfb2d47526fe6b93640a14
MD5 332b234c89d9d3573337fb6b31f8f889
BLAKE2b-256 053e159b1ed7d4af4629f550b777fd0431e98c2e5216f9eaaeed1fd1d8618c4c

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.2.4-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.2.4-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b3cfdb84090144bb5e4bdbec247f46f40ea33dc9b6233792c3a573933092b14
MD5 f8614d70cd65fb0ca038416dc491b093
BLAKE2b-256 1df81e275f86c4dd52eb8414ae6be9d300555508885f66240d3ede3cdfe2db38

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