Skip to content

vladnosiv/parsecpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parsec for C++

I have worked with Parsec library in Haskell before, and I really liked laconic usage, so I tried to implement some of the functionality of parser combinators in C++.

Here is a small example. Below is code in Haskell that allows you to parse sequence of letters or numbers with any number of spaces in between. spaces in between, or empty is written instead of the sequence. With Haskell Parsec it can be done in the following way:

many (spaces >> alphaNum) <|> string "empty"

With the functionality I have implemented, the same thing can be written in C++ like this:

many(spaces() >> alphaNum()) | prefix_parser("empty")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published