Parsing lists with Lemon

Posted on 2014-04-08 00:00:00 +0800

I was parsing some lists of, erm, labels today in Lemon (with Ragel as the lexer), and couldn’t quickly (read lazily) find a grammar for parsing lists, so voila;

with the pseudocode replaced with code appropriate for your host language, and with list being the uppermost rule, and with COMMA being whatever delimiter you desire :)

Enjoy!