TextMate grammars for NLP++, the programming language built for natural language processing, and for the supporting VisualText file formats.
These are the canonical, license-clean source grammars. They are extracted from the
VS Code NLP++ extension so that downstream
projects — GitHub Linguist, Shiki, bat, Sublime Text, JetBrains IDEs, and anything else
that consumes TextMate grammars — can vendor them directly without pulling in the whole
extension.
| File | Scope name | Extensions | Description |
|---|---|---|---|
syntaxes/nlp.tmLanguage.json |
source.nlp |
.nlp, .pat |
NLP++ language — rules, regions, and code |
syntaxes/dict.tmLanguage.json |
source.dict |
.dict |
Dictionary files |
syntaxes/kb.tmLanguage.json |
source.kb |
.kb |
Knowledge base dumps |
syntaxes/kbb.tmLanguage.json |
source.kbb |
.kbb |
Knowledge base build files |
syntaxes/tree.tmLanguage.json |
source.tree |
.tree, .log |
Parse tree output |
syntaxes/txxt.tmLanguage.json |
source.txxt |
.txxt |
Highlighted text output |
syntaxes/seq.tmLanguage.json |
source.seq |
.seq |
Analyzer pass sequence files |
source.nlp is the one most integrations want. The others describe VisualText's data and
output formats rather than the language itself.
Matching VS Code language configurations (brackets, comments, auto-closing pairs) are in
language-configuration/.
Every scope follows the TextMate naming conventions
(keyword.control, constant.language, entity.other.attribute-name, string.quoted.double, ...)
and ends in the language's own suffix (.nlp, .tree, ...), so any theme colors NLP++ without
custom rules. Older versions used invented names that only colored correctly with the VS Code
extension's own color settings. If you have color customizations keyed to those names, rename them:
| Old | New |
|---|---|
keyword.region.nlp (@RULES, @CODE, ...) |
keyword.control.directive.region.nlp |
keyword.constants.nlp (_xWILD, _ROOT, ...) |
constant.language.nlp |
keyword.attribute.nlp (match, opt, trig, ...) |
entity.other.attribute-name.nlp |
keyword.equals.nlp |
keyword.operator.assignment.nlp |
variable.rewrite.nlp (the suggested concept) |
entity.name.type.rewrite.nlp |
variable.rewrite-symbol.nlp |
meta.attribute.rewrite.nlp |
literal.nlp, literal.seq, literal.tree |
meta.literal.* |
string.double.* |
string.quoted.double.* |
constant.character.escape, punctuation.paren.*, punctuation.square.* (.nlp) |
same, with .nlp |
keyword.rewrite.tree (_NP, ...) |
entity.name.type.tree |
keyword.node.tree (token text) |
string.unquoted.token.tree |
keyword.attribute.tree (alpha, num, ...) |
storage.type.tree |
keyword.fired.tree |
keyword.other.fired.tree |
keyword.other.kbb, keyword.concept.kbb, keyword.concept.kbb1, keyword.concept.kbb2 |
entity.name.type.level0.kbb ... level3.kbb |
comment.line.dict (headword), keyword.region.dict (key), entity.name.function.dict (value) |
entity.name.tag.dict, support.type.property-name.dict, string.unquoted.value.dict |
comment.line.dict in .kb, .kbb, .tree; constant.numeric.tree in .kbb; meta.expression.tree in .txxt |
the file's own suffix |
variable.parameter.nlp in .kb (add, bind, ...) |
keyword.control.kb |
# runs to end of line. C-style /* ... */ block comments are supported by the NLP++
engine as of version 3.7.14, in the pass language (.nlp, .pat) and in the four
line-oriented data formats (.seq, .kb, .dict, .kbb). They do not nest — the first
*/ closes — and delimiters inside a string or a # comment are ordinary text. .tree
files are engine output and use * line comments only.
samples/ contains real-world NLP++ from the
parse-en-us English parser (MIT licensed,
same authors) — useful for grammar regression testing and for submissions that require
non-trivial example code.
Shiki / VS Code / any TextMate host — point at the raw JSON:
const nlp = await fetch(
'https://raw.githubusercontent.com/VisualText/nlpplus-tmbundle/main/syntaxes/nlp.tmLanguage.json'
).then(r => r.json())Vendoring — add this repository as a git submodule. It is intentionally small and has no build step, no dependencies, and no generated files.
NLP++ is a programming language designed specifically for natural language processing, created by Amnon Meyers and David de Hilster. Analyzers are written as sequences of passes, each applying pattern rules to a parse tree. See visualtext.org.
MIT — see LICENSE. Copyright 1998- Amnon Meyers, David de Hilster.