Maroon is a pirate-themed programming language that makes coding as adventurous as sailing the high seas! Written in Python, it features a unique syntax inspired by pirate parlance while maintaining functional programming capabilities.
Avast ye! Added a built-in help system for salty sea dogs to navigate the treacherous waters of Maroonβuse help to see all commands or help sails with "function" to inspect specific functions. Now even landlubbers can avoid Davy Jones' locker when coding! π΄ββ οΈ
help sails with
help sails with sum
Shiver me types! Added new type-checkin' tools to avoid walkin' the plank of runtime errorsβuse check_type, assert_type, and is_list_of_type to verify yer loot. Now ye can sniff out phony values faster than a shark smells blood! π¦
x be 5
check_type sails with x, "number"
assert_type sails with x, "number"
loot be list of [1, 2, "gold"]
is_list_of_type sails with loot, "number"
voyage raid(island be "Tortuga", loot be "gold"):
bark "Plundering" loot "from" island
end voyage
raid()
raid("Port Royal", "emeralds")
booty be (10 divided_by 2) plus (3 times 4)
import "cannon_loader.maroon"
import "navigator/star_chart"
bark shout("whisper")
bark split_loot("apple|banana|coconut", "|")[1]
bark join_crew(list of "A", "B", "C", "D"), " - ")
treasure_map be list of 1, 2, 3, 4, 5
bark shuffle(sails with treasure_map)
loot be list of "common", "rare", "legendary"
chances be list of 60, 35, 5
bark weighted_choice(sails with loot, chances)
doubloons be list of 1, 2, 3, 4
tripled be map(doubloons, "times", 3)
rich_beards be filter(doubloons, "greater_than", 2)
total be reduce(doubloons, "plus")
New comparisons: greater_or_equal, less_or_equal
Complex math expressions: (5 plus 3) times (10 divided_by 2)
Nested list declarations: list of list of 1,2, list of 3,4
- Fixed parser issues with random functions
- Anchored list declaration parsing
- Repaired plunder loop navigation
- Patched floating-point treasure miscalculations
- Secured First Mate's quarters (now inactive by default)
Yo Ho Ho! With v1.2, Maroon now supports proper code organization, advanced list operations, and safer navigation through stormy code seas. Sail with confidence knowing your First Mate won't squawk unless summoned! π¦βοΈ
while counter be less_than 3 bark counter
plunder each coin from treasure_chest bark coin
repeat 3 times bark "BOOM!"
choose x:
case 1: bark "one"
default: bark "unknown"
end choose
brace for impact:
bark "Dangerous waters"
if capsized, bark "Error!"
- List comprehension:
list of 1, 2, 3 where each times 2
- Filter:
coins where it greater_than 5
- Reduce:
reduce coins with result plus it
- Upper/lower case:
"hello" upper
- Split/join:
"hello world" split " "
dialect Caribbean:
"shout" be "bark"
"expedition" be "voyage"
end dialect
bark roll_dice sails with 20
bark random_float sails with
bark random_float sails with 10, 20
crew be list of 1, 2, 3, 4, 5
bark random_pick sails with crew
bark random_sample sails with crew, 3
bark normal_random sails with
# Math operations
x be 5
bark factorial sails with x
angle be 3.14159
bark sin sails with angle
bark cos sails with angle
bark tan sails with angle
bark exp sails with 2
bark log sails with 10
bark log sails with 8, 2
# Statistical operations
numbers be list of 2, 4, 6, 8, 10
bark mean sails with numbers
bark median sails with numbers
bark sum sails with numbers
# Gaming functions
bark flip_coin sails with
bark roll_multiple sails with 3, 6
bark roll_multiple sails with 2, 20
- Pirate-themed syntax that's both fun and functional
- Built-in type system with support for numbers, strings, booleans, and lists
- Function definitions using
voyage
keyword - Rich set of mathematical and logical operations
- Built-in debugging tools
- Scope management with variable stacking
- Exception handling with pirate-flavored error messages
treasure be 42
message be "Ahoy, world!"
plus
: Additionminus
: Subtractiontimes
: Multiplicationdivided_by
: Divisionmodulo
: Moduluspower
: Exponentiation
bark
: Print outputcount_booty
: Length functionplunder
: Maximum valueabandon
: Minimum valuedebug_chest
: Debug current scopesqrt
,abs
,round
: Mathematical operationsto_int
,to_float
,to_str
: Type conversion
voyage greet(name):
bark "Ahoy," name
end voyage
crew be list of "Jack", "Anne", "Mary"
add "Blackbeard" to crew
if gold be greater_than 100, then bark "Rich!" else bark "Poor!"
The interpreter provides detailed error messages through the PirateException
class, helping developers navigate through rough seas of debugging.
The interpreter is built with clean, modular Python code featuring:
- Regular expression parsing
- Robust type system
- Comprehensive operator support
- Modular function handling
- Clone the repository
- Run Maroon scripts with
.maroon
extension - Start writing your pirate-themed programs!
Example:
treasure be 42
bark "Me treasure chest holds" treasure "gold pieces!"
- Run the script with: python main.py yourfilename or python main.py for the shell
MIT License! Steal at yer own risk ππ΄ββ οΈ
Join our crew! Contributions are welcome through pull requests.