Skip to content

A Janet implementation of Janet’s peg/match

Notifications You must be signed in to change notification settings

sogaiu/margaret

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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:

(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 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.

Other Docs

About

A Janet implementation of Janet’s peg/match

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages