Description

Stupid D parser combinator

Package Information

Version0.1.1 (2017-Mar-24)
Repositoryhttps://github.com/yshui/sdpc
LicenseMPL-2.0
CopyrightCopyright © 2015-2017, Yuxuan Shui
AuthorsYuxuan Shui
Registered byYuxuan Shui
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

sdpc

build statuscodecov

sdpc is a set of very simple, deterministic parser combinators. You can using these combinators to build deterministic parsers for unambiguous grammar without left-recursion.

Because of the determinism, each parser should return a single ParseResult, and indicate the next input position via modifing the input Stream variable.

Example

import sdpc;

@safe ParseResult!(string, void, ParseError!string) parse_parentheses(string i) {
	return many!(between!(token!"(", parse_parentheses, token!")"), true)(i);
}
void main() {
	auto i = "(())()(()())";
	assert(parse_parentheses(i).ok);
}

Available versions

0.1.1 0.1.0 ~master