Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sogaiu/margaret
A Janet implementation of Janet’s peg/match
https://github.com/sogaiu/margaret
debug janet peg trace
Last synced: 6 days ago
JSON representation
A Janet implementation of Janet’s peg/match
- Host: GitHub
- URL: https://github.com/sogaiu/margaret
- Owner: sogaiu
- Created: 2021-10-12T04:34:47.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T06:59:54.000Z (7 days ago)
- Last Synced: 2024-12-27T07:30:42.777Z (7 days ago)
- Topics: debug, janet, peg, trace
- Language: Janet
- Homepage:
- Size: 383 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Support: support/path.janet
Awesome Lists containing this project
README
# Margaret - Janet's peg/match in Janet
This aims to be a pure-Janet implementation of Janet's `peg/match`.
Apart from having fun, here are some reasons [why](doc/why.md) this
could be of some interest.## Setup
* Clone this repository and cd to the relevant directory
* Ensure `janet` and `jpm` are on your `PATH`
* Install if you like: `jpm install`
## Usage
### Basic Use
`meg/match` is an attempt at implementing `peg/match`, so for example,
if `margaret` has already been installed:```janet
(import margaret/meg)(meg/match ~(capture (some "smile")) "smile!")
```should work.
### Tracing
There is some primitive support for tracing. It can be enabled by
setting the `VERBOSE` environment variable to a non-empty string.Either:
* set the `VERBOSE` env var (say to "1") before starting `janet`, or
* use `(os/setenv "VERBOSE" "1")` in codebefore calling `meg/match`.
Output format is very much in-flux but ATM one can see:
* capture stack
* tags
* specials execution order...and other details.
See [here](doc/tracing.md) for more.
## Other Docs
* [The Specials](doc/the-specials.md) lists what's currently implemented
* [Tutorials](doc/tutorials.md) of a sort
* [Testing](doc/testing.md) details
* [Implementation Notes](doc/implementation-notes.md) for the curious
* [Credits](doc/credits.md) to acknowledge help