A downloadable p.l. maker

Syntax! Grammar! Indie! Boom!

Build your own programming language in one project!

You can edit it's grammar, syntax, etc.


For example, let's start with a simple programming language:

Name: Aalia (Pretty similar, right?)

Tagline: Very simple, no libraries, etc.


Grammar:

Building upon the foundational `var` and `var const` declarations, this sequel introduces scoping, mutability control, and type inference for more robust and expressive code.

1. Block Scoping & Immutability with `let`

The `let` keyword declares a block-scoped, immutable constant. Its value must be assigned at declaration and cannot be changed, making intent clearer than `var const`.

```

// 'let' is immutable and scoped to the nearest { block }

let int TAU = 6.28318;

{

    let int PRECISION = 100; // PRECISION only exists within these braces

    // PRECISION is 100 here

}

// PRECISION is undefined here

```

2. Mutable Block Scoping with `mut`

The `mut` keyword declares a block-scoped, mutable variable. It is the block-scoped equivalent of `var`.

```

mut int counter = 0;

counter = counter + 1; // Allowed

{

    mut int temporary_value = 42; // Only exists in this block

}

// temporary_value is undefined here

```

3. Type Inference

The compiler can now infer the type of a variable from its initial value. Use the `_` (wildcard) symbol for the type.

```

// The compiler infers the type based on the assigned value.

var _ inferred_str = "Hello World"; // inferred_str is of type `string`

let _ inferred_pi = 3.14159;        // inferred_pi is of type `float`

mut _ count = 0;                    // count is inferred as `int`

```

4. Static Duration with `static`

The `static` keyword declares a variable with a lifetime for the entire program execution, while controlling its scope to the current block or file.

```

function calculate() {

    static mut int call_count = 0; // Persists between function calls but is only accessible within calculate()

    call_count = call_count + 1;

    return call_count;

}

// First call returns 1, second returns 2, etc.

```

"No one cares about the grammar, it's by DeepSeek."