# Baba Yaga Syntax Highlighting This directory contains syntax highlighting implementations for the Baba Yaga programming language across various editors and IDEs. ## Supported Editors ### [VS Code](./vscode/) - Complete extension with package.json, language configuration, and TextMate grammar - **Installation**: Copy to VS Code extensions directory or build with `vsce` - **Features**: Syntax highlighting, auto-closing brackets, indentation, code folding ### [Sublime Text](./sublime/) - YAML-based syntax definition - **Installation**: Copy to Sublime Text packages directory - **Features**: Syntax highlighting, automatic file detection ### [TextMate](./textmate/) - Complete TextMate bundle with Info.plist and grammar - **Installation**: Double-click bundle or copy to TextMate bundles directory - **Features**: Syntax highlighting, code folding, auto-indentation ### [Vim/NeoVim](./vim/) - Vim syntax file and filetype detection - **Installation**: Copy to Vim runtime directory or use plugin manager - **Features**: Syntax highlighting, automatic file detection, custom highlighting ### [Emacs](./emacs/) - Complete major mode with syntax highlighting and indentation - **Installation**: Copy to Emacs load path or use package manager - **Features**: Syntax highlighting, indentation, comment handling, key bindings ### [Helix](./helix/) - Tree-sitter grammar and language configuration - **Installation**: Copy to Helix languages directory - **Features**: Syntax highlighting, Tree-sitter parsing, language server support ### [Micro](./micro/) - YAML-based syntax highlighting rules - **Installation**: Copy to Micro syntax directory - **Features**: Syntax highlighting, automatic file detection ## Common Features All implementations provide syntax highlighting for: - **Keywords**: `when`, `then`, `is`, `Ok`, `Err`, `true`, `false`, `PI`, `INFINITY`, `and`, `or`, `xor` - **Types**: `Bool`, `Int`, `Float`, `String`, `List`, `Table`, `Result`, `Number` - **Operators**: `->`, `=>`, `+`, `-`, `*`, `/`, `%`, `=`, `!=`, `>`, `<`, `>=`, `<=`, `..` - **Built-in Functions**: `map`, `filter`, `reduce`, `append`, `set`, `merge`, `shape` - **IO Functions**: `io.out`, `io.in` - **String Functions**: `str.concat`, `str.split`, `str.join`, `str.length`, `str.substring`, `str.replace`, `str.trim`, `str.upper`, `str.lower` - **Math Functions**: `math.abs`, `math.sign`, `math.floor`, `math.ceil`, `math.round`, `math.trunc`, `math.min`, `math.max`, `math.clamp`, `math.pow`, `math.sqrt`, `math.exp`, `math.log`, `math.sin`, `math.cos`, `math.tan`, `math.asin`, `math.acos`, `math.atan`, `math.atan2`, `math.deg`, `math.rad`, `math.random`, `math.randomInt` - **Comments**: `//` and `/* */` - **Strings**: Double-quoted strings - **Numbers**: Integers and floats - **Variables**: Identifiers - **Function Definitions**: `name : value;` pattern - **When Expressions**: Pattern matching with `when`, `then`, `is` - **Lists**: `[1, 2, 3]` syntax - **Tables**: `{key: value}` syntax - **Result Types**: `Ok value` and `Err message` ## Quick Installation ### VS Code ```bash cd dev/vscode npm install -g vsce vsce package # Install the generated .vsix file in VS Code ``` ### Sublime Text ```bash cp dev/sublime/Baba\ Yaga.sublime-syntax ~/.config/sublime-text/Packages/User/ ``` ### TextMate ```bash cp -r dev/textmate/Baba\ Yaga.tmbundle ~/Library/Application\ Support/TextMate/Bundles/ ``` ### Vim/NeoVim ```bash cp dev/vim/syntax/baba.vim ~/.vim/syntax/ cp dev/vim/ftdetect/baba.vim ~/.vim/ftdetect/ ``` ### Emacs ```bash cp dev/emacs/baba-yaga-mode.el ~/.emacs.d/ # Add (require 'baba-yaga-mode) to your init file ``` ### Helix ```bash mkdir -p ~/.config/helix/languages cp dev/helix/languages.toml ~/.config/helix/languages/ ``` ### Micro ```bash mkdir -p ~/.config/micro/syntax cp dev/micro/syntax/baba-yaga.yaml ~/.config/micro/syntax/ ``` ## Development ### Adding New Keywords When adding new keywords to the Baba Yaga language, update all syntax files: 1. **VS Code**: Update `syntaxes/baba-yaga.tmLanguage.json` 2. **Sublime**: Update `Baba Yaga.sublime-syntax` 3. **TextMate**: Update `Syntaxes/Baba Yaga.tmLanguage` 4. **Vim**: Update `syntax/baba.vim` 5. **Emacs**: Update `baba-yaga-mode.el` 6. **Helix**: Update `grammar.js` 7. **Micro**: Update `syntax/baba-yaga.yaml` ### Testing Test each implementation with a sample `.baba` file: ```baba // Test file for syntax highlighting myVar : 42; myString : "Hello, Baba Yaga!"; myFunction : x -> x + 1; myResult : when x is 1 then "One" _ then "Other"; // Test built-in functions io.out "Testing"; doubled : map (x -> x * 2) [1 2 3]; length : str.length "hello"; abs : math.abs -5; ``` ### Color Schemes All implementations use standard editor color schemes. Custom themes can be created by targeting the appropriate scopes: - `source.baba-yaga` - Main scope - `keyword.control.baba-yaga` - Keywords - `storage.type.baba-yaga` - Types - `keyword.operator.baba-yaga` - Operators - `string.quoted.double.baba-yaga` - Strings - `comment.line.double-slash.baba-yaga` - Comments ## Contributing When contributing syntax highlighting improvements: 1. Test with the sample code above 2. Ensure consistency across all editors 3. Update this README if adding new features 4. Follow the existing code style for each editor 5. Verify against the actual Baba Yaga language specification ## License All syntax highlighting files are provided under the same license as the main Baba Yaga project.