Skip to content

aramiscd/gren-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gren-parse

A small library with all the basic building blocks to create combinatory parsers. It is much simpler than gren-lang/parser. Here is a parser for booleans:

import Parse

parseBool =
    Parse.oneOf
        [ Parse.string "false" |> Parse.map ( \ _ -> [ False ] )
        , Parse.string "true" |> Parse.map ( \ _ -> [ True ] )
        ]
> Parse.run parseBool "true"
Just True : Maybe Bool

> Parse.run parseBool "false"
Just False : Maybe Bool

> Parse.run parseBool "asdf"
Nothing : Maybe Bool

Package documentation: packages.gren-lang.org/package/aramiscd/gren-parse

See aramiscd/gren-json for a JSON parser based on this.

See https://vimeo.com/171704565 for an introduction to combinatory parsing.

About

Combinatory parsing in Gren

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages