From 2a74e5d5b61b25f1ae4b9ec43f5e51cd46ae2473 Mon Sep 17 00:00:00 2001 From: funkywaddle Date: Mon, 24 Nov 2025 05:47:03 +0000 Subject: [PATCH 1/2] Add README.md Signed-off-by: funkywaddle --- README.md | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2864bb9 --- /dev/null +++ b/README.md @@ -0,0 +1,165 @@ +# Waddle Programming Language + +## Overview + +Waddle is a modern, expressive programming language designed to be intuitive, readable, and powerful. It combines elements of object-oriented and functional programming with a focus on clarity and developer productivity. + +## Key Features + +### Language Characteristics +- Strong, static typing +- Object-oriented with interface support +- Functional programming constructs +- Explicit error handling +- Concise syntax + +### Core Design Principles +- Readability first +- Explicit over implicit +- Minimal cognitive overhead +- Flexible type system + +## Basic Syntax + +### Type Declaration +```waddle +// Basic type definition +Animal { + // Type implementation +} + +// Inheritance +Animal/Dog { + // Dog-specific implementations +} + +// Interface definition +@Mammal { + // Interface methods +} + +// Interface implementation +Animal/Dog -> [Mammal, Domesticated] { + // Multiple interface support +} +``` + +### Functions +```waddle +// Function declaration +// Public function ++fn calculateArea(width: Integer, height: Integer) -> [Decimal] { + rtn width.multiply(height); +} + +// Protected Function +fn calculateArea(width: Integer, height: Integer) -> [Decimal] { + rtn width.multiply(height); +} + +// Private Function +-fn calculateArea(width: Integer, height: Integer) -> [Decimal] { + rtn width.multiply(height); +} + +// Lambda expression +areaCalculator = fn(width: Integer, height: Integer) -> [Decimal] { + rtn width.multiply(height); +} +``` + +### Error Handling +```waddle +result = riskyOperation().attempt { + ok { + // Successful execution + my.output.print("Operation successful"); + } + + ValueError { + // Handle specific value errors + my.logger.log(error.getMessage()); + } + + error { + // Catch-all error handling + my.criticalLogger.alert("Unexpected error"); + } +} + +``` + +### Iteration +```waddle +// Forward iteration +loop(i, 0->10) { + my.output.print(i); +} + +// Foward iteration, with step +loop(i, 0->10, 2) { + my.output.print(i); // outputs 0, 2, 4, 6, 8, 10 +} + +// Reverse iteration +rloop(i, 10->0) { + my.output.print(i); +} + +// Reverse iteration, with step +rloop(i, 10->0, 2) { + my.output.print(i); // outputs 10, 8, 6, 4, 2, 0 +} + +``` + +## Type System + +### Primitive Types + - `String` + - `Integer` + - `Decimal` + - `Boolean` + +### Advanced Types + - Arrays: `Type<>` + - Custom types + - Interface types + +## Unique Language Constructs + +### Dot Notation Methods + - All objects have built-in methods + - Chainable method calls + - Explicit operations + +```waddle +my.text.set("Hello") + .concat(" World") + .length(); +``` + +### Object Lifecycle + - Explicit constructors: `on_create` + - Explicit destructors: `on_destroy` + +### Planned Features + - Enhanced concurrency support + - Expanded standard library + - Advanced module system + +## Installation +_Detailed installation instructions will be added as the language develops_ + +## Contribution +Interested in contributing to Waddle? + - Report issues on this repository + - Submit pull requests + - Provide feedback and suggestions + +## License +Read the LICENSE.md file + +## Current Status +Waddle is currently in active development. +The language specification and implementation are evolving. \ No newline at end of file From f9eaf1a65794415aba2b456b08f922ddacbcf2f5 Mon Sep 17 00:00:00 2001 From: funkywaddle Date: Mon, 24 Nov 2025 06:07:09 +0000 Subject: [PATCH 2/2] Update README.md. Add array foreach example. Add better formatting. Signed-off-by: funkywaddle --- README.md | 62 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2864bb9..6662b89 100644 --- a/README.md +++ b/README.md @@ -22,47 +22,61 @@ Waddle is a modern, expressive programming language designed to be intuitive, re ## Basic Syntax ### Type Declaration + +#### Basic type definition ```waddle -// Basic type definition Animal { // Type implementation } - -// Inheritance +``` +#### Inheritance +```waddle Animal/Dog { // Dog-specific implementations } +``` -// Interface definition +#### Interface definition +```waddle @Mammal { // Interface methods } +``` -// Interface implementation +#### Interface implementation +```waddle Animal/Dog -> [Mammal, Domesticated] { // Multiple interface support } ``` ### Functions + +#### Function declaration + +##### Public function ```waddle -// Function declaration -// Public function +fn calculateArea(width: Integer, height: Integer) -> [Decimal] { rtn width.multiply(height); } +``` -// Protected Function +##### Protected Function +```waddle fn calculateArea(width: Integer, height: Integer) -> [Decimal] { rtn width.multiply(height); } +``` -// Private Function +##### Private Function +```waddle -fn calculateArea(width: Integer, height: Integer) -> [Decimal] { rtn width.multiply(height); } +``` -// Lambda expression +##### Lambda expression +```waddle areaCalculator = fn(width: Integer, height: Integer) -> [Decimal] { rtn width.multiply(height); } @@ -90,26 +104,46 @@ result = riskyOperation().attempt { ``` ### Iteration + +#### Forward iteration ```waddle -// Forward iteration loop(i, 0->10) { my.output.print(i); } +``` -// Foward iteration, with step +#### Foward iteration, with step +```waddle loop(i, 0->10, 2) { my.output.print(i); // outputs 0, 2, 4, 6, 8, 10 } +``` -// Reverse iteration +#### Reverse iteration +```waddle rloop(i, 10->0) { my.output.print(i); } +``` -// Reverse iteration, with step +#### Reverse iteration, with step +```waddle rloop(i, 10->0, 2) { my.output.print(i); // outputs 10, 8, 6, 4, 2, 0 } +``` + +#### Foreach loop on arrays +```waddle +Integer<> nums.set(<1, 2, 3, 4>); + +nums.each( + i -> { + if(i.mod(2).eq(0)){ + my.output.print(i); // outputs 2, 4 + } + } +); ```