Skip to content

ieeemma/atto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atto

Robust and extensible parser-combinators for Gleam.

fn number() {
  use digits <- do(atto.match("[1-9][0-9]*"))
  let assert Ok(n) = int.from_string(digits)
  n
}

fn number_list() {
  atto.between(
    atto.token("["),
    atto.sep(number, by: atto.token(",")),
    atto.token("]"),
  )
}

atto.run(number_list, text.new("[1,23,5]", Nil))
// -> Ok([1, 23, 5])

Features

  • Combinators for building parsers, such as many, sep, and between.
  • Beautiful error messages.
  • Custom stream type support, so atto works with a lexer step or on non-string data.
  • Custom context value for contextual grammars.

Resources

About

Robust and extensible parser combinators for Gleam

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages