An esoteric language where everything is structured as a pyramid.
Pyramidion uses pyramids to structure code, evaluating expressions from the base up to the peak. Operators at higher levels share results from lower levels, requiring careful planning of the pyramid’s structure.
Inspired by Kaleidoscope and developed to explore LLVM and compiler optimization.
+
+ +
* 0 *
x x y y
pyramid bar(x, y)
bar
+ +
1 1 2
- The function
bar(x, y)squares two numbers and then adds them. - The
mainpyramid callsbar(1 + 1, 1 + 2).
| Name | Arity | Function |
|---|---|---|
+ |
2 | a + b |
- |
2 | a - b |
* |
2 | a * b |
/ |
2 | a / b |
| pyramid | N/A | Function definition |
To compile Pyramidion using clang++ and LLVM, run:
cd src/
clang++ -g pyramidion.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core orcjit native` -O3 -o pyramidionTo execute a Pyramidion program:
./pyramidion <input file>