home: hub: minipeg

Download patch

ref: 5dded2fc6505020ac79cdb8874554fa17be36324
parent: 769f2e54caa48939a167640c54f8bd33fa555a16
author: Andrew Chambers <ac@acha.ninja>
date: Thu Apr 7 21:41:05 CDT 2022

Work on examples.

--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# minipeg
+# Minipeg
 
 `minipeg` is a tool for generating recursive-descent parsers: programs that perform pattern matching on
 text. 
@@ -6,6 +6,15 @@
 Unlike `lex` and `yacc`, `minipeg` supports unlimited backtracking, provide ordered choice as a means for disambiguation, and can combine scanning (lexical analysis) and parsing (syntactic analysis) into a single activity.
 
 `minipeg` is also easy to embed in your C project by copying the amalgamated release (which has the permissive license MIT license).
+
+## Examples
+
+See some examples:
+
+- [word count](./examples/wc.peg)
+- [calculator](./examples/calc.peg)
+- [basic interpeter](./examples/basic.peg)
+- [x86_64 assembler](https://github.com/andrewchambers/minias/blob/cd21b90feaa9b66296b8614023349fae7d314b4b/asm.peg)
 
 ## History
 
--- a/examples/localpeg.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <stdio.h>
-
-#define YY_CTX_LOCAL
-
-#include "test.peg.c"
-
-int main()
-{
-  yycontext ctx;
-  memset(&ctx, 0, sizeof(yycontext));
-  while (yyparse(&ctx));
-  return 0;
-}
--- a/examples/localpeg.ref
+++ /dev/null
@@ -1,10 +1,0 @@
-a1 ab1 .
-a2 ac2 .
-a3 ad3 .
-a3 ae3 .
-a4 af4 afg4 .
-a4 af5 afh5 .
-a4 af4 afg4 .
-a4 af5 afh5 .
-af6 afi6 a6 .
-af6 af7 afj7 a6 .