Awesome
pest web 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:
- Spawning a new thread (
std::thread::spawn
) will panic / is not supported inwasm32-unknown-unknown
. - The wasm-bindgen's or yew-agent's equivalents, such as
spawn_local
orWorkerLink
, did not seem to play well with the pest_vm's listener function interface that requiresSync + 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