Portal
Portal is a tape-based esoteric programming language designed on 10:13AM EST July 16 2014 and implemented shortly after. It is written by greato. It is a fork of brainfuck with inspiration drawn from the video game and namesake Portal. Portal loosely implements Wang B-machine
Instructions
Portal has seven instructions:
Command | Description |
---|---|
+
|
Increment the referenced cell |
-
|
Decrement the referenced cell |
>
|
Move the pointer right |
<
|
Move the pointer left |
.
|
Output the character signified by the referenced cell |
,
|
Input a character and store it in the referenced cell |
o
|
If this is the second o portal, jump back to the instruction following the first o portal |
[
|
Move the first o portal to the right |
]
|
Move the last o portal to the left |
Example
This following example prints an ampersand(&):
+++++++++++++o+++++]]]]]o++++++++++++++++++++.
and here is how this code executes, with *
indicating the instruction pointer:
*+++++++++++++o+++++]]]]]o++++++++++++++++++++. # omitted +++++++++++++o+++++*]]]]]o++++++++++++++++++++. ++++++++++++++o++++]*]]]]o++++++++++++++++++++. +++++++++++++++o+++]]*]]]o++++++++++++++++++++. ++++++++++++++++o++]]]*]]o++++++++++++++++++++. +++++++++++++++++o+]]]]*]o++++++++++++++++++++. ++++++++++++++++++o]]]]]*o++++++++++++++++++++. ++++++++++++++++++o*]]]]]o++++++++++++++++++++. ++++++++++++++++++]o*]]]]o++++++++++++++++++++. ++++++++++++++++++]]o*]]]o++++++++++++++++++++. ++++++++++++++++++]]]o*]]o++++++++++++++++++++. ++++++++++++++++++]]]]o*]o++++++++++++++++++++. ++++++++++++++++++]]]]]o*++++++++++++++++++++. ++++++++++++++++++]]]]]o+*+++++++++++++++++++. ++++++++++++++++++]]]]]o++*++++++++++++++++++. # omitted ++++++++++++++++++]]]]]o++++++++++++++++++++.*
As you can see from the code trace above, when the pointer reaches the first portal, the portal is not open. Only after the pointer reaches the other portal does the portal opens.
Implementation
The only implementation so far is written in Python: https://github.com/greato/portal