Install

Download

Below is the list of the latest (stable) tarballs for each branch. You can find other releases here (but be aware that they are hidden for a good reason: most of them contain bugs that have been fixed in the next minor release).

Source files are on github:

$ git clone https://github.com/skvadrik/re2c.git re2c

There’s also a mirror on sourceforge (should be in sync with github):

$ git clone https://git.code.sf.net/p/re2c/code-git re2c

Many distributions and systems provide their own packages: Alt, Apple Mac OS X, Arch, Debian, Gentoo, Fedora, FreeBSD, Mageia, Mandriva, NetBSD, OpenSuSE, RedHat, Slackware, Ubuntu.

Build

The only required build-time dependency for re2c is a C++98 compiler. Optional build-time dependencies are the following: autotools (to build re2c from source, not from distribution tarball), bison (to rebuild re2c parser) and rst2man (to rebuild documentation).

If you are building re2c from source, first of all you should run autoconf and automake:

$ ./autogen.sh

The simplest possible build is an in-tree build. The following instructions will install re2c (binary and manpage) to _p_r_e_f_i_x_ (by default /usr/local):

$ ./configure --prefix=_p_r_e_f_i_x_
$ make
$ make install

Since re2c is a self-hosting lexer generator (some parts of re2c are written in re2c), it needs to be bootstrapped. Bootstrapping files are packaged into the re2c distribution, so that re2c can be built on a system without re2c. The following instructions bootstrap re2c from scratch and update precompiled files:

$ make bootstrap

re2c supports out-of-tree builds:

$ mkdir builddir && cd builddir
$ ../configure
$ make
$ make install

If you intend to use re2c on Windows, you can either use cygwin or build re2c with mingw (mingw builds are supported and tested regularly).

$ ./configure --host i686-w64-mingw32
$ make
$ make install

To rebuild re2c documentation:

$ ./configure --enable-docs
$ make docs

Test

re2c has a main test suite and a couple of small tests. Run them all:

$ make check

Or run only the main test suite (and watch progress dumped to stdout):

$ make tests

Run the test suite under valgrind (takes a long time):

$ make vtests

Test mingw builds with wine:

$ make wtests

Check the distribution:

$ make distcheck