Meta
A recursive-descent parser DSL that is a simpler alternative to parser generators. Described by Henry Baker: Pragmatic Parsing in Common Lisp; or, putting defmacro on steroids (ACM Lisp Pointers, vol. IV, no. 2, April--June 1991, pp. 3--15, DOI 10.1145/121983.121984). A few dozen lines of code in Common Lisp.

The scheme involves building a tiny language, called Meta, on top of Lisp. Whereas it does not handle all possible regular and context-free grammars, it can be used for a surprisingly large fraction of the grammars Lisp programmers encounter.

I think the family of grammars that Meta handles is usually called LL(1) as opposed to LL(k) which some other recursive descent parser generators support. -A. Kjeldaas. Actually the look-ahead limitation to one character is an artifact of using CL streams. The same technique and software can be used with sexprs and strings (and could be used with your own buffering streams if you dared) to provide unlimited look-ahead. -Fare Rideau I also believe that the languages Meta can parse can also be generated by Regular Tree Grammars: a formalism that under-pins xml schema languages like Relax-NG. -M. Swank

A simple practical package that uses Meta is Scribble, which you may take as an example.

meta source code is at: https://gitlab.common-lisp.net/frideau/meta

mel-base contains a modified version of cl-meta which uses sexprs instead of the reader. Huh? Baker's META works equally well on objects of type STREAM, STRING or LIST. cl-meta features access to these 3 via WITH-STRING-META, WITH-STREAM-META, WITH-LIST-META: lexical scoping is the solution, via MACROLET and/or LABELS. -Jörg Höhle Also, meta-sexp package is yet another META parser generator using s-expressions.


s-exp syntax