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.

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.

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.0.0.tar.gz (26.5 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.0.0-cp39-abi3-win_arm64.whl (19.9 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_mal-1.0.0-cp39-abi3-win_amd64.whl (21.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_mal-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl (30.4 kB view details)

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

tree_sitter_mal-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (32.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_mal-1.0.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (32.3 kB view details)

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

tree_sitter_mal-1.0.0-cp39-abi3-macosx_11_0_arm64.whl (18.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_mal-1.0.0-cp39-abi3-macosx_10_9_x86_64.whl (18.2 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for tree_sitter_mal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6f2bfc1c04a6e3f012b46d970546058042e0d829018276854b5c348f49d4f9ef
MD5 312a8e60b19777117ca88859b0f15851
BLAKE2b-256 44ad0b2e1989ea51eecc5e6ca842b48ad179453b206f308c996b3067351323d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 13168fcceb926f2540cf16b04562865c97e2226b15aa9aff2c05fbf1b1794fe6
MD5 5eda18a7c8564764c51b2dfee3f323d6
BLAKE2b-256 233a180f82eccb68cd472ab485087fd33980f0489b06ac98bec71d11080d2821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 650a0f55bd5146b6584e2cb32aa36052979ebdd5971db0ea19b8f667b099bf5d
MD5 23fed29f927ba3c6c67a88be904a8b94
BLAKE2b-256 27c69e8af7d038a52eac6ca28eb1d1637e30fcd82a19af028aa228674e8d5d7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5a97da06763c5fd6ffde5a62beac8319cd00ec26b2b59b2f353663e7b8080ad3
MD5 2a93cd8888b68ea416d58c16695b6bdc
BLAKE2b-256 5f1dd0704d56dd169835c8181b1d47b169881aacc999194eb15f8db2d6b155c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d814f5a34db79f67045b922ace967e1a67d83abc20e957a05cec39caf0e5c69a
MD5 f3fd7475b904a048f22cb6bfad6f7fac
BLAKE2b-256 34cf7ff54fc8e30a9a6877d9bdaa75765b962bd8fcc229bde9dae86dbbb3ec3b

See more details on using hashes here.

File details

Details for the file tree_sitter_mal-1.0.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c919c910a41fbae301ebf8e224384dbfd733488d7a5e207ec38981a5777abe37
MD5 4e8f9ea21523fedf5fa7426ed5e01b91
BLAKE2b-256 3f76875328adb0b40648c9773018bf900b1f9ccc5260a1fa778f70839541f3c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 722b9b9510f4289a77bb25e28f47bb5a7987009558da7b9249a7946ffee6135c
MD5 5be0dfadcce4975203ef457118fa0dc9
BLAKE2b-256 93757f46e7e9e3e0df2146c706856841517574f5dc0f3ac16d15ec39843ed5ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_mal-1.0.0-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9dd0c6c70cf2c9fe6dc19e9b3ba68e9cd497b3d25483f74e7e0e46c0e5ce72e0
MD5 97e2e867caf5a93efae245a3796f091b
BLAKE2b-256 0961961e14f30f8ce9fa698d82735e9a423368a4731dd3e6d34b1cd14d08850d

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