Skip to content

kstrohbeck/persimmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

persimmon

A Python parser combinator library.

Samples

from persimmon import string, none_of

comma = string(",")
elem = none_of(comma).many
line = elem.many_sep_by(comma)
eol = string("\n")
csv = (line + eol).many + eof

def main():
    content = """\
a,b,c

,hello world,
"""

    values = csv.parse(content)

    # values = [
    #     ['a', 'b', 'c'],
    #     [],
    #     ['', 'hello world', '']
    # ]

About

Idiomatic parser combinators, Python-style.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages