Description

Stupid D parser combinator

Package Information

Version0.1.0 (2017-Mar-22)
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

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;

ParseResult!void parse_parentheses(Stream i) {
	return many!(between!(token!"(", parse_parentheses, token!")"), true)(i);
}
void main() {
	auto i = new BufStream("(())()(()())");
	assert(parse_parentheses(i).ok);
	assert(i.eof());
}

Available versions

0.1.0 0.0.7 0.0.6 0.0.5 0.0.4 0.0.3 0.0.2 0.0.1 ~master ~stream ~next