The SGL Programming Language: A Tutorial
(PDF, EPUB)by Malcolm Jennings and Eric U. Smith
published by Interdimensional Gadgeteers and Technomages
(written on the page in pencil: "This one is a snoozer, but it's by far the best source. Added some jokes to make it less boring!")
Introduction
The SGL Programming language is a sigil-based language for the manipulation of connected realities based on IGT standards. It can be performed by use of INSCRIBING and EXPUNGING sigils in a properly-aligned Funge Space. It requires interaction with a standards-compliant Propositional Reckoning Device, such as those manufactured by The ReckCo! Corporation.
After aligning a Funge Space, a mage simply needs to INSCRIBE or engrave sigils in the Funge Space to command the Instruction Grue. This is a friendly, familial, tutorial for a clever mage, so it is understood that mistakes will be made following along. Simply EXPUNGE those sigils to return the Funge Space Cell to a blank state.
May you enjoy your journey!
(written on the page in pencil: "That is the last exclamation point you're going to be seeing for a while.")
The Sigils of the SGL Programming Language
The sigils of the SGL Programming language are named after the letters of the Greek Alphabet. Which are:
- Alpha (α, Α)
- Beta (β, Β)
- Gamma (γ, Γ)
- Delta (δ, Δ)
- Epsilon (ε, Ε)
- Zeta (ζ, Ζ)
- Eta (η, Η)
- Theta (θ, Θ)
- Iota (ι, Ι)
- Kappa (κ, Κ)
- Lambda (λ, Λ)
- Mu (μ, Μ)
- Nu (ν, Ν)
- Xi (ξ, Ξ)
- Omicron (ο, Ο)
- Pi (π, Π)
- Rho (ρ, Ρ)
- Sigma (σ, Σ)
- Tau (τ, Τ)
- Upsilon (υ, Υ)
- Phi (φ, Φ)
- Chi (χ, Χ)
- Psi (ψ, Ψ)
- Omega (ω, Ω)
Though, to learn them in that order would be confusing. There is odd logic in the sigil names, and where possible, we will provide mnemonics. For now, you should notice that the Alpha Sigil is the start, and Omega Sigil is the end.
The Alpha and Omega Sigils: Start and End
The processing of a SGL program starts with a ReckCo!-brand Instruction Grue facing to the east in a cell where the
Alpha Sigil (α, Α) has been engraved. Starting from this location, the Instruction Grue will move forward (that is, to the east) and respond to other SGL sigils to manipulate IGT standard-compliant Bul Tubes.
Its opposite, the Omega (ω, Ω) Sigil, ends the processing of an SGL program, emptying the Bul Tube into a Propositional Reckoning Device, which may then perform further manifestation in the aligned reality. Much like the Alpha Sigil, the Omega Sigil can only be engraved. All other sigils may be INSCRIBED, assuming no sigil has been engraved there already by the Propositional Reckoning Device.
The Kappa, Lambda, Iota, and Eta Sigils: Cardinal 2-dimensional Direction Shifters
Funge Space itself may be either 2-dimensional or 3-dimensional. As 3-dimensional is an extension of 2-dimensions, let us start with only 2.
In 2 dimensions, Cells in Funge Space will be connected in the north, east, south, and west directions, which are the same directions an Instruction Grue can move, in 2-dimensions. As mentioned in the last chapter, the Instruction Grue starts off facing to the east. Unless prompted to turn by a sigil, the Instruction Grue will proceed through Funge Space cell by cell.
These 4 Sigils:
- Kappa (κ, Κ): Go North
- Lambda (λ, Λ): Go East
- Iota (ι, Ι): Go South
- Eta (η, Η): Go West
command the Instruction Grue to turn in their respective directions. That is, when encountering one, the Instruction Grue will turn north, east, south, or west based on the sigils engraved or INSCRIBED in Funge Space.
(written on the page in pencil next to "Go West": "Life is peaceful there :3") (written on the page in pencil: "Research suggests these sigils are based on some obscure UNIX tool that uses the HJKL keys???")
The Phi and Rho Sigils: Cardinal 3-dimensional Direction Shifters
When Funge Space is 3-dimensional, in addition to the directions from 2-dimensional space (that is, north, south, east, and west), the Instruction Grue can move up and down. (Mages riding an Instruction Grue should take care to properly harness themselves!)
The next 2 sigils:
- Phi (φ, Φ): Go Up
- Rho (ρ, Ρ): Go Down
command the Instruction Grue to turn in their respective directions. These can be remembered through a simple mnemonic: "Phi to go up high, Rho to go down low."
(written on the page in pencil: "Aw, this doesn't work in 2D. ;_;")
The Gamma and Zeta Sigils: Left and Right Turns
In addition to sigils for more specific directions as we've just seen, there are more general sigils to turn left (counter-clockwise) and right (clockwise):
- Gamma (γ, Γ): Turn Left
- Zeta (ζ, Ζ): Turn Right
When these sigils are encountered the Instruction Grue will turn 90 degrees around the up-down axis. For example, An Instruction Grue facing north can turn left (Gamma (γ, Γ)) to the west direction, or turn right (Zeta (ζ, Ζ)) to the east direction. All the cardinal 2-dimensional directions (that is, north, east, south, and west) are similar.
These sigils can also be used when Funge Space is 3-dimensional, but behavior when the Instruction Grue is facing up or down is not specified, and left up to vendor implementation.
The Gamma Sigil can be remembered if a mage recalls that a capital gamma looks like an upside-down 'L' and thus is to turn left. Unfortunately, the Zeta Sigil lacks a friendly mnemonic.
(written on the page in pencil: "How about I'll send you RIGHT to the zoo with Zeta!? :p")
The Nu Sigil - Reflection Direction Shifter
Another generic direction sigil is the Nu (ν, Ν) Sigil, which commands the Instruction Grue to turn 180 degrees from the current direction it is facing. For example, an Instruction Grue facing east will turn to the west, while one facing upwards will turn downwards.
Note that this behavior is also triggered when the Instruction Grue encounters an unfamiliar sigil, though this should not be depended on.
(written on the page in pencil: "Nu, you can't go that way, you'll have to turn back around!")
The Upsilon Sigil - Random Direction Shifter
Technomages, such as IGT members, have long found that while computers strive on order, magic strives on chaos. To perform technomagic, then, a mage is often required to introduce a bit of chaos into the ordered world of computers. The SGL programming Language is no different.
The Upsilon (υ, Υ) Sigil commands the Instruction Grue to turn in a random cardinal direction. That, is for 2-dimensional Funge Space, north, east, south, or west. For 3-dimensional Funge Space, it may also turn upwards and downwards.
(written on the page in pencil: "Idea: Upsilon looks like a 'Y', so 'why leave this up to chance?'")
The Beta Sigil - Skip Next Cell
Very similar to other direction sigils, the Beta (β, Β) Sigil is focused on the Instruction Grue's position in Funge Space. When encountered, the Instruction Grue is commanded to maintain the same facing, but skip the next cell it would normally enter, landing in the cell past that one. This may cause the Instruction Grue to wrap around Funge Space.
(written on the page in pencil: "BOING :3")
The IGT Standard Bul Tube
To explain upcoming sigils, a mage must understand the IGT standard Bul Tube. Buls can either be set to "Trul" or "Ful", which corresponds to true and false within binary Propositional Reckoning.
(Future expansions of Buls to account for multi-valued logic are planned.)
An IGT standard Bul Tube, then is simply a tube holding a set of Buls for the Instruction Grue to operate on. While traversing Funge Space, the Instruction Grue may encounter additional embedded or placed Buls. When doing so, the Instruction Grue is commanded to put that Bul into the Bul Tube, pushing the others down.
In general, sigils operate on the most recently added Buls. That is the top Buls, compared to the bottom Buls that have been pushed down. If for some reason the Bul Tube is empty, and a sigil requires a Bul as an argument, the Bul Tube is treated as an infinitely deep tube of Buls set to Ful. Mages should avoid running into this case, ideally.
The Pi, Delta, Sigma, and Mu Sigils: Bul Tube Operation Sigils
Once Buls have been pushed into the Bul Tube, a Mage will desire to operate on the Buls in the tube. To do that, they need a way to pull what they've pushed down. You may have guessed that the Pi (π, Π) Sigil is exactly that. Pi starts with P so you "pull" what you have "pushed". (Pi's mathematical significance does not factor into this. As a mage is well aware, it is only constant given one particular universe's instantiation of Pi due to Gribnax's Lemma, which is the basis of the Propositional Reckoning method of universe alteration.)
To be more explicit, when the Instruction Grue encounters the Pi (π, Π) Sigil, it should pull a Bul out of the tube. However, that is all it will do. The Chi Energy (not to be confused with the Chi Sigil) represented by the Bul will dissipate. Other sigils will operate on the pulled Bul after pulling a Bul, utilizing the Chi Energy.
For example, the Delta (δ, Δ) Sigil commands the Instruction Grue to duplicate the pulled Bul, and then pushes the two duplicates back into the tube. As "Delta" begins with "D" and so does "duplicate", this sigil should be easy for the mage to remember.
When encountering the Sigma (σ, Σ) Sigil, the Instruction Grue is commanded to pull out the top 2 Buls from the tube, and then push them back into the tube in the opposite order that it pulled it in. That is if the top 2 Buls were called "X" and "Y" starting at the top, "X" would be pushed first, and then "Y". This would swap the Buls. The clever mage may have noticed that "Sigma" and "Swap" both start with "S"!
When encountering the Mu (μ, Μ) Sigil, the Instruction Grue is commanded to pull all the Buls out of the tube and not push any back in. This will dissipate the Chi Energy (once again not to be confused with the Chi Sigil).
See the previous chapter for a general explanation of how sigils generally treat an empty Bul Tube.
(written on the page in pencil: "'mu' is Japanese for 'nothing'")
The Chi, Epsilon, and Omicron Sigils: The Bul Operators
The next three Sigils command the Instruction Grue to perform the equivalent of basic Boolean logic operators with pulled Buls and to push the result back into the tube. A mage interested in reality operation through Propositional Reckoning will surely recognize these. (Once again, Future Expansions of Buls to account for multi-valued logic are planned. Keep a watch for news from your guild.)
The Chi (χ, Χ) Sigil, which must not be confused with the Chi Energy found within every Bul, commands the Instruction Grue to pull one Bul from the tube, invert the Bul, and then push the Bul back into the tube. That is, if the pulled Bul is Trul, the pulled Bul is flipped to Ful, and then the pulled Bul is pushed back in the tube, now set to Ful.
(written on the page in pencil: "*borat voice* this bul is Trulnot lol")
The Epsilon (ε, Ε) Sigil, when encountered by the Instruction Grue, command it to pull 2 Buls from the tube. If and only if, the two Buls are set to Trul, a Bul set to Trul is pushed down. Otherwise, if either are Ful, a Bul set to Ful is pushed down. The clever mage is likely very familiar with the language of Latin, and has figured out that as the word in Latin for "and", et, starts with an "E". This gives it similarity to the Greek letter epsilon, which looks like an "E".
The Omicron (ο, Ο) Sigil, when encountered, commands the Instruction Grue to pull 2 Buls from the tube. If either are Trul, a Bul set to Trul is pushed down. If neither are Trul, that is both are Ful, then a Bul set to Ful is pushed down. "Omicron" and "Or" both start with "O", so this should be trivial for a mage to remember.
(written on the page in pencil: "wasn't omnicron that big planet robot from transformers?")
The Psi, Theta, and Xi Sigils: Cardinal Bul-based Direction Shifters
These sigils are like a combination of the direction shifters and the operator sigils discussed in previous chapters. When these sigils are encountered the Instruction Grue is commanded to pull 1 or 2 Buls from the tube, and based on the Bul's setting, turn to a new facing. The Bul pulled will be then discarded. This will be clearer to the mage after some description of these sigils.
The Psi (ψ, Ψ) Sigil is the east-west Bul-based direction shifter. That is, the Instruction Grue is commanded to pull one Bul from the tube. If the setting of that Bul is Trul, the Instruction Grue will turn west. Otherwise, if it is Ful, the Instruction Grue will turn east.
The Theta (θ, Θ) Sigil is the north-south Bul-based direction shifter. That is, the Instruction Grue is commanded to pull one Bul from the tube. If the setting of that Bul is Trul, the Instruction Grue will turn north. Otherwise, if it is Ful, the Instruction Grue will turn south.
The Xi (ξ, Ξ) Sigil is the up-down Bul-based direction shifter. That is, the Instruction Grue is commanded to pull one Bul from the tube. If the setting of that Bul is Trul, the Instruction Grue will turn upwards. Otherwise, if it is Ful, the Instruction Grue will turn downwards. This is only possible in 3-dimensional Funge Space. If Funge space is 2-dimensional, the Instruction Grue will act as if it encountered a Nu Sigil, and turn 180 degrees to the opposite direction from the direction it is facing. No Bul will be pulled.
The Tau Sigil: Left-right Bul-based Direction Shifter
The Tau (τ, Τ) Sigil is the left-right Bul-based direction shifter. Unlike the sigils discussed last chapter, it operates on two Buls. This will perhaps be easier to think of Trul as the number 1 and Ful as the number 0 (the clever mage will notice that these are the integral representations of "true" and "false" using a mapping to the set of integers modulus 2). When the Tau sigil is encountered, the Instruction Grue is commanded to pull two Buls from the tube, which we call Bul X and Bul Y, with Bul Y as the top Bul in the tube, and Bul X as the second Bul in the tube.
If Bul X is less than Bul Y (that is, X is Ful (0) and Y is Trul (1)), the Instruction Grue is commanded to turn right (as if it encountered the Zeta Sigil). However, if Bul X is more than Bul Y (that is, X is Trul (1) and Y is Ful (0)), the Instruction Grue is commanded to turn left (as if it encountered the Gamma Sigil).
Otherwise, it must mean that both Bul X and Bul Y have the same value (assuming binary Propositional Reckoning (multi-valued Propositional Reckoning is planned for future expansions (watch your guild email list!))). In this case, the IG is commanded to not turn at all, and maintain its current facing.
We apologize for the use of the initialism "IG" for "Instruction Grue". We got carried away with the parentheses, and our editor requested we shorten this page somehow.
A Simple Example
Part 1
For the illustration of the student, let us explain a simple example on a 2-dimensional Funge Space of size 5 cells. Consider the following overview of the Funge Space represented as if we were looking down upon the entire space from above. In this case, west and east would be left and right, respectively, and north and south would be up and down, respectively. Cells are displayed as single characters, the sigils written as each upper-case letter, Buls represented as 1 if they are Trul, or 0 if they are Ful, and cells with neither as an interpunct (·). Do not worry if you do not remember all the Instruction Grue commandments represented by the Greek letters. The descriptions of standards-compliant execution that follow will help remind you. A mage may also want to look at the reference pages in the back for the full list.
Here is a possible view of such a Funge Space:
Α·Ι··
Ω1ΨΠΙ
··ΚΧΗ
·····
·····
Note: We have chosen upper-case letters as most Funge Space mapping tools use those to represent engraved sigils, saving lower-case letters for sigils that have been inscribed by the mage. As engraved sigils are often more of a roadblock to the mage, it behooves them to gain familiarity with them first. However, remembering the lower-case letters is just as vital.
Part 2
Α·Ι··
Ω1ΨΠΙ
··ΚΧΗ
·····
·····
Let's start at the Alpha (Α) Sigil in the most northwest corner, facing to the east. The next cell to the east has nothing, so the Instruction Grue will continue to the cell to the east of that. There, the Iota (Ι) Sigil will command the Instruction Grue to face the south. Moving to the cell to the south, the Psi (Ψ) Sigil will command the Instruction Grue to pull a Bul from the tube.
If that Bul is Trul, it will face to the west. In the cell to the west, it will find a Bul set to Trul and it will push the value of that Bul back into the tube. This essentially replaces the Trul Bul that was discarded while responding to the Psi (Ψ) Sigil in the previous cell. It will then move to the west, reaching the Omega (Ω) Sigil, where the program ends, and the current Bul-tube is sent to the Propositional Reckoner.
Part 3
Α·Ι··
Ω1ΨΠΙ
··ΚΧΗ
·····
·····
However if the Bul pulled in response to the Psi (Ψ) Sigil was Ful, It will face to the east. Moving east to the next cell, the Instruction Grue will notice the Pi (Π) Sigil, and then proceed to pull another Bul from the tube, discarding it. The clever mage will note that means the top two tube Buls are discarded if the top one is Ful.
Moving east to the next cell, the Instruction Grue will encounter the Iota (Ι) Sigil again, and will turn to the south. Moving south to the next cell, the Instruction Grue will encounter the Eta (Η) Sigil, and will turn to the west. Moving west to the next cell, the Instruction Grue will encounter the Chi (Χ) Sigil. It will then pull a Bul from the tube and set it to the opposite of what it's currently set to, and then push it back into the tube.
Proceeding west from there, the Instruction Grue will encounter the Kappa (Κ) Sigil, and turn to the north. Proceeding north from there, it will encounter the Psi (Ψ) Sigil again, and essentially follow the same process, until it encounters a Bul set to Trul when processing the Psi (Ψ) Sigil, and end the program. The clever mage will notice that this is essentially a looped set of instructions as they may be familiar with from other programming languages. The very clever mage will notice that also forms a looped part in Funge Space, providing a lovely correspondence to the looped set of instructions. All mages should be careful that they do not end up in an infinite loop. DISMOUNTING the Instruction Grue is the only way to have it stop responding to sigils. You'll die well before it does.
Part 4
Α·Ι··
Ω1ΨΠΙ
··ΚΧΗ
·····
·····
Describing what this essentially implements is a bit odd, as it was essentially made as a one-off example rather than a real program. But let's start looking with the top of the tube (the first Bul). If that Bul is set to Trul, ultimately the tube is left alone. The first Bul will be pulled out while processing the Psi (Ψ) Sigil, but another Bul set to Trul will be immediately pushed on.
If the first Bul is set to Ful however, it and the second Bul will be pulled out the tube and discarded. The third Bul then will be set to its opposite. So if that third Bul was Ful, it will get set to Trul, and then once the Psi (Ψ) Sigil commands the Instruction Grue to move west, where it will replace that third Bul (now set to Trul) and finish the program.
However, if the third Bul was Trul, it will get set to Ful when the Chi (Χ) Sigil is encountered. Then Psi (Ψ) Sigil would command the Instruction Grue to move east, where it will pull out the third Bul and the next (fourth) Bul and discard them. The next (fifth) Bul will now be at the top of the tube, in the same position as the third bul was, and the same will happen to it as the third Bul. The program will continue until that top bul is finally Ful (before being inverted in response to the Chi (Χ) Sigil), and then it will end with the top bul set to Trul.
To really reduce this down, you can consider the tube as being split in pairs. If the first of a pair is Trul, processing stops. If it is Ful, both of the pair are discarded, and the first of the next pair is inverted. The process then continues with that pair. This likely not a realistic program, but it's simple enough for an example.
Exercise
Α·Ι··
Ω1Ψ?Ι
··ΚΧΗ
·····
·····
This is mostly the same example, but with one sigil replaced with a "?". The Instruction Grue starts with 4 Buls in the tube of Ful, Ful, Ful, and Trul (from the top). The clever mage should now have enough information to be able to figure out which sigil should replace the '?' so that when it reaches the Omega (Ω) Sigil, there are 3 Buls in the tube set to Trul, Ful, Trul (from the top).
Exercise, Answer
The answer is the Sigma (Σ) Sigil.
Α·Ι··
Ω1ΨΣΙ
··ΚΧΗ
·····
·····
Afterword
Congratulations, clever mage! You have reached the final chapter. You should now be able to use the SGL Programming language to command an Instruction Grue to modify an IGT standard Bul-tube in order to provide the input of a Propositional Reckoning Reality Alteration Device.
We had a very fun time writing this and we hope you had fun reading it. And now, when some one asks you if you know the SGL Programming language, you can proudly say "It's all Greek to me!".
(A drawing of an angry face has been drawn on this page in pencil.)
Appendix: Sigil Reference Chart
- Execution Control Sigils
- Alpha (α, Α): Start Execution (Facing East)
- Omega (ω, Ω): End Execution
- Cardinal Direction Shifters
- Kappa (κ, Κ): Go North
- Lambda (λ, Λ): Go East
- Iota (ι, Ι): Go South
- Eta (η, Η): Go West
- Phi (φ, Φ): Go Up, 3-dimensional only
- Rho (ρ, Ρ): Go Down, 3-dimensional only
- Special Direction Shifters
- Gamma (γ, Γ): Turn Left
- Zeta (ζ, Ζ): Turn Right
- Nu (ν, Ν): Reflect (Default unknown sigil behavior)
- Upsilon (υ, Υ): Random Direction Shifter
- Beta (β, Β): Skip Next Cell
- Bul Tube Operation Sigils
- Pi (π, Π): Pull Top Bul and Discard
- Delta (δ, Δ): Duplicate Top Bul
- Sigma (σ, Σ): Swap Top 2 Buls
- Mu (μ, Μ): Empty Bul Tube
- Bul Operator Sigils
- Chi (χ, Χ): Not Operator
- Epsilon (ε, Ε): And Operator
- Omicron (ο, Ο): Or Operator
- Bul-based Direction Shifters
- Psi (ψ, Ψ): East-West, west if top is Trul, else east
- Theta (θ, Θ): North-South, north if top is Trul, else south
- Xi (ξ, Ξ): Up-Down, up if top is Trul, else down, 3-d only
- Tau (τ, Τ): Left-Right, turn right if top is less than second, left if more than, and else stay straight