This aims to be a pure-Janet implementation of Janet's peg/match
.
Apart from having fun, here are some reasons why this could be of some interest.
-
Clone this repository and cd to the relevant directory
-
Ensure
janet
andjpm
are on yourPATH
-
Install if you like:
jpm install
meg/match
is an attempt at implementing peg/match
, so for example,
if margaret
has already been installed:
(import margaret/meg)
(meg/match ~(capture (some "smile")) "smile!")
should work.
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 startingjanet
, or - use
(os/setenv "VERBOSE" "1")
in code
before 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 for more.
-
janet-pegdoc reuses examples from margaret to show sample invocations of
peg/match
as well as a source for generating quizzes. -
small-peg-tracer uses the emulation and tracing capabilities of margaret while generating views of simulated
peg/match
execution.
- The Specials lists what's currently implemented
- Tutorials of a sort
- Testing details
- Implementation Notes for the curious
- Credits to acknowledge help