Sign in

    simple_parserc

    Monadic parser combinators

    parser
    parser combinator
    Download zip
    Version
    0.2.1
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    433

    No dependencies

    #illusory0x0/simple_parserc

    #Primitive combinators

    • |
      • lor or
    • label

    #Monadic combinators

    • Monad
      • bind
      • pure
      • map

    • helper function
      • map_srcpos
      • discard_left
      • discard_right

    #Folding

    • foldl
    • foldl1
    • foldr
    • foldr1
    • many
    • many_each

    #Derivatives of primitive combinators

    • satisfy
    • char
    • one_of
    • none_of
    • string
    • eof

    #satisfy helpler function

    • digit
    • space
    • alphabetic
    • any
    • space1
    • spaces

    #Surrounding

    • between
    • round_bracket
    • square_bracket
    • curly_bracket

    #Reference

    List

    typealias
    T
    as List

    Input

    pub(all) struct Input {
    chars :
    StringView

    row : Int
    col : Int
    }

    impl Show for Input

    ParseError

    pub(all) enum ParseError {
    ParseError(SourcePos,
    T
    [String])
    }

    impl Show for ParseError

    ParseError::cons

    fn ParseError::cons(self : ParseError, x : String) -> ParseError

    ParseError::expect

    fn ParseError::expect(row~ : Int, col~ : Int, msg : String) -> ParseError

    ParseError::source_pos

    fn ParseError::source_pos(self : ParseError) -> SourcePos

    Parser

    pub(all) type Parser[A] (Input) -> (A, Input) raise ParseError

    impl BitOr for Parser[A]

    Parser::between

    fn[A, B, C] Parser::between(self : Parser[A], open~ : Parser[B], close~ : Parser[C]) -> Parser[A]

    Parser::bind

    fn[A, B] Parser::bind(x : Parser[A], f : (A) -> Parser[B]) -> Parser[B]

    Parser::char

    fn Parser::char(ch : Char) -> Parser[Char]

    Parser::curly_bracket

    fn[A] Parser::curly_bracket(self : Parser[A]) -> Parser[A]

    Parser::discard_left

    fn[A, B] Parser::discard_left(x : Parser[A], y : Parser[B]) -> Parser[B]

    Parser::discard_right

    fn[A, B] Parser::discard_right(x : Parser[A], y : Parser[B]) -> Parser[A]

    Parser::discard_spaces

    fn[A] Parser::discard_spaces(self : Parser[A]) -> Parser[A]

    Parser::eof

    fn[A] Parser::eof(x : A) -> Parser[A]

    Parser::foldl

    fn[A, B] Parser::foldl(x : Parser[A], z : Parser[B], f : Parser[(B, A) -> B]) -> Parser[B]

    Parser::foldl1

    fn[A] Parser::foldl1(x : Parser[A], f : Parser[(A, A) -> A]) -> Parser[A]

    Parser::foldr

    fn[A, B] Parser::foldr(x : Parser[A], z : Parser[B], f : Parser[(B, A) -> B]) -> Parser[B]

    Parser::foldr1

    fn[A] Parser::foldr1(x : Parser[A], f : Parser[(A, A) -> A]) -> Parser[A]

    Parser::inner

    fn[A] Parser::inner(self : Parser[A]) -> ((Input) -> (A, Input) raise ParseError)
    Convert newtype to its underlying type, automatically derived.

    Parser::label

    fn[A] Parser::label(x : Parser[A], msg : String) -> Parser[A]

    Parser::many

    fn[A] Parser::many(self : Parser[A]) -> Parser[Array[A]]

    Parser::many_each

    fn[A] Parser::many_each(x : Parser[A], f : (A) -> Unit) -> Parser[Unit]

    Parser::map

    fn[A, B] Parser::map(self : Parser[A], f : (A) -> B) -> Parser[B]

    Parser::map_srcpos

    fn[A, B] Parser::map_srcpos(self : Parser[A], f : (SourcePos, A) -> B) -> Parser[B]

    Parser::none_of

    fn Parser::none_of(xs : String) -> Parser[Char]

    Parser::one_of

    fn Parser::one_of(xs : String) -> Parser[Char]

    Parser::or

    fn[A] Parser::or(x : Parser[A], y : Parser[A]) -> Parser[A]

    Parser::pure

    fn[A] Parser::pure(x : A) -> Parser[A]

    Parser::round_bracket

    fn[A] Parser::round_bracket(self : Parser[A]) -> Parser[A]

    Parser::run

    fn[A] Parser::run(self : Parser[A], input : Input) -> A raise ParseError

    Parser::satisfy

    fn Parser::satisfy(f : (Char) -> Bool, label~ : String) -> Parser[Char]

    Parser::square_bracket

    fn[A] Parser::square_bracket(self : Parser[A]) -> Parser[A]

    Parser::string

    fn Parser::string(str : String) -> Parser[String]

    SourcePos

    pub(all) struct SourcePos {
    row : Int
    col : Int
    }

    impl Eq for SourcePos
    impl Show for SourcePos

    alphabetic

    let alphabetic : Parser[Char]

    any

    let any : Parser[Char]

    between

    fn[A, B, C] between(self : Parser[A], open~ : Parser[B], close~ : Parser[C]) -> Parser[A]

    bind

    fn[A, B] bind(x : Parser[A], f : (A) -> Parser[B]) -> Parser[B]

    char

    fn char(ch : Char) -> Parser[Char]

    curly_bracket

    fn[A] curly_bracket(self : Parser[A]) -> Parser[A]

    digit

    let digit : Parser[Char]

    discard_left

    fn[A, B] discard_left(x : Parser[A], y : Parser[B]) -> Parser[B]

    discard_right

    fn[A, B] discard_right(x : Parser[A], y : Parser[B]) -> Parser[A]

    discard_spaces

    fn[A] discard_spaces(self : Parser[A]) -> Parser[A]

    eof

    fn[A] eof(x : A) -> Parser[A]

    expect

    fn expect(row~ : Int, col~ : Int, msg : String) -> ParseError

    foldl

    fn[A, B] foldl(x : Parser[A], z : Parser[B], f : Parser[(B, A) -> B]) -> Parser[B]

    foldl1

    fn[A] foldl1(x : Parser[A], f : Parser[(A, A) -> A]) -> Parser[A]

    foldr

    fn[A, B] foldr(x : Parser[A], z : Parser[B], f : Parser[(B, A) -> B]) -> Parser[B]

    foldr1

    fn[A] foldr1(x : Parser[A], f : Parser[(A, A) -> A]) -> Parser[A]

    label

    fn[A] label(x : Parser[A], msg : String) -> Parser[A]

    many

    fn[A] many(self : Parser[A]) -> Parser[Array[A]]

    many_each

    fn[A] many_each(x : Parser[A], f : (A) -> Unit) -> Parser[Unit]

    map

    fn[A, B] map(self : Parser[A], f : (A) -> B) -> Parser[B]

    map_srcpos

    fn[A, B] map_srcpos(self : Parser[A], f : (SourcePos, A) -> B) -> Parser[B]

    none_of

    fn none_of(xs : String) -> Parser[Char]

    one_of

    fn one_of(xs : String) -> Parser[Char]

    fn[A] or(x : Parser[A], y : Parser[A]) -> Parser[A]

    pure

    fn[A] pure(x : A) -> Parser[A]

    round_bracket

    fn[A] round_bracket(self : Parser[A]) -> Parser[A]

    run

    fn[A] run(self : Parser[A], input : Input) -> A raise ParseError

    satisfy

    fn satisfy(f : (Char) -> Bool, label~ : String) -> Parser[Char]

    space

    let space : Parser[Char]

    space1

    let space1 : Parser[Char]

    spaces

    let spaces : Parser[Char]

    square_bracket

    fn[A] square_bracket(self : Parser[A]) -> Parser[A]

    string

    fn string(str : String) -> Parser[String]

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io