Title: | Parsing Expression Grammars in Rcpp |
---|---|
Description: | A wrapper around the 'Parsing Expression Grammar Template Library', a C++11 library for generating Parsing Expression Grammars, that makes it accessible within Rcpp. With this, developers can implement their own grammars and easily expose them in R packages. |
Authors: | Os Keyes [aut, cre], Duncan Garmonsway [ctb], Colin Hirsch [cph], Daniel Frey [cph] |
Maintainer: | Os Keyes <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-03-12 03:28:15 UTC |
Source: | https://github.com/ironholds/piton |
an example of a Parsing Expression Grammar (PEG) that takes a comma-separated string of digits and sums them together
peg_sum(x)
peg_sum(x)
x |
a vector of strings, each containing a comma-separated set of digits |
a vector of numbers, containing either the sum of
the equivalent element of x
or (if the element
could not be parsed) NA
.
# Simple example peg_sum("1,2, 5, 91, 34")
# Simple example peg_sum("1,2, 5, 91, 34")
This package wraps the PEGTL library to make Parsing Expression Grammars
available to R/C++ developers. As an exported, header-only package, it can be included
in other Rcpp codebases using depends
functionality, and is platform-independent.
the README,
or peg_sum
for an example.