Quick Start

Go to…

Playground CLI JavaScript Rust

CLI

The CLI allows you to compile Pomsky expressions in the command line.

Pre-built binaries are available for Windows, Linux and macOS. Download them from the releases page.

Pomsky is also packaged for some package managers:

Packaging status

Install from source

This requires that a recent Rust toolchain is installed. Instructions for how to install Rust can be found here.

Install the CLI with

cargo install pomsky-bin

Get help

To find out how to use the CLI, run

pomsky --help

JavaScript plugin

Pomsky can be used with the npm module @pomsky-lang/unplugin. This is a compiler plugin, usable with Vite / Rollup / Webpack / ESBuild / ESM.

If you’re using Vite, add it to your config like this:

import { defineConfig } from 'vite'
import pomsky from '@pomsky-lang/unplugin'

export default defineConfig({
  plugins: [pomsky()],
})

Then you can import *.pom files from JavaScript/TypeScript:

import myRegex from './myRegex.pom'

myRegex().test('does this string match?')

or declare Pomsky expressions with the built-in pomsky$ macro:

const myRegex = pomsky$(`% [word]{5} %`)

myRegex().test('does this string match?')

Rust macro

If you want to write a Pomsky expression directly in your Rust source code, the pomsky-macro got you covered. Run this command:

cargo add pomsky-macro

Then you can import and use it with

use pomsky_macro::pomsky;

const MY_REGEX: &str = pomsky!(["great!"] | "great!");

Documentation can be found here.