Uses new Rust 2021
|new 1.5.5||Dec 3, 2022|
|1.5.4||Oct 19, 2022|
|1.5.2||Sep 28, 2022|
|1.3.2||Aug 28, 2022|
|0.1.0||Jul 20, 2022|
#204 in Development tools
33 downloads per month
Heraclitus is an open source compiler frontend written in rust. It's going to be used as a basis for programming languages such as Amber and Flame.
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:
- Create lexing rules
- Create your ast nodes and let them implement trait provided by this package
- Create compiler and tie all the components together
Now you got yourself a ready to analyze / interpret / validate / compile AST.
Ready to get started?
use heraclitus::prelude::*; Compiler::new("HerbScript", rules);
It is recommended to use included prelude to import just the things we will actually need.
Compiler requires lexer rules in order to exist.
let cc = Compiler::new("HerbScript", rules); let tokens = cc.tokenize()?;
Change log 🚀
- Show elapsed time in parser debug mode
- Offset now supports negative values
- Token now derives Default trait
- Message now does not consumes itself when it's being displayed
info*macros as we don't see any reason to use them at this point
- Breaking change: All new Failing API
- Syntax Result now returns Failing enum
- Errors are now encouraged to be propagated back to the root of the AST.
contextmacro to support better developer experience
- Terminal colors (support for non-truecolor consoles)
- Logger now prints errors to STDERR
- Multiline regions wouldn't parse
- Added support for UTF symbols
- Critical bug with non-tokenizable regions being tokenized
- Changed Logger API that improves adding code snippets
Logger::new_erris now called
Logger::new_warnis now called
Logger::new_infois now called
- Bad token highlighting in Logger when showing a code snippet
- Major bug with a tokenised interpolation being parsed in a wrong way.
- Intensively used code is now inlined at compile time
ErrorDetails::from_token_option(...)can now be used to create errors at location of given token
- Added compounds
- Logger can now display messages not related to code
- New method for retrieving current token
- New debug functionality
- Changed string reference of all function parameters to