Underload/a interpreter in Uiua

From Esolang
Jump to navigation Jump to search

This is a Underload interpreter in Uiua written by User:Jan jelo

C     ← ⊂:□:⊂⊂{}∩□
State ← C0{"aa""b""c"}
I     ← °□⊡0
S     ← °□⊡1
P     ← °□⊡2
# * (Join)
J ← C I:⊂:↘2:□⊂°□⊡0:°□⊡1..S.:↘1P.
# a (A)
A ← C I:⊂:↘1:□$"(_)"°□⊡0.S.:↘1P.
# ~ (Flip)
F ← C I:⊂⊂⊂{}⊡1:⊡0.:↘2.S.:↘1P.
# : (Dup)
D ← C I:⊂⊡0.S.:↘1P.
# ! (pOp)
O ← C I:↘1S.:↘1P.
# S (ouT)
T ← &pf°□⊡0S:O∘.
# ^ (Eval)
E ← C I:↘1S.:⊂°□⊡0S:↘1P..

BStep ← ⨬(
  C+1I:⊂□⊂°□⊡0S:⊡0P.:↘1S..:↘1P.
| ⨬(C-1I:⊂□⊂°□⊡0S:⊡0P.:↘1S..:↘1P.
  | C I:⊂□⊂°□⊡0S:⊡0P.:↘1S..:↘1P.
  )≠@)⊡0P.
)≠@(⊡0P.
B ← C I:⊂□⇌↘1⇌°□⊡0:↘1.S.:P∘.⍢(
  BStep
| ≠0I
)C1⊂{""}S:↘1P.
RunStep ← ⍣(
  J°@*
| A°@a
| F°@~
| D°@:
| O°@!
| T°@S
| E°@^
| B°@(
)⊡0P.
Run ← ◌⍢(
  RunStep
| >0⧻P
)State
Run"(:aSS):aSS"
#(:aSS):aSS