Skip to content

A web-based debugger for pest using Yew

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

tomtau/pest-web-debug

Repository files navigation

pest web debugger

Image of debugger

This is a simple web-based debugger for the pest parser generator using Yew.

Known limitations

Besides the limitations of pest_debugger, it is not possible to change the breakpoints while the parser is running. This is because the parser is not paused when hitting a breakpoint, but it just collects the encountered breakpoints until the end of the parsing. Some problematic grammars could, thus, potentially exhaust the memory in this naive web-based debugger.

In detail

At this moment, pest_debugger works in a bit hacky way by spawning a new OS thread for the parsing process. This thread is then paused when hitting a breakpoint. The thread is resumed when the user instructs to continue in the debugger interface.

This way proved to be challenging in the browser setting:

  1. Spawning a new thread (std::thread::spawn) will panic / is not supported in wasm32-unknown-unknown.
  2. The wasm-bindgen's or yew-agent's equivalents, such as spawn_local or WorkerLink, did not seem to play well with the pest_vm's listener function interface that requires Sync + Send + RefUnwindSafe + UnwindSafe trait bounds which are not implemented when using wasm-bindgen's or yew-agent's equivalents (due to their thread-unsafe internals).

Build instructions

Prerequisites

rustup target add wasm32-unknown-unknown
cargo install trunk wasm-bindgen-cli

Running

trunk serve

Release

trunk build --release

About

A web-based debugger for pest using Yew

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published