Tralalero_lang is a small, interpreted programming language designed for simplicity and a touch of whimsy. It's built with Rust and aims to provide a straightforward environment for learning basic programming concepts, experimenting with language design, or simply having fun. The language uses a unique set of keywords inspired by playful Italian phrases, making the coding experience a bit more lighthearted.
This will compile the `main.rs` file and create an executable in the `target/debug/` directory (e.g., `target/debug/Tralalero_lang.exe` on Windows, or `target/debug/Tralalero_lang` on Linux/macOS).
Basic arithmetic operations (`+`, `-`, `*`, `/`) can be performed within `let` statements. The current implementation supports simple binary operations (operand operator operand).
Unire Corde final_greeting greeting_part "morning"; // final_greeting will be "Goodmorning"
```
**Note:** Due to current parsing limitations, avoid spaces within string literals when directly used with `Unire Corde`. It's recommended to assign strings with spaces to variables first, then use the variables for concatenation.
### Conditional Statements
Conditional logic is implemented using `Tung Tung Tung` (if) and `Ballerina Cappuccina` (else). Supported comparison operators are `==`, `!=`, `>`, `<`, `>=`, `<=`.
Functions are defined using `Lirili Larila` and called using `Trippi Troppi`. Functions can take arguments.
```tralla
Lirili Larila greet (name)
{
Matteeeo "Hello, ";
Matteeeo name;
}
Trippi Troppi greet("Alice"); // Calls the greet function with "Alice"
```
### Known Limitations
***Function Return Values:** Functions currently execute their body but do not return values that can be captured or used in the calling scope. Any `return` statements within a function are not processed to pass a value back.
***Complex Expressions:** The `let` keyword's arithmetic parsing is limited to simple `operand operator operand` structures. More complex mathematical expressions (e.g., `(a + b) * c`) are not supported.
***String Literals with Spaces in `Unire Corde`:** Directly using string literals containing spaces with `Unire Corde` can lead to parsing issues. Assign such strings to variables first.
## Examples
The `examples/` directory contains several `.tralla` files demonstrating various language features:
*`calculator.tralla`: Basic arithmetic operations and variable usage.
*`fibonacci.tralla`: Demonstrates loops and function calls (note the return value limitation).