{"size": 2549, "ext": "scrbl", "max_stars_repo_path": "scribblings/typed-peg.scrbl", "max_stars_repo_name": "lives-group/typed-peg", "max_stars_repo_stars_event_min_datetime": "2022-03-29T22:04:54.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T22:04:54.000Z", "max_issues_repo_path": "scribblings/typed-peg.scrbl", "max_issues_repo_name": "lives-group/typed-peg", "max_issues_repo_issues_event_min_datetime": "2022-02-08T20:21:30.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-08T20:23:20.000Z", "max_forks_repo_path": "scribblings/typed-peg.scrbl", "max_forks_repo_name": "lives-group/typed-peg", "max_forks_repo_forks_event_min_datetime": "2022-02-15T01:55:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-15T01:55:05.000Z"}
{"max_stars_count": 1, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 43.2033898305, "max_line_length": 96, "alphanum_fraction": 0.7461749706}
#lang scribble/manual
@require[@for-label[typed-peg
                    racket/base]]

@title{typed-peg: A parsing library for parsing expression grammars}
@author{Elton Cardoso, Leonardo Reis, Rodrigo Ribeiro}

@defmodule[typed-peg]

@section{Introduction}

This package defines a racket language for parsing expression grammars that
creates a parse function for this grammar and it returns a parse tree for the input string.
The language also provide a type directed semantics for pretty printing them. 
The library also uses a type inference algorithm which determines if the PEG is complete,
i.e. terminates its execution on all inputs.

@section{Requirements}

In order to type check, the tool need a working installation of 
@hyperlink["https://github.com/Z3Prover/z3"]{Z3 SMT Solver}.
The project is known to work with
Z3 version 4.8.14.

@section{The language typed-peg}

Programs written in typed-peg language consist of a parsing expression grammar
close to Ford's original notations for PEGs. When imported, the module will provide
two functions:

@itemlist[#:style 'ordered
          @item{parse: this function takes an input string and returns a parse tree
                which corresponds to how the string was matched by the grammar.}
          @item{pretty: this functions takes a parse tree as input and returns its
                underlying string.}]

Parse trees for PEGs follow the structure of the parsing expressions, similarly for
regular expression parser trees.

@section{Limitations}

Currently, the library only supports the core syntax for parsing expressions. We intend
to implement other operators in future versions of the library.

@section{Languages}

Following the racket approach to build small languages, we have build some auxiliar languages 
to ease the task of use/debug the tool.

@itemlist[#:style 'ordered
          @item{peg: default language, provides a parse and pretty printing function for the
                specified PEG, after infering types for the input PEG.}
          @item{peg/untyped: disable the type-inference engine. Use at your own risk!}
          @item{peg/debug/tokenize-only: outputs the result of the lexical analyser.}
          @item{peg/debug/parse-only: outputs the result of the parser.}
          @item{peg/debug/constraints-only: outputs the constraints generated by the algorithm.}
          @item{peg/debug/z3-script-only: outputs the z3 script that encode the constraints.}
          @item{peg/debug/infer-only: outputs the infered types for each grammar non-terminal.}]
