An npm module for parsing Pomsky files, written in TypeScript.
This module is used for the VSCode extension.
import { parse } from '@pomsky-lang/parser'
const pomskyExpression = '"Hello, world!"'
const ast = parse(pomskyExpression)
if (Array.isArray(ast)) {
throw new Error('Parse errors occurred')
}
import { tokenize } from '@pomsky-lang/parser/tokenizer'
const pomskyExpression = '"Hello, world!"'
const tokens = tokenize(pomskyExpression)
import { parse, tokenize } from '@pomsky-lang/parser'
const pomskyExpression = '"Hello, world!"'
const tokens = tokenize(pomskyExpression)
const ast = parse(pomskyExpression, tokens)
if (Array.isArray(ast)) {
throw new Error('Parse errors occurred')
}
The types for AST nodes (including const enum
s) can be imported from '@pomsky-lang/parser/rule'
.
Pomsky is a passion project, so I rely on donations to make it financially sustainable. If you like this module, consider sponsoring my work on GitHub Sponsors.
- Make sure your code is formatted with prettier, passes
biome lint
, and type-checks. We still have to add these checks to CI. - Please follow conventional commits.
- Please adhere to the code of conduct.
This parser is currently lacking unit and integration tests. If you want to contribute, integrating the Rust test suite would be a great way to start.
Dual-licensed under the MIT and Apache 2.0 license.