Skip to content

Pomsky parser written in TypeScript. Used for VS Code plugin

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

pomsky-lang/pomsky-parser

Repository files navigation

@pomsky-lang/parser

An npm module for parsing Pomsky files, written in TypeScript.

This module is used for the VSCode extension.

Usage

import { parse } from '@pomsky-lang/parser'

const pomskyExpression = '"Hello, world!"'

const ast = parse(pomskyExpression)
if (Array.isArray(ast)) {
  throw new Error('Parse errors occurred')
}

Tokenize only

import { tokenize } from '@pomsky-lang/parser/tokenizer'

const pomskyExpression = '"Hello, world!"'

const tokens = tokenize(pomskyExpression)

Tokenize and parse separately

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')
}

Import types

The types for AST nodes (including const enums) can be imported from '@pomsky-lang/parser/rule'.

Donations

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.

Contributing

  • 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.

License

Dual-licensed under the MIT and Apache 2.0 license.

About

Pomsky parser written in TypeScript. Used for VS Code plugin

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published