Mechanicum
Mechanicum is an esoteric programming language inspired by Warhammer 40K's Adeptus Mechanicus faction, loosely inspired by Shakespeare and Olympus. This was made for a uni project as an exercise in learning how to make an interpreter, and is thus somewhat simple, however I still plan to work on and improve it!
Language Overview
Mechanicum's syntax is meant to resemble tech-priests communicating with machine spirits and praying to the Omnissiah.
Title
All Mechanicum programs, known as prayers, must begin with an address to the Machine God, and it is encouraged you do so with appropriate reverence, as well as a description of your program. Titles must include a reference to at least one of the following:
God, Omnissiah, Spirit, Machine, Deus
For example:
O Blessed Machine Spirit, aid your loyal servant, print Hello World!.
Variables
In Mechanicum, variables are known as datum. The Tech-Adepts of Mars strictly oppose innovation, so instead, datum must be salvaged from the dark age of technology:
Salvage Datum <name> = <value>
Mechanicum has a built in register, referred to as a tome. Any rite that produces a value will be stored in the tome, otherwise it acts as any other datum would.
Instructions
To perform instructions, we invoke holy rites. To these, we can offer datum if necessary.
Rites include:
- **RiteOfAddition**: Adds two numbers, datum or literals. Result stored in tome.
Invoke RiteOfAddition <operand1> <operand2>
- **RiteOfSubtraction**: Subtracts two numbers, datum or literals. Result stored in tome.
Invoke RiteOfSubtraction <operand1> <operand2>
- **RiteOfJump**: Unconditionally jumps to a specified line.
Invoke RiteOfJump <lineNumber>
- **RiteOfBranch**: Conditionally jumps to a specified line if a given variable is non-zero.
Invoke RiteOfBranch <variable> <targetLine>
- **Proclamation**: Outputs a variable's value or a raw string, essentially a print command.
Invoke Proclamation <variable/text>
Ending
Prayers must conclude with reverence to the Machine God. The closing line must include a reference, like the title, and also praise, from the following:
Praise, Thank, Hail, Blessed
For example: Hail the Machine!
Examples
Fibonacci sequence
God Machine, grant me the knowledge of the fibonacci sequence! Salvage Datum fib0 = 0 Salvage Datum fib1 = 1 Salvage Datum counter = 10 Invoke RiteOfAddition fib0 fib1 Salvage Datum fib2 = tome Salvage Datum fib0 = fib1 Salvage Datum fib1 = fib2 Invoke RiteOfSubtraction counter 1 Salvage Datum counter = tome Invoke Proclamation fib2 Invoke RiteOfBranch counter 5 Hail the Omnissiah!