UDDIN-LANG (Unified Dynamic Decision Interpreter Notation) - A specialized Flexible Rule Logic Platform that resembles a programming language, offering high expressiveness, full flow control, and runtime programmable capabilities for complex business decision support systems.
Flexible Rule Logic Platform with Programming Language Expressiveness
- About UDDIN-LANG
- Key Features
- Quick Start
- Development Workflow Use Cases
- Language Grammar
- Architecture Overview
- Contributing
UDDIN-LANG is a specialized rule engine platform designed to bridge the gap between simple rule engines and full programming languages. It combines the power of programming language expressiveness with the simplicity needed for business decision systems.
π― Perfect For:
- π‘οΈ Security & Anti-fraud - Multi-factor authentication rules, transaction monitoring, and behavioral analysis systems
- π€ Business Automation - Approval workflows, document processing, and intelligent routing systems
- οΏ½ Decision Support - Recommendation engines, risk assessment tools, and dynamic pricing systems
- βοΈ Compliance Rules - Regulatory compliance engines with audit trails
- π° Financial Logic - Complex financial calculations and risk management
- π― Recommendation Systems - Intelligent content and product recommendations
- π Data Validation - Complex validation rules with custom logic
- π Real-time Data Processing - Change Data Capture (CDC) for live database monitoring and event-driven architectures
Unlike traditional rule engines that limit you to simple if-then logic, UDDIN-LANG provides:
- Full Programming Language Power - Support for loops, functions, and complex logic
- Runtime Flexibility - Modify rules without system restarts
- Developer Friendly - Familiar syntax with powerful debugging capabilities
- Enterprise Ready - Built for scale and performance
UDDIN-LANG serves as the foundation for building sophisticated rule management platforms:
- Visual Rule Designers - Drag-and-drop rule creation interfaces
- Decision Management Systems - Enterprise-grade rule management platforms
- Workflow Automation - Complex process rules with branching logic
- React Flow Integration - Perfect backend for visual rule designers
Ideal for learning programming fundamentals with a focus on decision logic:
- Clean Syntax - Easy to read and understand for beginners
- Logic First - Focus on decision-making and algorithmic thinking
- Debugging Friendly - Clear execution flow for learning
UDDIN-LANG draws inspiration from multiple paradigms while maintaining focus on rule-based logic:
graph TD
A[Uddin-Lang] --> B[Python - Clean Syntax]
A --> C[JavaScript - Dynamic Nature]
A --> D[Go - Simplicity]
A --> E[Lua - Embedded Scripting]
A --> F[Ruby - Expressiveness]
style A fill:#4a90e2,stroke:#333,stroke-width:3px,color:white
style B fill:#3776ab,stroke:#333,stroke-width:2px,color:white
style C fill:#f7df1e,stroke:#333,stroke-width:2px,color:black
style D fill:#00add8,stroke:#333,stroke-width:2px,color:white
style E fill:#000080,stroke:#333,stroke-width:2px,color:white
style F fill:#cc342d,stroke:#333,stroke-width:2px,color:white
- "Code should read like natural language" - Prioritizing readability over brevity
- "Functions are first-class citizens" - Everything is a value, including functions
- "Fail fast, fail clearly" - Clear error messages and early error detection
- "Simple things should be simple" - Common tasks require minimal code
- β Dynamic Typing with runtime type checking
- β First-class Functions and closures
- β Built-in Data Structures (Arrays, Maps/Objects)
- β
Rich Built-in Functions including enhanced
range()with Python-like syntax - β Exception Handling with try-catch blocks
- β Advanced Error Reporting with precise error location and clear explanations
- β Loop Control (break, continue statements)
- β Module System with import statement for importing .din files
- β
Flexible Comment System with both single-line (
//) and multiline (/* */) comments - β Functional Programming paradigms
- β Memory Safe with garbage collection
- β Rich Operator Set including logical XOR and compound assignment operators
- β Multiline Strings with backticks for raw text (perfect for JSON, SQL, HTML)
- β JSON Support with built-in parsing and serialization functions
- β¨ Extended Standard Library with advanced string manipulation, functional array methods, and new data structures (Set, Stack, Queue) π Comprehensive Networking with HTTP client, TCP/UDP sockets, and network utilities ποΈ Database Integration & CDC with real-time Change Data Capture for PostgreSQL and MySQL binlog streaming
- β
Syntax Analysis (
--analyze) - Fast syntax checking without execution - β
Performance Profiling (
--profile) - Detailed execution metrics and timing - β Interactive CLI with comprehensive help and examples
- β Developer-Friendly Error Messages with source code context
- β Multiple Execution Modes - Analysis, profiling, and standard execution
π For complete language reference, syntax guide, and advanced examples:
# Add to your Go project
go get github.com/bonkzero404/uddin-lang# Install globally
go install github.com/bonkzero404/uddin-lang/cmd/uddin-lang@latest
# Or build from source
git clone https://github.com/bonkzero404/uddin-lang.git
cd uddin-lang
go build -o uddinlang cmd/uddin-lang/main.gopackage main
import (
"fmt"
"github.com/bonkzero404/uddin-lang"
)
func main() {
// Create a new engine
engine := uddin.New()
// Execute code
result, err := engine.ExecuteString(`
x = 10
y = 20
return x + y
`)
if err != nil {
panic(err)
}
fmt.Println("Result:", result) // Output: Result: 30
// Evaluate expressions
value, err := engine.EvaluateString("2 + 3 * 4")
if err != nil {
panic(err)
}
fmt.Println("Expression result:", value) // Output: Expression result: 14
}Create a file hello.din:
// hello.din - Your first Uddin-Lang program
fun main():
print("Hello, Uddin-Lang! π")
// Variables and expressions
name = "World"
message = "Welcome to " + name
print(message)
// Simple function
fun greet(person):
return "Hello, " + person + "!"
end
print(greet("Developer"))
endRun it:
# If installed globally
uddin-lang hello.din
# If built from source
./uddinlang hello.din
# Or run directly from source
go run cmd/uddin-lang/main.go hello.dinThe language comes with comprehensive examples showcasing all features:
# List all available examples
uddin-lang --examples
# or if built from source: ./uddinlang --examples
# Run specific examples
uddin-lang examples/12_logical_operators.din # XOR and logical operations
uddin-lang examples/13_assignment_operators.din # Compound assignments (+=, -=, etc.)
uddin-lang examples/01_hello_world.din # Basic syntax
uddin-lang examples/03_math_library.din # Mathematical functions
# β¨ New Standard Library Examples
uddin-lang examples/14_string_manipulation_demo.din # Advanced string functions
uddin-lang examples/15_array_methods_demo.din # Functional array methods
uddin-lang examples/16_data_structures_demo.din # Set, Stack, Queue usage
uddin-lang examples/20_json_handling_demo.din # JSON parsing and serialization
uddin-lang examples/21_multiline_strings_demo.din # Multiline string features
# π Networking Examples
./uddinlang examples/17_http_client_demo.din # HTTP client operations
./uddinlang examples/18_networking_demo.din # TCP/UDP networking and utilities
./uddinlang examples/19_persistent_http_server.din # Persistent HTTP server with main function
# ποΈ Database & CDC Examples
./uddinlang examples/database/postgres_multi_table_stream_listener.din # PostgreSQL CDC streaming
./uddinlang examples/database/mysql_multi_table_stream_listener.din # MySQL binlog CDC streamingUddin-Lang provides powerful command-line tools for development workflow:
Check your code syntax without execution - perfect for development and CI/CD:
# Analyze syntax only (fast feedback)
./uddinlang --analyze script.din
./uddinlang -a script.din
# Example output for valid syntax:
# β Syntax analysis passed - No syntax errors found
# Example output for syntax errors:
# -----------------------------------------------------------
# if (true):
# ^
# -----------------------------------------------------------
# Syntax Error: parse error at 6:14: expected then, but got :Monitor execution performance and optimization metrics:
# Run with performance profiling
./uddinlang --profile script.din
./uddinlang -p script.din
# Example profiling output:
# Time Program Execution: 254.166Β΅s
# Elapsed Operation: 53 Ops (208525/s)
# Builtin Calls: 8 (31475/s)
# User Calls: 1 (3934/s)Uddin-Lang provides two levels of memory optimization:
# Run with stable memory optimizations
./uddinlang --memory-optimize-stable script.din
# Combine with profiling to see optimization effects
./uddinlang --memory-optimize-stable --profile script.dinβ Production Features:
- Tagged value types for reduced memory overhead
- Compact environment structures
- Cache-friendly data layouts
- Thread-safe and concurrent function compatible
When to use:
- Production environments
- Applications using concurrent functions
- Multi-threaded environments
- Performance-critical applications
# Run with experimental memory optimizations
./uddinlang --memory-optimize-experimental script.din
# Legacy flag (DEPRECATED - maps to experimental)
./uddinlang --memory-optimize script.din
./uddinlang -m script.din- Variable lookup caching
- Expression memoization
- Not compatible with concurrent functions (
concurrent_map,concurrent_filter,concurrent_reduce) - May have thread safety issues
When to use experimental:
- Sequential processing workloads only
- Development and testing environments
- Performance benchmarking
When to avoid experimental:
- Programs using concurrent functions
- Multi-threaded environments
- Production systems requiring stability
| Command | Short | Description |
|---|---|---|
--help |
-h |
Show usage information |
--version |
-v |
Display version information |
--examples |
-e |
List all available example files |
--analyze |
-a |
Syntax analysis without execution |
--profile |
-p |
Enable performance profiling |
--memory-optimize-stable |
Enable stable memory optimizations (production-ready) | |
--memory-optimize-experimental |
Enable experimental memory optimizations | |
--memory-optimize |
-m |
Enable experimental memory optimization (DEPRECATED) |
--from_json |
Execute code from JSON AST format |
# Basic execution
./uddinlang script.din
# Development workflow
./uddinlang --analyze script.din # Check syntax first
./uddinlang --profile script.din # Run with performance monitoring
# Memory optimization (experimental)
./uddinlang --memory-optimize script.din # Enable memory layout optimization
./uddinlang -m script.din # Short form
# JSON AST execution
./uddinlang --from_json script.json # Execute from JSON AST format
# Flexible flag positioning
./uddinlang script.din --analyze # Flags can be placed after filename
./uddinlang -a -p script.din # Multiple flags (analyze takes priority)
# Get help and examples
./uddinlang --help # Show usage
./uddinlang --examples # List example files
./uddinlang --version # Show version infoUddin-Lang CLI tools support various development scenarios:
# Validate all scripts in a project
find . -name "*.din" -exec ./uddinlang --analyze {} \;
# Exit code integration for CI/CD pipelines
./uddinlang --analyze script.din && echo "Syntax OK" || echo "Syntax Error"# Before optimization
./uddinlang --profile slow_script.din
# After optimization
./uddinlang --profile optimized_script.din
# Compare execution metrics to measure improvements# Edit-check-run cycle
vim script.din # Edit script
./uddinlang --analyze script.din # Quick syntax check
./uddinlang script.din # Run if syntax is valid# Language servers can use syntax analysis
./uddinlang --analyze file.din 2>&1 | parse_errors
# Real-time syntax highlighting based on analysis results// Program Structure
program = { statement }
// Statements
statement = expression_stmt
| assignment
| if_stmt
| while_stmt
| for_stmt
| function_def
| memo_function_def
| return_stmt
| break_stmt
| continue_stmt
| import_stmt
| try_catch_stmt
expression_stmt = expression
assignment = ( IDENTIFIER | subscript ) ( "=" | "+=" | "-=" | "*=" | "/=" | "%=" ) expression
if_stmt = "if" "(" expression ")" "then" ":" block
{ ( "else" "if" | "elif" ) "(" expression ")" "then" ":" block }
[ "else" ":" block ] "end"
while_stmt = "while" "(" expression ")" ":" block "end"
for_stmt = "for" "(" IDENTIFIER "in" expression ")" ":" block "end"
function_def = "fun" IDENTIFIER "(" [ parameter_list ] ")" ":" block "end"
memo_function_def = "memo" "fun" IDENTIFIER "(" [ parameter_list ] ")" ":" block "end"
return_stmt = "return" [ expression ]
break_stmt = "break"
continue_stmt = "continue"
import_stmt = "import" STRING
try_catch_stmt = "try" ":" block "catch" "(" IDENTIFIER ")" ":" block "end"
block = { statement }
parameter_list = IDENTIFIER { "," IDENTIFIER } [ "..." ]
// Expressions (in precedence order, lowest to highest)
expression = ternary
ternary = logical_or [ "?" expression ":" expression ]
logical_or = logical_xor { "or" logical_xor }
logical_xor = logical_and { "xor" logical_and }
logical_and = equality { "and" equality }
equality = comparison { ( "==" | "!=" ) comparison }
comparison = addition { ( "<" | "<=" | ">" | ">=" ) addition }
addition = multiplication { ( "+" | "-" ) multiplication }
multiplication = power { ( "*" | "/" | "%" ) power }
power = unary [ "**" power ] // Right associative
unary = ( "not" | "-" ) unary | postfix
postfix = primary { call_suffix | subscript_suffix | property_suffix }
call_suffix = "(" [ argument_list ] ")"
subscript_suffix = "[" expression "]"
property_suffix = "." IDENTIFIER
argument_list = expression { "," expression } [ "..." ]
primary = IDENTIFIER
| literal
| list
| map
| function_expression
| "(" expression ")"
function_expression = "fun" "(" [ parameter_list ] ")" ":" block "end"
list = "[" [ expression { "," expression } [ "," ] ] "]"
map = "{" [ map_entry { "," map_entry } [ "," ] ] "}"
map_entry = ( IDENTIFIER | STRING | "(" expression ")" ) ":" expression
subscript = postfix "[" expression "]"
| postfix "." IDENTIFIER
// Literals
literal = INTEGER
| FLOAT
| STRING
| "true"
| "false"
| "null"
// Lexical Elements
IDENTIFIER = letter { letter | digit | "_" }
INTEGER = digit { digit }
FLOAT = digit { digit } "." digit { digit } [ ( "e" | "E" ) [ "+" | "-" ] digit { digit } ]
| digit { digit } ( "e" | "E" ) [ "+" | "-" ] digit { digit }
STRING = '"' { string_char } '"'
| "'" { string_char } "'"
| '"""' { any_char } '"""' // Multiline string
string_char = any_char_except_quote_and_newline | escape_sequence
escape_sequence = "\\" ( "n" | "t" | "r" | "\\" | '"' | "'" )
letter = "a" ... "z" | "A" ... "Z"
digit = "0" ... "9"
// Comments
comment = single_line_comment | multiline_comment
single_line_comment = "//" { any_character_except_newline }
multiline_comment = "/*" { any_character } "*/"| Precedence | Operators | Associativity | Description |
|---|---|---|---|
| 1 | () [] . |
Left | Function call, Array access, Property access |
| 2 | not - (unary) |
Right | Logical NOT, Unary minus |
| 3 | ** |
Right | Exponentiation (power operator) |
| 4 | * / % |
Left | Multiplication, Division, Modulo |
| 5 | + - |
Left | Addition, Subtraction |
| 6 | < <= > >= |
Left | Relational operators |
| 7 | == != |
Left | Equality operators |
| 8 | and |
Left | Logical AND |
| 9 | xor |
Left | Logical XOR (exclusive or) |
| 10 | or |
Left | Logical OR |
| 11 | ? : |
Right | Ternary conditional operator |
| 12 | = += -= *= /= %= |
Right | Assignment and compound assignment |
Functions can accept variable number of arguments using the ellipsis (...) operator:
// Function definition with variadic parameters
parameter_list = IDENTIFIER { "," IDENTIFIER } [ "..." ]
// Function call with argument spreading
argument_list = expression { "," expression } [ "..." ]Examples:
// Define variadic function
fun sum(numbers...):
total = 0
for (num in numbers):
total += num
end
return total
end
// Call with multiple arguments
result = sum(1, 2, 3, 4, 5)
// Call with array spreading
numbers = [1, 2, 3, 4, 5]
result = sum(numbers...)
Functions can be memoized for automatic caching using the memo keyword:
memo_function_def = "memo" "fun" IDENTIFIER "(" [ parameter_list ] ")" ( ":" | "{" ) block ( "end" | "}" )Example:
// Memoized fibonacci function
memo fun fibonacci(n):
if (n <= 1):
return n
end
return fibonacci(n-1) + fibonacci(n-2)
end
Numeric literals support scientific notation:
FLOAT = digit { digit } "." digit { digit } [ ( "e" | "E" ) [ "+" | "-" ] digit { digit } ]
| digit { digit } ( "e" | "E" ) [ "+" | "-" ] digit { digit }Examples:
avogadro = 6.022e23
electron_mass = 9.109e-31
speed_of_light = 2.998E+8
Strings can span multiple lines using triple quotes:
STRING = '"' { string_char } '"'
| "'" { string_char } "'"
| '"""' { any_char } '"""' // Multiline stringExample:
query = """
SELECT name, age, email
FROM users
WHERE age > 18
ORDER BY name
"""
Blocks use colon-end syntax:
if (condition):
statements
endUDDIN-LANG provides powerful real-time database integration capabilities with built-in Change Data Capture (CDC) support for monitoring database changes and building event-driven applications.
- PostgreSQL - LISTEN/NOTIFY based real-time streaming
- MySQL - Binary log (binlog) streaming for high-performance CDC
- Oracle - Planned support for Oracle CDC
- MongoDB - Planned support for MongoDB Change Streams
- Real-time Event Streaming - Instant notification of data changes
- Multi-table Monitoring - Monitor multiple tables simultaneously
- Event Filtering - Filter events by operation type (INSERT, UPDATE, DELETE)
- Low Latency - Optimized for high-performance streaming
- Automatic Reconnection - Built-in resilience and error handling
// PostgreSQL CDC Example
fun main():
// Configure CDC connection
config = {
"host": "localhost",
"port": 5432,
"database": "mydb",
"username": "user",
"password": "pass"
}
// Start streaming changes from multiple tables
stream_tables(["users", "orders", "products"], config, fun(event):
print("Database change detected:")
print("Table: " + event.table)
print("Operation: " + event.operation)
print("Data: " + json_stringify(event.data))
// Process the change event
if (event.table == "orders" and event.operation == "INSERT") then:
// Trigger order processing workflow
process_new_order(event.data)
end
end)
end- Real-time Analytics - Stream data changes to analytics dashboards
- Event-driven Microservices - Trigger business processes from data changes
- Data Synchronization - Keep multiple systems in sync
- Audit Logging - Track all data modifications for compliance
- Cache Invalidation - Update caches when underlying data changes
- Search Index Updates - Keep search indexes synchronized with database
For detailed CDC implementation guides, configuration options, and advanced examples:
π Read CDC Documentation β
graph TB
A[Source Code] --> B[Tokenizer/Lexer]
B --> C[Parser]
C --> D[Abstract Syntax Tree]
D --> E[Evaluator]
E --> F[Interpreter Core]
F --> G[Runtime Environment]
%% Core Components
G --> H[Variable Scopes]
G --> I[Built-in Dispatcher]
G --> J[Memory Pools]
G --> K[Error Handling]
%% Optimization Layer
L[Expression Optimizer] --> E
M[Constant Folder] --> E
N[Memoization Cache] --> F
O[String Interning] --> J
%% Built-in Function Categories
I --> P[Core Functions]
I --> Q[Math Functions]
I --> R[String Functions]
I --> S[Array Functions]
I --> T[File System]
I --> U[Network Functions]
I --> V[Database Functions]
%% Memory Management
J --> W[Array Pools]
J --> X[Map Pools]
J --> Y[String Builder Pools]
J --> Z[Variable Lookup Cache]
style A fill:#e1f5fe
style D fill:#f3e5f5
style E fill:#e8f5e8
style F fill:#fff3e0
style G fill:#f0f4c3
style L fill:#fce4ec
style I fill:#e0f2f1
graph TB
A[Memory Layout Config] --> B[Tagged Values]
A --> C[Compact Environment]
A --> D[Cache-Friendly Structures]
%% Object Pools
E[Object Pools] --> F[Array Pool]
E --> G[Map Pool]
E --> H[String Builder Pool]
E --> I[AST Node Pool]
%% Caching Systems
J[Caching Layer] --> K[Memoization Cache]
J --> L[Variable Lookup Cache]
J --> M[Token Cache]
J --> N[Parser Cache]
%% Optimization Engines
O[Optimization] --> P[Expression Optimizer]
O --> Q[Constant Folder]
O --> R[Fast Numeric Evaluator]
O --> S[String Interning]
%% Performance Monitoring
T[Performance Monitor] --> U[Operation Tracking]
T --> V[Memory Leak Detection]
T --> W[Call Statistics]
style A fill:#e3f2fd
style E fill:#f3e5f5
style J fill:#e8f5e8
style O fill:#fff3e0
style T fill:#fce4ec
graph TB
A[Built-in Dispatcher] --> B[Function Registry]
B --> C[Argument Validation]
B --> D[Call Statistics]
%% Function Categories
E[Core Functions] --> F[print, len, typeof]
G[Math Functions] --> H[abs, sqrt, pow, sin, cos]
I[String Functions] --> J[substr, split, join, contains]
K[Array Functions] --> L[range, filter, map, reduce]
M[File System] --> N[read_file, write_file, exists]
O[Network] --> P[http_get, http_post, tcp_connect]
Q[Database] --> R[mysql_stream, postgres_stream]
S[Concurrent] --> T[async, await, parallel]
U[Data Structure] --> V[stack, queue, heap, graph]
%% Dispatch Flow
A --> E
A --> G
A --> I
A --> K
A --> M
A --> O
A --> Q
A --> S
A --> U
%% Optimization
W[Fast Path] --> X[Type-specific Handlers]
W --> Y[Specialized Builtins]
A --> W
style A fill:#e0f2f1
style B fill:#f3e5f5
style W fill:#fff3e0
sequenceDiagram
participant U as User
participant M as Main
participant T as Tokenizer
participant P as Parser
participant I as Interpreter
participant E as Environment
U->>M: Run uddinlang script.din
M->>T: Tokenize source code
T->>P: Token stream
P->>I: Abstract Syntax Tree
I->>E: Execute statements
E->>I: Return values
I->>M: Execution result
M->>U: Output/Error
| Component | Responsibility |
|---|---|
| Tokenizer | Converts source code into tokens with caching (lexical analysis) |
| Parser | Builds Abstract Syntax Tree from tokens with node pooling |
| AST | Represents program structure in optimized tree form |
| Evaluator | Evaluates expressions with constant folding optimization |
| Interpreter Core | Orchestrates execution flow and manages global state |
| Runtime Environment | Manages variable scopes, I/O streams, and execution context |
| Built-in Dispatcher | Optimized dispatch system for built-in functions |
| Memory Pools | Efficient memory allocation and reuse for arrays, maps, strings |
| Expression Optimizer | Optimizes expressions through constant folding and caching |
| Memoization Cache | Caches function results for pure functions |
| Variable Lookup Cache | Accelerates variable resolution in nested scopes |
| String Interning | Reduces memory usage by reusing identical strings |
| Performance Monitor | Tracks operation counts and detects memory leaks |
We welcome contributions! Here's how to get started:
git clone https://github.com/bonkzero404/uddin-lang.git
cd uddin-langgit checkout -b feature/my-new-feature- Follow Go coding conventions
- Add tests for new features
- Update documentation and examples
- Ensure all tests pass
git commit -m "Add my new feature"
git push origin feature/my-new-feature