Overview
fddl is a small programming language inspired by various languages, designed to help learn language implementation concepts in Rust.
For years, I’ve tried to learn various programming languages, and while I could master the basics, the real-world projects often eluded me. And I wouldn't know who to turn to even if I knew where to start.
fddl was born out of this journey. fddl is my attempt to combine the aspects I appreciate from many languages into something uniquely my own.
I started learning Rust and have really liked it. I've been following tutorials and the Crafting Interpreters site as guides for this very problematic programming language.
I like aspects of so many programming languages, but I don't really like any of them, so I always found it hard to pick one and stick with it. But I had the same problem playing World of Warcraft, too.
So I, like many of you, decided to make a hobby programming language to see what may be able to be done with it. This is a brand new project as of September 2024 and I am one person.
The fact that I have a REPL working in this language is nothing short of amazing to me. It's fucking magic.
Features
- Custom syntax fddl introduces unique operators and keywords to make programming more intuitive and fun (at least for me)
- Lexer currently is the only thing working. It tokenizes fddl scripts into understandable pieces of the language.
- Tilde Operator (
~
and~=
) when something almost equals something else. I had the idea from watching a video on Non-Euclidean Doom.
Getting Started
Keep in mind, this is only at the lexer stage currently. It'll read your inputs and that's it.
To clone the repo:
git clone https://git.fddl.dev/fddl/fddl.git
To run the REPL:
cargo run
To parse 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;
}
sym number = 5;
print(`The square of $number is ${math.square($number)}`);
At least for right now. I still want to do something odd.
Running the Project
Make sure your project compiles and the tests pass:
cargo build
cargo test
cargo run
Again, cargo run
only starts the REPL for testing.
Goals and Projections:
Note: This is not a final list; it's words on paper (metaphorically) at the time of writing.
Lexer
:
- Built and tested for basic syntax and operators.
- Supports single-line and documentation comments.
- Add support for more complex syntax and features.
Parser
:
- Currently a placeholder. Implement parsing for function calls, expressions, checks, literally everything.
Compiler
:
- Currently a placeholder. Implement the compiler to compile parsed code.
Comments:
- Added support for single-line and documentation comments.
- Implement multi-line comments.
- Implement document building comments.
Error Handling:
- Replace
stderr
with a more robust error handling mechanism..
Testing:
- Added initial
lexer
tests. - Expand tests to cover more syntax and edge cases.
License
This project is licensed under the MIT License.