A minimal, modern interpreted language with unique syntax and powerful features.
- Modern Syntax: Clean, readable syntax with unique features
- Type Safety: Optional types and type hints
- Functional Features: Pattern matching, pipes, and guards
- Immutable by Default: Variables are immutable unless explicitly marked as mutable
- Object-Oriented: Classes with methods and properties
- Error Handling: Try-catch blocks with pattern matching
- Standard Library: Built-in functions for common operations
- REPL: Interactive shell for quick testing
- File Execution: Run MinLang scripts with
.gkg
extension
pip install minlang
minlang
minlang script.gkg
# Variables are declared with @
@x = 10
@name = "MinLang"
# Functions use fn
fn greet name
return 'Hello, ' + name
end
# Classes use indentation
class Person
fn new name
@name = name
end
fn greet
return 'Hello, my name is ' + @name
end
end
# If-Then-Otherwise
if x > 10 then
print 'Greater'
otherwise
print 'Less or equal'
end
# While Loop
while x > 0 do
print x
x = x - 1
end
# For Loop
for i in 1..10 do
print i
end
fn process data
match data
case [x, y] then
return x + y
case {name: n} then
return 'Hello ' + n
end
end
@result = 10 |> square |> add 5 |> to_str
print 'Hello, World!'
fn fib n
if n <= 1 then
return n
otherwise
return fib(n - 1) + fib(n - 2)
end
end
for i in 0..10 do
print fib(i)
end
class Counter
fn new
@count = 0
end
fn increment
@count = @count + 1
end
fn get_count
return @count
end
end
@counter = Counter.new
counter.increment
print counter.get_count
MIT
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request