Skip to content

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'constpomskyExpression='"Hello, world!"'constast=parse(pomskyExpression)if(Array.isArray(ast)){thrownewError('Parse errors occurred')}

Tokenize only

import{tokenize}from'@pomsky-lang/parser/tokenizer'constpomskyExpression='"Hello, world!"'consttokens=tokenize(pomskyExpression)

Tokenize and parse separately

import{parse,tokenize}from'@pomsky-lang/parser'constpomskyExpression='"Hello, world!"'consttokens=tokenize(pomskyExpression)constast=parse(pomskyExpression,tokens)if(Array.isArray(ast)){thrownewError('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

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages