Skip to content

Compile time parser generator: ctpg

Hisayuki Mima edited this page Jan 19, 2014 · 5 revisions

ctpg is a typed parser generator library for D. Generated parser do Recursive Descent Parsing.

##Table of Contents

##Feature

  • You have to use PEG-like DSL to define a parser in ctpg.
  • You can generate a parser at compile time and cannot at runtime.
  • At runtime, A generated parser can memoize parsed result.
  • A generated parser can accept not only string, but also ForwardRange whose element type is character.
  • ctpg checks type of parsed result.

##Installation You can easily install ctpg using DUB. Add the following dependencies into your package.json.

{
    "name": "your_project",
    "dependencies": {
        "ctpg": "~master"
    }
}

##Documentation Tutorial: Basics

Tutorial: Simple Arithmetic Expression

Tutorial: JSON

DSL Reference