Wudge

From Esolang
Jump to navigation Jump to search

Wudge is a very simple string editing based esolang by User:Elphan.

Commands

Wudge only has 6 commands

Syntax What it does
set a {b} set var a to value b
ask a b ask a as prompt and get user's input for var b
jump 10 jump to line 10
print a print value of line 10
replace a [b/c],[d/e] to f take var a's value, and replace patterns b with c and d to e and the resulting string is appended to variable f
if a found [b] do 10 if in var a, pattern b was found, do the next 10 lines. else skip

note: for

replace a [b/c],[d/e] to f

you can stack as many [a/b] arguments as you wish, or just make many replace commands

Example programs

Hello, world!

set a {Hello, world!}
print a

Truth-machine

set prompt {I need 1 or 0}
ask prompt input
if input found [1] do 2
print input
jump 4
if input found [0] do 1
print input

Infinite cat program

set prompt {}
ask prompt input
print input
jump 1

One time cat program

set prompt {}
ask prompt input
print input

Asterisks to Roman numerals

set msg {this program counts the amount of * you input in roman numerals up to MMMCMXCIX.}
print msg
set prompt { please input: }
ask prompt roman
set result {Result:}
replace roman [*/I],[IIIII/V],[IIII/IV],[VV/X],[VIV/IX],[XXXXX/L],[XXXX/XL], [LL/C],[LXL/XC],[CCCCC/D],[CCCC/CD],[DD/M],[DCD/CM] to roman
print result
print roman

Interpreters/Compilers

You can find the Python interpreter for Wudge here.