Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ComFreek/a64775e019db853a0f95c8a5b2fc26d9 to your computer and use it in GitHub Desktop.
Save ComFreek/a64775e019db853a0f95c8a5b2fc26d9 to your computer and use it in GitHub Desktop.
Compilation of Syntax Highlighting Solutions used in Major Software Products

Compilation of Syntax Highlighting Solutions used in Major Software Products

GRLs (generalized regex lexers; made-up name) are a common lexer type which are represented by a

  • deterministic state-based finite automaton with regex at eges (similar to generalized non-det. finite automaton),
  • such that edges can not only transition to a new state but also push or pop multiple states and also issue/yield token types (e.g. "keyword", "string", "punctuation").
  • additionally, the set of outgoing edges for a state is actually ordered ("list of rules"; what matches first, is gone first),
  • and you can also import the rule lists from other states (e.g. have a common "comment rule list")

(Is there a formal name for it? See also https://github.com/mozilla/skywriter/wiki/Common-JavaScript-Syntax-Highlighting-Specification, a spec that apparently never took off)

Product Highlighting Software Language of Lexer Supported Lexer Types Official Folder/Repo of Languages
LaTeX with minted Pygments Python GRL pygments/pygments @ GitHub
GitLab viewing Rouge Ruby GRL rouge-ruby/rouge @ GitHub
GitLab single-file editing Ace JavaScript GRL ajaxorg/ace @ GitHub
GitLab multi-file editing Monaco TypeScript GRL microsoft/monaco-language @ GitHub.com
GitHub viewing Linguist XML GRL github/linguist @ GitHub.com
GitHub editing CodeMirror JavaScript GRL and raw lexer API (eat, eatUntil, ...) codemirror/CodeMirror @ GitHub.com
VSCode, Visual Studio Code TextMate Grammars (enhanced?) plist files GRL VSCode Marketplace
JetBrains IntelliJ Custom Java, but creatable from JFlex EBNF All (since only Java API required) JetBrains Marketplace
Notepad++ Custom XML weak; can only specify common string occurrences and operators to match; not even regex-based notepad-plus-plus/userDefinedLanguages @ GitHub.com (semiofficial)
jEdit
(not major product; but relevant for our purposes)
Custom XML GRL ?, see also http://www.jedit.org/users-guide/writing-modes.html

Relevant and implemented for MMT surface syntax:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment