Overview
fddl is a small, experimental programming language, built in Rust, designed to explore language implementation concepts. It's a blend of ideas from various languages but remains unique, with its own syntax and quirks.
For years, I’ve tried to learn various programming languages, and while I could master the basics, the real-world projects often eluded me. Rust, however, clicked for me, and fddl was born out of this journey.
I like aspects of many programming languages, but I didn’t fully enjoy any of them, which made it difficult to commit to one. So, like many others, I decided to create my own hobby programming language.
Features
- Custom syntax with unique operators and keywords
- Documentation comments using
#
, similar to Rust's style - Lexer and parser built from scratch
Getting Started
To clone the repo:
git clone https://git.fddl.dev/fddl/fddl.git
To run the REPL:
cargo run
To run a fddl script:
cargo run path/to/script.fddl
Examples
Your basic "hello, world":
func main() {
print(`hello, world in fddl`);
}
Defining a function inside a module, squaring a number:
##! This is a sample module
module math {
### Computes the square of a number
func square(x) => x ^ 2;
}
define $number := 5;
print(`The square of $number is ${math.square($number)}`);
(At least for now.)
Notes and Next Steps
- Added first new set of tokens and features, added the first
lexer
tests. -
parser
module is a placeholder. -
interpreter
module is a placeholder. - Implement a more robust error handling mechanism instead of using
stderr
. - Implement string interpolation (backticks with
$variable
). - Continue to expand tests to cover all new syntax and features.
- Made a basic website.
Running the Project
Make sure your project compiles and the tests pass:
cargo build
cargo test