Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomtau/pest-web-debug
A web-based debugger for pest using Yew
https://github.com/tomtau/pest-web-debug
Last synced: 25 days ago
JSON representation
A web-based debugger for pest using Yew
- Host: GitHub
- URL: https://github.com/tomtau/pest-web-debug
- Owner: tomtau
- License: apache-2.0
- Created: 2023-04-22T11:50:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-23T06:25:41.000Z (over 1 year ago)
- Last Synced: 2024-02-12T04:36:51.729Z (10 months ago)
- Language: Rust
- Size: 1.01 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-pest - pest web debugger - Try it [online](https://tomtau.github.io/pest-web-debug/). (Tooling / IDE Support)
README
# pest web debugger
![Image of debugger](screenshot.png)
This is a simple web-based debugger for the [pest](https://pest.rs/) parser generator using Yew.
## Known limitations
Besides the limitations of [pest_debugger](https://docs.rs/pest_debugger/latest/pest_debugger/#current-limitations), 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](https://docs.rs/pest_debugger/latest/pest_debugger/#current-limitations) 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](https://docs.rs/pest_vm/latest/pest_vm/struct.Vm.html#method.new_with_listener) 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
```bash
rustup target add wasm32-unknown-unknown
cargo install trunk wasm-bindgen-cli
```### Running
```bash
trunk serve
```### Release
```bash
trunk build --release
```