b02c6ffdfe9d244e06ec6a4b4cbc6a43f79a0d85
Micro Parser Combinators
mpc is a lightweight Parser Combinator library for C.
Features
- 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
Alternatives
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
Example
Parsers
Combinators
Regular Expressions
Combinator Grammars
Abstract Syntax Tree
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.
Reference
Description
Languages
C
98.4%
Makefile
1.6%