|
FE 0.10.0
Header-only C++ frontend library
|
FE is a header-only C++23 toolkit for building handwritten compiler and interpreter frontends.
Rather than generating lexers or parsers for you, FE focuses on the infrastructure that every frontend needs anyway: source locations, diagnostics, interning, parsing support, and efficient memory management. The goal is simple: keep handwritten frontends lightweight, explicit, and pleasant to maintain.
FE is a good fit if you want to build:
It is especially useful when you want the flexibility of handwritten code without repeatedly rebuilding the same frontend infrastructure from scratch.
Handwritten frontends are often the right choice when you want full control over syntax, diagnostics, recovery, and architecture. FE embraces that style.
It provides a compact set of reusable, well-integrated components:
FE does not try to hide frontend construction behind a generator. Instead, it gives you sharp, reusable tools so you can build exactly the frontend you want.
For a complete end-to-end example, see Let, a small toy language built on FE.
The easiest way to get going is through Let.
You can either:
That gives you a concrete, working example of how FE is intended to be used in practice.
Add FE as a subdirectory and link the fe interface target:
If you want Abseil-backed hash containers, enable FE_ABSL before adding the subdirectory:
Because FE is header-only, you can also vendor include/fe/ directly into your project.
If you want Abseil support in that setup, compile with:
A typical FE-based frontend looks roughly like this:
If you want a concrete model to copy from, start with tests/lexer.cpp.
To configure, build, and run the test suite:
To run one discovered test:
To run a doctest case directly:
To build the documentation:
This requires Doxygen and Graphviz (dot).
A few projects that use or reflect the same frontend philosophy:
Issues and pull requests are welcome - whether that's a bug report, a new frontend building block, or a documentation fix. If you're unsure where to start, open an issue to discuss the idea first.
FE is licensed under the MIT License.