MCPcopy Create free account
hub / github.com/amber-lang/heraclitus

github.com/amber-lang/heraclitus @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
209 symbols 478 edges 34 files ⚖ GPL-3.0 82 documented · 39% ● updated 22d ago★ 361 open issues

Browse by type

⨍ Functions 172◇ Types & classes 37
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img src="https://github.com/amber-lang/heraclitus/raw/main/images/logo.png" width="150">

Heraclitus

[!WARNING] As of 22.09.2026 this repository will not be updated in crates.io due to the increased maintenance effort. This library will still be maintained and can be used from this repository.

Heraclitus is an open source compiler frontend written in rust. It's used as a basis for Amber programming language.

Heraclitus - the compiler frontend

With heraclitus you can create your language by skipping the cumbersome lexing step and using convenience parsing methods that can get you started on your language much quicker.

The main construct that you need is the Compiler. The compiler will tokenize your code and assemble it in a way that you can use to create AST by implementing predefined trait that helps you parse your code.

It's pretty simple. In order to get started you need 3 steps: 1. Create lexing rules 2. Create your ast nodes and let them implement trait provided by this package 3. Create compiler and tie all the components together

Voilá! 🎉

Now you got yourself a ready to analyze / interpret / validate / compile AST.

Ready to get started?

Example

use heraclitus_compiler::prelude::*;
Compiler::new("HerbScript", rules, "let a = 12");

It is recommended to use included prelude to import just the things we will actually need.

The Compiler requires lexer rules and the source code in order to exist.

let cc = Compiler::new("HerbScript", rules, "let a = 12");
let tokens = cc.tokenize()?;
let mut meta = DefaultMetadata::new(tokens, cc.code.clone());

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 128
Function 44
Class 23
Enum 12
Interface 2

Languages

Rust100%

Modules by API surface

src/compiling/failing/message.rs20 symbols
src/compiling/lexing/lexer.rs19 symbols
src/compiling/failing/position_info.rs18 symbols
src/compiling/failing/logger.rs17 symbols
src/compiling/lexing/reader.rs15 symbols
src/compiling/parser/metadata.rs14 symbols
src/compiling/lexing/region_handler.rs12 symbols
src/compiling/compiler.rs12 symbols
src/compiling/parser/syntax_module.rs10 symbols
tests/arith_modules/expr.rs8 symbols
src/compiling_rules/region.rs7 symbols
src/compiling/parser/preset.rs7 symbols

For agents

$ claude mcp add heraclitus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page