R4d (Rad)
R4d is a text oriented macro prosessor made with rust.
NOTE
Is it stable?
I'm currently dog fooding for bug detections, and there might be some undetected bugs. However it doesn't mean that the syntax will change in the future without breaking release. (At least until 2.0)
The reason r4d is not yet in 1.0 is that I want to make sure that followings are solved.
- Absence of critical bugs
- No more basic macro behaviour(internal logic) changes
Therefore it is quite stable, in terms of non-breakable syntax(interface), but there will be bug fixes and non breaking changes.
Install
You can download binaries in release page
If your platform is not listed, mostly MacOS, directly install from cargo registry.
# Binary features is mandatory or else it is not an executable
# If you need color prompt, then use features "color"
Simple usage
Binary
# Read from file and print to stdout
rad input_file.txt
# Read from standard input and print to file
printf '...text...' | rad -o out_file.txt
Library
use RadError;
use Processor;
let processor = new
.purge
.greedy
.write_to_file?
.build;
processor.from_file;
processor.print_result;
Usage
Syntax
Built-in macros (or macro-like functions)
How to debug
Goal
R4d aims to be a modern alternative to m4 processor, which means
- No trivial m4 quotes for macro definition
- An explicit rule for macro definition and usage so that de facto underscore rule is not necessary
- Easier binding with other programming languages(Rust's c binding)
- Enable combination of file stream and stdout
- As expressive as current m4 macro processor