Hi,
I'm wondering, is there something like the PEG implementation of guile:
https://www.gnu.org/software/guile/docs ... rsing.html
That would allow to define templates and to define parsing rules for e.g. the wiki, without using regular expressions. Probably slower, but probably also easier to read.
thanks,
newland
PEG and template system?
-
- Posts: 608
- Joined: Mon Feb 05, 2007 1:04 am
- Location: Abbotsford, BC
- Contact:
Re: PEG and template system?
Interesting. Are PEG related to the Scheme Regular Expressions that the Scheme crowd created a few years ago as the superior alternative to regular expressions?
http://srfi.schemers.org/srfi-115/srfi- ... l#Abstract
Or the Structural Regular Expressions designed by Rob Pike?
http://doc.cat-v.org/bell_labs/structur ... xps/se.pdf
http://srfi.schemers.org/srfi-115/srfi- ... l#Abstract
Or the Structural Regular Expressions designed by Rob Pike?
http://doc.cat-v.org/bell_labs/structur ... xps/se.pdf
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
Re: PEG and template system?
Hi,
The scheme regex or Pike's system are not related to PEG's. A PEG is a top down parsing language, and you can use it to parse data or (small) command languages. A PEG often looks like a BNF , so making it quite easy to read and write. In contrast, simple regexes are easy to write and work fast, but complicated regexes are difficult to write and nearly impossible to decipher. Lua also has a quite nice PEG implementation.
https://en.wikipedia.org/wiki/Parsing_e ... on_grammar
https://en.wikipedia.org/wiki/Backus–Naur_Form
The scheme regex or Pike's system are not related to PEG's. A PEG is a top down parsing language, and you can use it to parse data or (small) command languages. A PEG often looks like a BNF , so making it quite easy to read and write. In contrast, simple regexes are easy to write and work fast, but complicated regexes are difficult to write and nearly impossible to decipher. Lua also has a quite nice PEG implementation.
https://en.wikipedia.org/wiki/Parsing_e ... on_grammar
https://en.wikipedia.org/wiki/Backus–Naur_Form
Re: PEG and template system?
Hi,
forgot to add this link: http://www.inf.puc-rio.br/~roberto/docs/ry10-01.pdf on how to write regex equivalent in PEG. That article gives some motivation why PEG's are sometimes easier.
forgot to add this link: http://www.inf.puc-rio.br/~roberto/docs/ry10-01.pdf on how to write regex equivalent in PEG. That article gives some motivation why PEG's are sometimes easier.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact: