• Stars
    star
    165
  • Rank 222,736 (Top 5 %)
  • Language
    OCaml
  • License
    ISC License
  • Created about 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Typed Regular Expressions

Tyre Build Status docs

Tyre is a set of combinators to build type-safe regular expressions, allowing automatic extraction and modification of matched groups.

Tyre is bi-directional: a typed regular expressions can be used for parsing and unparsing. It also allows routing, by providing a list of regexs/routes and their handlers.

Tyre is pure OCaml and uses re. To install it:

opam install tyre

Documentation is available here. See also the examples/ directory. A primitive HTTP parser can be found in the benchmark/ directory.

# let dim = Tyre.( str"dim:" *> int <&> str"x" *> int ) ;;
val dim : (int * int) Tyre.t

# let dim_re = Tyre.compile dim ;;
val dim_re : (int * int) Tyre.re

# Tyre.exec dim_re "dim:3x4" ;;
- : (int * int, (int * int) Tyre.error) result = Result.Ok (3, 4)

# Tyre.eval dim (2, 5) ;;
- : string = "dim:2x5"

Benchmark

Some benchmarks are available under the benchmark/ directory. The benchmark compares the parsing of HTTP requests using angstrom and various tyre methods. You can run them with:

./benchmark/data/replicate benchmark/data/http-requests.txt 100
jbuilder exec benchmark/benchmark_angstrom.exe -- -a

More Repositories

1

furl

Formatted url
OCaml
49
star
2

ocaml-lmdb

Ocaml bindings for lmdb.
OCaml
47
star
3

bytepdf

A tool to create PDFs that are also OCaml bytecodes
OCaml
41
star
4

tree_layout

Algorithms to layout trees in a pretty manner.
OCaml
37
star
5

dowsing

αš› A type of divination employed in attempts to locate identifiers matching a given type expression
OCaml
35
star
6

modulectomy

Dissect OCaml compiled programs, and weight their content
OCaml
26
star
7

LILiS

L-system interpreter in OCaml
OCaml
23
star
8

pumping

Regular languages in types
OCaml
21
star
9

llvmgraph

Ocamlgraph overlay for llvm
OCaml
20
star
10

functoria-lua

Building Lua interpreters with lot's of functors
OCaml
14
star
11

fugit

A small CLI to launch notifications at a given time
OCaml
14
star
12

pl-experiments

JavaScript
11
star
13

zarith-ppx

Literals for Zarith's arbitrary-precision integers and rationals
OCaml
11
star
14

adtr

OCaml
9
star
15

peahell

L'enfer des pois
OCaml
8
star
16

No

No.
OCaml
8
star
17

polyocamlbyte

A pdf file which is an ocaml bytecode which is a png of the logo of OCaml.
TeX
6
star
18

functoria-lwt

A minimal example of a functoria-based eDSL for lwt-based applications.
OCaml
6
star
19

oct

WIP Experiments with value printers for fancier toplevels.
OCaml
5
star
20

opam-dot

A simple command to show the graph of dependencies of a package.
OCaml
4
star
21

regular_bazar

OCaml
4
star
22

cap-lab22

Student git for 2022-23 (CAP, ENS de Lyon, France)
Python
4
star
23

evePI

A small project about planetary interaction in Eve Online and an excuse to code in Eliom
OCaml
4
star
24

oasis_format

A standalone parser for the oasis format
OCaml
3
star
25

LILiS.jsoo

Js_of_ocaml interface for LILiS
OCaml
3
star
26

stellaris_tools

Collection of tools for stellaris
OCaml
3
star
27

empty

The empty (OCaml) project
OCaml
3
star
28

cap-labs21

Student git for 2021-22 (CAP, ENS de Lyon, France)
Python
2
star
29

module-experiments

TeX
2
star
30

eveliom

An Eliom library for Eve Online
OCaml
2
star
31

stellaris_academia

Stellaris mod to add a bit of flavor and customization to research and scientists.
AMPL
1
star
32

paradox.el

Emacs mode to edit paradox mod files
Emacs Lisp
1
star