Source

🌟 Features


🏗 Project Structure

/ thyddle
├── interpreter.py    # Core interpreter
├── parser.py         # Syntax parser
├── lib/              # Standard and extra libraries
├── examples/         # Sample programs
└── README.md         # This document

✏️ Basic Syntax

Variables

var name = "John";
const age = 25;

Functions

func greet(name) {
    console.output.println("Hello, " + name);
}

greet("Alice");

Anonymous functions:

var greet = (name) -> {
    console.output.println("Hi, " + name);
};

Arrays

var numbers = [1, 2, 3, 4, 5];
console.output.println(numbers[0]);  // prints 1

Objects

var person = {
    name: "John",
    age: 30,
    greet: (other) -> {
        console.output.println("Hey, " + other.name + "!");
    }
};

person.greet({ name: "Alice" });

Control Flow

if (age > 18) {
    console.output.println("Adult");
} elseif (age == 18) {
    console.output.println("Just became an adult");
} else {
    console.output.println("<18");
}

while (condition) {
    // code
}

for (var i = 0; i < 10; i = i + 1;) {
    console.output.println(i);
}

📦 Importing Libraries

import "lib/standard";

println("Hello, world!");  // thanks to lib/standard

Standard Library Highlights:

File IO Library:

Math Library (built-in, complete):


🔨 Built-in Functions

Function Description
len(x) Length of string, object, or array
type(x) Returns the type of x
tonum(x) Converts to number
tostr(x) Converts to string
eval(code) Runs Thyddle code
pyth(code) Runs Python code
reverse(x) Reverses array or object
ord(char) Gets Unicode code of character
chr(code) Gets character from Unicode code
array.append(arr, item) Appends item to array
array.pop(arr) Pops last item from array
split(string, sep) Splits string by separator (use string.split for per-character splitting)


Tags: language   python  

Last modified 11 October 2025