All Projects → Marwes → Combine Language

Marwes / Combine Language

A crate which defines parsers for common programming language constructs using https://github.com/Marwes/combine

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Combine Language

Scala Parser Combinators
simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module
Stars: ✭ 523 (+636.62%)
Mutual labels:  parser-combinators
Comby
A tool for structural code search and replace that supports ~every language.
Stars: ✭ 912 (+1184.51%)
Mutual labels:  parser-combinators
Feel Scala
FEEL parser and interpreter written in Scala
Stars: ✭ 52 (-26.76%)
Mutual labels:  parser-combinators
Nom
Rust parser combinator framework
Stars: ✭ 5,987 (+8332.39%)
Mutual labels:  parser-combinators
Parsec.js
A JavaScript parser combinator library inspired by Parsec of Haskell.
Stars: ✭ 12 (-83.1%)
Mutual labels:  parser-combinators
Mini Haskell
A self-hosting mini Haskell compiler with a mini C runtime.
Stars: ✭ 37 (-47.89%)
Mutual labels:  parser-combinators
Angstrom
Parser combinators built for speed and memory efficiency
Stars: ✭ 434 (+511.27%)
Mutual labels:  parser-combinators
Parser Combinators From Scratch
Code that accompanies the series
Stars: ✭ 56 (-21.13%)
Mutual labels:  parser-combinators
Parsel
Create complex parsers by combining simple ones with Parsel!
Stars: ✭ 21 (-70.42%)
Mutual labels:  parser-combinators
Pyparsing
Python library for creating PEG parsers
Stars: ✭ 1,052 (+1381.69%)
Mutual labels:  parser-combinators
Combo
A simple parser combinator library for Ocaml
Stars: ✭ 19 (-73.24%)
Mutual labels:  parser-combinators
Combine
A parser combinator library for Rust
Stars: ✭ 906 (+1176.06%)
Mutual labels:  parser-combinators
Parseque
Total Parser Combinators in Coq
Stars: ✭ 37 (-47.89%)
Mutual labels:  parser-combinators
Yay
Yay is a high level PHP preprocessor
Stars: ✭ 553 (+678.87%)
Mutual labels:  parser-combinators
Funcj
Assorted functional-oriented data structures and algorithms for Java.
Stars: ✭ 60 (-15.49%)
Mutual labels:  parser-combinators
Pidgin
C#'s fastest parser combinator library
Stars: ✭ 469 (+560.56%)
Mutual labels:  parser-combinators
Parsley
An exceptionally fast parser combinator library for Scala
Stars: ✭ 31 (-56.34%)
Mutual labels:  parser-combinators
Myna Parser
Myna Parsing Library
Stars: ✭ 69 (-2.82%)
Mutual labels:  parser-combinators
Footlessparser
A simple parser combinator written in Swift
Stars: ✭ 60 (-15.49%)
Mutual labels:  parser-combinators
Lug
Parsing expression grammar (PEG) embedded domain specific language and parsing machine for C++17
Stars: ✭ 44 (-38.03%)
Mutual labels:  parser-combinators

combine-language

Build Status Docs v2 Docs Gitter

This a crate providing an easy way of constructing parsers which can easily parse various programming languages. It has much of the same API as Text.Parsec.Token but are otherwise a bit different to fit in to the ownership model of rust. The crate is an extension of the combine crate.

Example

extern crate combine;
extern crate combine_language;
use combine::{satisfy, EasyParser, Parser};
use combine::parser::char::{alpha_num, letter, string};
use combine_language::{Identifier, LanguageEnv, LanguageDef};
fn main() {
    let env = LanguageEnv::new(LanguageDef {
        ident: Identifier {
            start: letter(),
            rest: alpha_num(),
            reserved: ["if", "then", "else", "let", "in", "type"].iter()
                                                                 .map(|x| (*x).into())
                                                                 .collect(),
        },
        op: Identifier {
            start: satisfy(|c| "+-*/".chars().any(|x| x == c)),
            rest: satisfy(|c| "+-*/".chars().any(|x| x == c)),
            reserved: ["+", "-", "*", "/"].iter().map(|x| (*x).into()).collect()
        },
        comment_start: string("/*").map(|_| ()),
        comment_end: string("*/").map(|_| ()),
        comment_line: string("//").map(|_| ()),
    });
    let id = env.identifier();//An identifier parser
    let integer = env.integer();//An integer parser
    let result = (id, integer).easy_parse("this /* Skips comments */ 42");
    assert_eq!(result, Ok(((String::from("this"), 42), "")));
}

Links

combine

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].