Skip to content

Conversation

@pdubroy
Copy link
Contributor

@pdubroy pdubroy commented May 9, 2025

Initial support for WebAssembly, as describe in #503.

Adds a new package which exposes a WasmMatch class. Internally, WasmMatcher compiles the grammar to a WebAssembly module that exports a match method.

Working so far:

  • basic matching use mostly pure-PEG features (no left recursion, parameterized rules, etc.)
  • rudimentary CST with a few tests

Not yet:

  • memoization
  • support for Ohm-specific features
  • clean interface for writing semantic actions

@pdubroy pdubroy requested a review from Copilot May 9, 2025 14:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces experimental support for compiling grammars to WebAssembly by adding a new package and updating various dependency versions across the repository.

  • Introduces the new package "wasm" with a WasmMatch class for grammar matching via WebAssembly.
  • Upgrades AVA from version ^4.3.3 to ^6.0.0 in multiple packages and examples to ensure consistency and leverage new test capabilities.
  • Adds AVA configuration in packages/ohm-js to improve test watch behavior.

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/wasm/package.json Added new package with basic configuration; consider populating the description field.
packages/ohm-js/package.json Upgraded AVA version and added new AVA watchMode configuration.
packages/cli/package.json Upgraded AVA version in the devDependencies.
examples/typescript/package.json Upgraded AVA version for consistency in testing.
examples/simple-lisp/package.json Upgraded AVA version for consistency in testing.
examples/operators/package.json Upgraded AVA version for consistency in testing.
examples/markdown/package.json Upgraded AVA version for consistency in testing.
examples/ecmascript/package.json Upgraded AVA version for consistency in testing and added AVA configuration.
Files not reviewed (1)
  • packages/es-grammars/package-lock.json: Language not supported

{
"name": "wasm",
"version": "1.0.0",
"description": "",
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider providing a meaningful description for the wasm package to better communicate its purpose and functionality to users and potential contributors.

Suggested change
"description": "",
"description": "A package for working with WebAssembly (Wasm), including emitting and processing Wasm modules.",

Copilot uses AI. Check for mistakes.
@pdubroy pdubroy merged commit 5a6a3bd into main May 9, 2025
3 checks passed
@pdubroy pdubroy deleted the pdubroy/wasm branch May 9, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants