Medium Live

Programming a language

40 points

40 Solves

Programming

Wolfowy

Community Rating: 4.38 / 5

Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

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}

First 10 Solvers

Rank Username
1 Rivit
2 brezelsnacker
3 Gilad ctflearn++ badge
4 jnasd
5 0xYa5h

Comments

    • Ichild

      1

      Should be in easy, less points

      • Wolfowy

        0.0

        You're right. Already contacted a proper person :)