mpc is a lightweight Parser Combinator library for C.
- Full Type Generic Parser Combinator
- Error Message Support
- Regular Expression Support
- Packaged with AST generator
- Easy to including in source
- Written in clean ANSI C
The current main alternative is a branch of (https://github.com/wbhart/Cesium3)[Cesium3].
The main advantages of mpc over this are:
- Works for Generic Types
- Doesn't rely on Boehm-Demers-Weiser Garbage Collection
- Doesn't use
setjmp
andlongjmp
for errors - Doesn't pollute namespace
If you want to do all the data processing after the parsing stage mpc comes packaged with a basic AST type which makes the grammar declaration much cleaner as you don't have to pass around destructors and fold functions. All these functions reside under mpca_*
.
This also allows for the use of parser grammars that can be declared directly in C strings similarly to regular expressions.