A Pygments lexer for GAP
In case you haven't heard of one of the most awesome LaTeX packages ever, let me introduce to you: minted. It's a package to create listings (code snippets, preferably with highlighting, line numbering etc.), but it goes much further than the more well-known package listings. A small example:
Its awesomeness comes at a cost though, it relies heavily on an external Python program called Pygments. This is a generic tool for highlighting, regardless of output format. It can produce TeX, HTML, images, .... And it comes equipped with a load of supported languages. And if you've read the title you might guess what this post is about: a language that wasn't supported yet.
For a course in computational group theory I have to write a report about an implementation in GAP, and this is absolutely impossible without the best possible syntax highlighting, right? So I have entertained myself with implementing a GAP lexer. Its implementation is available at github.com/pbelmans/gap-pygments-lexer.
I have supplied an automatic installer, as the README suggests it boils down to
git clone git://github.com/pbelmans/gap-pygments-lexer.gitor download and extract the archive GitHub automatically creates at the project's Downloads page
sudo python setup.py install
I would like to thank Wim Thys for providing me with the names of all the built-in classes and functions, using a bit of
If you feel inspired, there are several other languages that need an implementation:
- Magma (but they are be working on it themselves apparently)
- PARI/GP (this one has the most intriguing syntax of all)