Where even + + is yours to define.
What makes it Pie?
Pie keeps the core tiny and hands you the parts other languages hide. Four ideas shape everything else.
No operators until you make them
Pie doesn't come with +, == or even if. You write them as ordinary functions: prefix, infix, suffix, wrapped around a value like | x |, or spread across a sentence like if a then b else c.
You pick the precedence and the overloads, too.
Try it
infix + = ( a , b ) => __builtin_add ( a , b ) ;
infix * = ( a , b ) => __builtin_mul ( a , b ) ;
exfix | : | = ( x ) => __builtin_abs ( x ) ;
__builtin_print ( 1 + 2 * 3 ) ;
__builtin_print ( | __builtin_neg ( 7 ) | ) ; 7
7
Everything is an expression
Blocks, loops, matches and assignments all produce a value, so they go anywhere a value can. There's no return, no statements and no null.
Try it
print = __builtin_print ;
slices = ( n ) => match n {
= 1 => "one slice" ;
_ => "{ n } slices" ;
} ;
print ( slices ( 8 ) ) ;
answer = { a = 40 ; b = 2 ; __builtin_add ( a , b ) ; } ;
print ( answer ) ; 8 slices
42
Assign to anything
The left side of = can be any expression. Teach Pie that 2 + 2 is 5 and it will remember, until the end of the block.
Try it
infix + = ( a , b ) => __builtin_add ( a , b ) ;
2 + 2 = 5 ;
__builtin_print ( 2 + 2 ) ;
"pie" = "cake" ;
__builtin_print ( "pie" ) ; 5
cake
Types are values
Store types in variables, pass them to functions, and use plain values as types. Any function that returns a Bool can be a type, too.
Try it
Size = union { "small" ; "large" ; } ;
order : Size = "large" ;
Even = ( n : Int ) => __builtin_eq ( __builtin_mod ( n , 2 ) , 0 ) ;
slices : Even = 8 ;
__builtin_print ( order , slices ) ; large 8
Get a piece of the Pie!
Grab a build for Linux or macOS from the releases page , or build from source:
Download
Clone the source code:
git clone https://github.com/AliAlmutawaJr/Pie
cd Pie && mkdir build && cd build
cmake .. && make
Write a file
Save this as hello.pie:
__builtin_print("Hello, Pie!");
Run it
Invoke the Pie executable:
$ ./Pie hello.pie
Hello, Pie!