We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Indirect Regular Gobbledegook
Indirect Regular Gobbledegook (commonly abbreviated as .irg) is a minimal 8-command imperative programming language designed and authored by User:Maglang.
you can run .irg in your browser at [1]
Warning: .irg needs LF, a CRLF file will break, this is being fixed.
Warning: .irg is still in active development, this means bugs are likely, and it is not feature complete.
Syntax
- Inline comments can be added anywhere in square brackets (eg.
display[this is a comment] "text":), this applies to every syntax type.
Classic Syntax
- Commands need to be indented by 2 spaces or more, otherwise a line comment.
- Commands end with a trailing comma (,), this includes line comments
- Arguments need to be wrapped in curly brackets ({ and })
Ex:
countdown in .irg: ,
let {i 5},
lb {loop},
display {#i},
let {i =(#i - 1)},
ig {?#i;0;=;! loop},
end,
BASIC-like Syntax
- Lines starting with
remare treated as comments - Commands end with a trailing colon (:) or a newline, this includes line comments
Ex:
rem countdown in .irg: let i 5 lb loop display #i let i =(#i - 1) ig ?#i;0;=;! loop end:
Function Syntax
- Lines starting with
#are treated as comments - Commands end with a trailing colon (:) or a newline, this includes line comments
- Arguments need to be in parentheses, separated by commas
Ex:
# countdown in .irg: let(i, 5) lb(loop) display(#i) let(i, =(#i - 1)) ig(?#i;0;=;!, loop) end:
The resolver
.irg has a powerful resolver for some command arguments that need to be resolved
This resolver can handle many values:
- variables, prefix with # (eg.
#myvar) - arrays, prefix with N% (where N is the index) (eg.
1%myarr) - strings, put in quotes (eg.
"hello, i am text") - conditionals, prefix with ?, written in RPN, seperated by semicolons (;) (eg.
?1;5;>resolves to 0, representing false) - math, prefix with =, written in RPN, seperated by semicolons (;) (eg.
=1;1;+resolves to 2) - math in Infix notation, prefix with =( and end with ), (eg.
=(1 + 1)resolves to 2)
- Tokenization quirk/bug
Because the token parser handles subtraction as binary operators, spaces are mandatory around binary operators like - to prevent the lexer from combining operators with operands.
=(#i-1)(Incorrect: tokenized improperly as negative token =#i;-1)=(#i - 1)(Correct: resolves cleanly to =#i;1;-)
Instruction Set
.irg consists of exactly 8 commands:
| Command | Syntax Example | Description |
|---|---|---|
let |
let {x 10} |
Assigns a scalar variable value. |
dim |
dim {1 items "apple"} |
Sets an array item at a 1-based index position. |
display |
display {"Hello, World!"} |
Outputs text, variable contents, or expressions to the terminal. |
accept |
accept {in} |
Reads user input from the terminal into a scalar variable. |
ig |
ig {?#in;1;= true} otw {false} |
Conditional jump ("If-Go / Otherwise"). Evaluates an RPN condition starting with ?.
|
go |
go {label_name} |
Unconditional jump to a target label. |
end |
end |
End of Program / End of Execution Block. |
return |
return |
Returns control from a sub-routine jump. |
Examples
Hello, World!
This is a comment, lineflush against the margin. ,
display {"Hello, World!"},
end,
Truth Machine
Demonstrating line comments, inline comments, user input, and conditional looping: ,
Truth Machine implementation in .irg,
Any flush-left lines act as full-line documentation!,
accept {in}, [ Read user input into #in ]
ig {?#in;1;= truel} otw {falsel}, [ Check if #in equals 1 ]
end,
lb {truel},
display {"1"},
go {true},
lb {falsel},
display {"0"},
end,
Guessing Game
rem guessing game in .irg BASIC-like syntax: let n =1;100;rnd lb ask display "pick a number from 1 to 100" accept i ig ?#i;#n;> greater ig ?#i;#n;< lesser ig ?#i;#n;= win end lb greater display "Less than that" go ask lb lesser display "More than that" go ask lb win display "You Won!" end