TryHard

From Esolang
Jump to navigation Jump to search

TryHard is a Regex inspired stack-based language made by User:A().

Commands

Command
Command Disc
push(a) Push a as a string on to the stack
pop(a) Pop the most recent a off the stack
count(a) Count the number of instances of a in stack
for-Each(a)[] Run for each instance of a in stack
label(a) label line a
jump(a) jump to label a
print(a) print a
Skip(a) if a doesn't equal top of stack skip next line
Accept-Input input

Programs

A+B

push(a)
push(b)
for-Each(a)
[
 push(c)
]
for-Each(b)
[
 push(c)
]
print(count(c))

A-B

push(a)
push(b)
for-Each(b)
[
 pop(a)
]
print(count(a))

A*B

push(a)
push(a)
push(b)
push(b)
for-Each(a)
[
 for-Each(b)
 [
  push(c)
 ]
]
print(count(c))

Count-up

push(b)
push(b)
push(b)
push(b)
push(b)
push(b)
push(b)
push(b)
push(b)
for-Each(b)
[
 push(a)
 print(count(a))
]

Count to infinity

label(start)
push(a)
print(count(a))
jump(start)

Truth-machine

push(1) ; push 1
Skip(Accept-Input)
label(Loop start) 
jump(start loop) ; goto start loop
print(0) 
jump(-1) ; goto invaild
label(start loop)
print(1) ; print 1
jump(start loop); goto start loop

Theoretical-Programs

A Pascal's Modified Triangle program would need about 4 variables:

q, for q
p, for p
b; q*2
d; p*2