lib: Split-off regular grammar parser

in preparation for ANTLR-based valiadators, #9
2 jobs for master in 19 seconds (queued for 12 seconds)