Programming a language
40 points Medium

My friend is a total "programming languages freak", to the point, that he's decided to make one himself!

The language works like that:

 Language is based on stack (works somewhat like an array)
 Initially stack consists of one element, which value is 0

 "-" decreases stack's last element's value by 1
 "+" increases stack's last element's value by 1
 ">" puts first element at the end of the stack and shifts every other down
 "<" puts last element at the beginning of the stack and shifts every other up
 "@" exchanges last 2 elements
 "." duplicates stack's last element and puts it at the end of the stack
 "€" prints out every stack's element's value in ASCII (from the first to the last element)

Example #1: ".+.-->.<@" (char | stack):

 Init | [0]
 "."  | [0, 0]
 "+"  | [0, 1]
 "."  | [0, 1, 1]
 "-"  | [0, 1, 0]
 "-"  | [0, 1, -1]
 ">"  | [1, -1, 0]
 "."  | [1, -1, 0, 0]
 "<"  | [0, 1, -1, 0]
 "@"  | [0, 1, 0, -1]

Example #2:

 Let's suppose we have a stack like this: [97, 98, 99]
 Then, if there is "€" at this point, the output would be: "abc"

Based on that info, could you give me the output of your input (file attached)?

Flag format: CTFlearn{output of the program}

input.txt
Flag
Rating 4.62
5
4
3
2
1

Discussion

for me it was a chance to review linked list again, a gud one!

0

I was on the right track writing a program for it but messed up by accidentally adding an unnecessary for loop. Nice challenge, took me an hour from start to finish

0

That was so much fun.

0

I'm getting Brainf**k vibes looking at the syntax.

0

It's a nice exercise for absolute beginners to programming to get more familiar with basic data structures, but I'm afraid I don't think it's related to ctfs or that it deserves so many points.

1

Cool but I'd rather put this one in easy

1

simpler than BF

1

Fun way to learn some python tranforms and structures. Thanks

1
Protected
1

If you know programming, it's easy

2