a gemtext parser in common lisp
Go to file
Eric S. Londres 54017d1fc5
continuous-integration/drone/push Build is passing Details
fail build if compilation did not produce a binary
2023-03-30 21:58:22 -04:00
src functional entry point 2023-03-30 21:42:11 -04:00
.drone.yml fail build if compilation did not produce a binary 2023-03-30 21:58:22 -04:00
.gitignore add gitignore file 2023-03-28 19:35:23 -04:00
LICENSE.md renamed 2023-03-28 22:22:28 -04:00
Makefile update 2023-03-28 19:34:46 -04:00
README.md more details 2023-03-28 22:34:38 -04:00
design.org successfull parse to typed list 2023-03-28 22:13:02 -04:00
white-tiger.asd remove listed dependency 2023-03-30 21:56:24 -04:00

README.md

white-tiger

white-tiger is a gemtext parser written in Common Lisp.

It has no dependencies except for a Common Lisp implementation and the ASDF build system.

The makefile includes some sbcl-based scripts for loading an interpreter with the package loaded or compiling a native binary.

Try make load, then enter (white-tiger:start "file-name.gmi") or make then ./white-tiger file-name.gmi.

License

white-tiger is licensed under the GNU Affero General Public License, version 3.0.

Details

white-tiger contains a gemtext parser in about 50 lines of lisp. The parser is backend-agnostic and produces an abstract syntax list which can be used generically to construct emitters for various other formats.

Building an emitter is extremely easy. If your target format has determinisitc relationship between gemtext line type and output formatting then an emitter is probably an 8-line map function. A spec-compliant HTML emitter is 10 lines, because HTML has mandatory top-of-document and bottom-of-document content.

Critically, computation of which lines of the source file are in "preformat mode" and which are not happens in the parse step; this information is included in each node of the abstract syntax list, which means a backend emitter can be purely context-free in its output of each node. The parser only iterates through the file contents once, but because the ASL has no shared state between nodes an emitter could theoretically run in parallel with an arity of the line count and thus complete in O(1) time (with arity = n).

See the "design" file for more details on the implementation, including the type format for nodes and the list production.

Why the name?

I was scrolling through the gemini wikipedia article for inspiration and this phrase popped up.