title: Make a ;# interpreter

text:
# Question
Title: Make a ;# interpreter
I recently created a new language called `;#` (pronounced "Semicolon Hash") which only has two commands:

`;` add one to the accumulator

`#` modulo the accumulator by 127, convert to ASCII character and output **without** a newline. After this, reset the accumulator to 0. Yes, 127 is correct.

Any other character is ignored. It has no effect on the accumulator and should do nothing.

Your task is to create an interpreter for this powerful language!

It should be either a full program or a function that will take a `;#` program as input and produce the correct output.

## Examples

```
Output: Hello, World!
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o

Output: Fizz Buzz output
Program: link below

Output: !
Program: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#

```

Fizz Buzz up to 100

# Answer
# Python 3, ~~69~~ 68 bytes

*-1 byte thanks to @WheatWizard*

```
i=0
for c in input():
 i+=c==';'
 if'#'==c:print(end=chr(i%127));i=0

```

Try it online!
> 25 votes

# Answer
## JavaScript (ES6), ~~76~~ ~~82~~ 80 bytes

```
s=>s.replace(/./g,c=>c=='#'?String.fromCharCode(a%(a=127)):(a+=(c==';'),''),a=0)

```

### Demo

```
let f =

s=>s.replace(/./g,c=>c=='#'?String.fromCharCode(a%(a=127)):(a+=(c==';'),''),a=0)

console.log(JSON.stringify(f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hafh;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;f;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;###ffh#h#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ffea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o")))
console.log(JSON.stringify(f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#")))
```

### Recursive version, ~~82~~ 77 bytes

*Saved 5 bytes thanks to Neil*

This one is likely to crash for large inputs such as the Fizz Buzz example.

```
f=([c,...s],a=0)=>c?c=='#'?String.fromCharCode(a%127)+f(s):f(s,a+(c==';')):""

```
> 20 votes

# Answer
# Java 8, 100 bytes

```
s->{int i=0;for(byte b:s.getBytes()){if(b==59)i++;if(b==35){System.out.print((char)(i%127));i=0;}}};

```

Try it online!
> 14 votes

# Answer
# Japt, 18 bytes

```
®è'; %# d}'# ë ¯J
```

There's an unprintable \x7f char after `%#`. Test it online!

### How it works

```
®   è'; %#   d}'# ë ¯  J
mZ{Zè'; %127 d}'# ë s0,J
                         // Implicit: operate on input string
mZ{           }'#        // Split the input at '#'s, and map each item Z to
   Zè';                  //   the number of semicolons in Z,
        %127             //   mod 127,
             d           //   turned into a character.
m              '#        // Rejoin the list on '#'. At this point the Hello, World! example
                         // would be "H#e#l#l#o#,# #W#o#r#l#d#!#" plus an null byte.
                  ë      // Take every other character. Eliminates the unnecessary '#'s.
                    ¯J   // Slice off the trailing byte (could be anything if there are
                         // semicolons after the last '#').
                         // Implicit: output result of last expression
```
> 13 votes

# Answer
# Retina, ~~336~~ ~~63~~ ~~67~~ ~~65~~ ~~66~~ ~~62~~ 59 bytes

```
T`;#-ÿ`¯_
;{127}|;+$

(^|¯)
¯
+T`-~`_-`[^¯]
T\`¯`

```

Try it online!

Readable version using *hypothetical* escape syntax:

```
T`;#\x01-ÿ`\x01¯_
;{127}|;+$

(^|¯)\x01\x01
¯\x02
+T`\x01-~`_\x03-\x7f`[^\x01¯]\x01
T\`¯`

```

Does not print NUL bytes, because TIO doesn't allow them in the source code. ~~Also prints an extra newline at the end, but I guess it can't do otherwise.~~ Trailing newline suppressed thanks to @Leo.

-273 (!) bytes thanks to @ETHproductions.

-2 bytes thanks to @ovs.

-3 bytes thanks to @Neil. Check out their wonderful 34-byte solution.
> 13 votes

# Answer
# Ruby, ~~41~~ ~~35~~ 34 characters

(~~40~~ ~~34~~ 33 characters code + 1 character command line option)

```
gsub(/.*?#/){putc$&.count ?;%127}

```

Thanks to:

* Jordan for suggesting to use `putc` to not need explicit conversion with `.chr` (6 characters)
* Kirill L. for finding the unnecessary parenthesis (1 character)

Sample run:

```
bash-4.4$ ruby -ne 'gsub(/.*?#/){putc$&.count ?;%127}' < '2d{.;#' | od -tad1
0000000    2  etb    d  nul  nul  nul  nul    {  nul  nul  nul
          50   23  100    0    0    0    0  123    0    0    0
0000013

```

Try it online!
> 13 votes

# Answer
# Python, 65 bytes

This is a golf of this earlier answer.

```
lambda t:''.join(chr(x.count(';')%127)for x in t.split('#')[:-1])

```

Try it online! Python2

Try it online! Python3

## Explanation

This is a pretty straightforward answer we determine how many `;`s are between each `#` and print the `chr` mod 127. The only thing that might be a little bit strange is the `[:-1]`. We need to drop the last group because there will be no `#` after it.

For example

```
;;#;;;;#;;;;;#;;;

```

Will be split into

```
[';;',';;;;',';;;;;',';;;']

```

But we don't want the last `;;;` because there is no `#` after it to print the value.
> 12 votes

# Answer
# Röda, ~~44~~ ~~39~~ 38 bytes

*5 bytes saved thanks to @fergusq*

```
{(_/`#`)|{|d|d~="[^;]",""chr #d%127}_}

```

Try it online!

Anonymous function that takes the input from the stream.

---

If other characters do not have to be ignored, I get this:

### Röda, 20 bytes

```
{(_/`#`)|chr #_%127}

```
> 9 votes

# Answer
# Python 3, 69 Bytes

Improved, thanks to @Wheat Wizard, @Uriel

```
print(''.join(chr(s.count(';')%127)for s in input().split('#')[:-1]))

```
> 9 votes

# Answer
# \>\<\>, 35 bytes

```
>i:0(?;:'#'=?v';'=?0
^   [0o%'␡'l~<

```

Try it online! Replace  with 0x7F, `^?`, or "delete".

## Main loop

```
>i:0(?;:'#'=?v
^            <

```

This takes a character of input (`i`), checks if its less than zero i.e. EOF (`:0(`) and terminates the program if it is (`?;`). Otherwise, check if the input is equal to `#` (`:'#'=`). If it is, branch down and restart the loop (`?v` ... `^ ... <`).

## Counter logic

```
              ';'=?0

```

Check if the input is equal to `;` (`';'=`). If it is, push a `0`. Otherwise, do nothing. This restarts the main loop.

## Printing logic

```
>       '#'=?v
^   [0o%'␡'l~<

```

When the input character is `#`, pop the input off the stack (`~`), get the number of members on the stack (`l`), push 127 (`'␡'`), and take the modulus (`%`). Then, output it as a character (`o`) and start a new stack (`[0`). This "zeroes" out the counter. Then, the loop restarts.
> 9 votes

# Answer
# Jelly, 13 bytes

```
ṣ”#Ṗċ€”;%127Ọ

```

Try it online!

### How it works

```
ṣ”#Ṗċ€”;%127Ọ  Main link. Argument: s (string)

ṣ”#            Split s at hashes.
   Ṗ           Pop; remove the last chunk.
    ċ€”;       Count the semicola in each chunk.
        %127   Take the counts modulo 127.
            Ọ  Unordinal; cast integers to characters.

```
> 8 votes

# Answer
# 05AB1E, ~~16~~ ~~15~~ 14 bytes

Code:

```
'#¡¨ʒ';¢127%ç?

```

Explanation:

```
'#¡              # Split on hashtags
   ¨             # Remove the last element
    ʒ            # For each element (actually a hacky way, since this is a filter)
     ';¢         #   Count the number of occurences of ';'
        127%     #   Modulo by 127
            ç    #   Convert to char
             ?   #   Pop and print without a newline

```

Uses the **05AB1E**-encoding. Try it online!
> 7 votes

# Answer
# Retina 0.8.2, ~~34~~ 32 bytes

```
T`;#\x00-\xFF`\x7F\x00_
\+T`\x7Eo`\x00-\x7F_`\x7F[^\x7F]|\x7F$

```

Try it online! Includes test case. Edit: Saved 2 bytes with some help from @MartinEnder. Now uses TIO link with null byte support thanks to @Deadcode. Note: Code includes unprintables, which I have replaced with hex escapes in the post. Explanation: The first line cleans up the input: `;` is changed to `\x7F`, `#` to `\x00` and everything else is deleted. Then whenever we see an `\x7F` that is not before another `\x7F`, we delete it and cyclically increment the code of any next character. This is iterated until there are no more `\x7F` characters left.
> 7 votes

# Answer
# x86 machine code on MS-DOS - 29 bytes

```
00000000  31 d2 b4 01 cd 21 73 01  c3 3c 3b 75 06 42 80 fa  |1....!s..<;u.B..|
00000010  7f 74 ed 3c 23 75 eb b4  02 cd 21 eb e3           |.t.<#u....!..|
0000001d

```

Commented assembly:

```
bits 16
org 100h

start:
    xor dx,dx       ; reset dx (used as accumulator)
readch:
    mov ah,1
    int 21h         ; read character
    jnc semicolon
    ret             ; quit if EOF
semicolon:
    cmp al,';'      ; is it a semicolon?
    jne hash        ; if not, skip to next check
    inc dx          ; increment accumulator
    cmp dl,127      ; if we get to 127, reset it; this saves us the
    je start        ; hassle to perform the modulo when handling #
hash:
    cmp al,'#'      ; is it a hash?
    jne readch      ; if not, skip back to character read
    mov ah,2        ; print dl (it was choosen as accumulator exactly
    int 21h         ; because it's the easiest register to print)
    jmp start       ; reset the accumulator and go on reading

```
> 7 votes

# Answer
# 05AB1E, ~~25~~ ~~21~~ 19 bytes

-2 bytes thanks to Adnan

```
Îvy';Q+y'#Qi127%ç?0

```

Explanation:

```
Î                       Initialise stack with 0 and then push input
 v                      For each character
  y';Q+                 If equal to ';', then increment top of stack
       y'#Qi            If equal to '#', then
            127%        Modulo top of stack with 127
                ç       Convert to character
                 ?      Print without newline
                  0     Push a 0 to initialise the stack for the next print

```

Try it online!
> 6 votes

# Answer
## R, 97 90 86 84 bytes

A function:

```
function(s)for(i in utf8ToInt(s)){F=F+(i==59);if(i==35){cat(intToUtf8(F%%127));F=0}}

```

When R starts, `F` is defined as `FALSE` (numeric `0`).

Ungolfed:

```
function (s)
    for (i in utf8ToInt(s)) {
        F = F + (i == 59)
        if (i == 35) {
            cat(intToUtf8(F%%127))
            F = 0
        }
    }

```
> 6 votes

# Answer
# Python, 82 bytes

```
lambda t:''.join(chr(len([g for g in x if g==';'])%127)for x in t.split('#')[:-1])

```
> 5 votes

# Answer
# Plain TeX, 156 bytes

```
\newcount\a\def\;{\advance\a by 1\ifnum\a=127\a=0\fi}\def\#{\message{\the\a}\a=0}\catcode`;=13\catcode35=13\let;=\;\let#=\#\loop\read16 to\>\>\iftrue\repeat

```

**Readable**

```
\newcount\a

\def\;{
  \advance\a by 1
  \ifnum \a=127 \a=0 \fi
}
\def\#{
  \message{\the\a}
  \a=0
}

\catcode`;=13
\catcode35=13

\let;=\;
\let#=\#

\loop
  \read16 to \> \>
  \iftrue \repeat

```
> 5 votes

# Answer
# ;#+, 59 bytes

```
;;;;;~+++++++>~;~++++:>*(~<:-+!(<-;->(;))::<+-::!(<#>)-:-*)

```

Try it online! Input is terminated with a null byte.

## Explanation

The generation is the same as from my Generate ;# code answer. The only difference here is is the iteration.

### Iteration

```
*(~<:-+!(<-;->(;))::<+-::!(<#>)-:-*)
*(                                *)   take input while != 0
  ~                                    swap
   <                                   read value from memory (;)
    :                                  move forward to the accumulator memory spot (AMS)
     -                                 flip Δ
      +                                subtract two accumulators into A
       !                               flip A (0 -> 1, else -> 0)
        (     (;))                     if A is nonzero, or, if A == ';'
         <                             read from AMS
          -;-                          increment
             >                         write to AMS
                  ::                   move to cell 0 (#)
                    <                  read value from memory (#)
                     +                 subtract two accumulators into A
                      -                flip Δ
                       ::              move to AMS
                         !(   )        if A == '#'
                           <           read from AMS
                            #          output mod 127, and clear
                             >         write to AMS
                               -:-     move back to initial cell

```
> 5 votes

# Answer
## CJam, 27 bytes

```
0q{";#"#") 127%co0 "S/=~}%;

```

Explanation:

```
0                            e# Push 0
 q                           e# Push the input
  {                          e# For each character in the input:
   ";#"#                     e#   Index of character in ";#", -1 if not found
        ") 127%co0 "S/       e#   Push this string, split on spaces
                      =      e#   Array access (-1 is the last element)
                       ~     e#   Execute as CJam code. ")" increments the accumulator,
                             e#     and "127%co0" preforms modulo by 127, converts to character, pops and outputs, and then pushes 0.
                        }%   e# End for
                          ;  e# Delete the accumulator

```

## Alternative Solution, 18 bytes

```
q'#/);{';e=127%c}%

```

Explanation:

```
q                   e# Read the whole input
 '#/                e# Split on '#'
    );              e# Delete the last element
      {             e# For each element:
       ';e=         e#   Count number of ';' in string
           127%     e#   Modulo by 127
               c    e#   Convert to character code
                }%  e# End for

```
> 4 votes

# Answer
# Processing.js (Khanacademy version), 118 bytes

```
var n="",a=0;for(var i=0;i<n.length;i++){if(n[i]===";"){a++;}if(n[i]==="#"){println(String.fromCharCode(a%127));a=0;}}

```

Try it online!

As the version of processing used does not have any input methods input is placed in n.
> 4 votes

# Answer
# F#, ~~79~~ ~~91~~ 93 bytes

```
let rec r a=function|[]->()|';'::t->r(a+1)t|'#'::t->printf"%c"(char(a%127));r 0 t|_::y->r a y

```

## Ungolfed

```
let rec run acc = function
    | [] -> ()
    | ';'::xs ->
        run (acc + 1) xs
    | '#'::xs ->
        printf "%c" (char(acc % 127))
        run 0 xs
    | x::xs -> run acc xs

```

Try it online!

Edit: Was treating any other char than ';' as '#'. Changed it so that it's ignoring invalid chars.

# Alternative

# F#, ~~107~~ 104 bytes

```
let r i=
 let a=ref 0
 [for c in i do c|>function|';'->a:=!a+1|'#'->printf"%c"(!a%127|>char);a:=0|_->()]

```

Use of reference cell saves 3 bytes

## Ungolfed

```
let run i =
    let a = ref 0;
    [for c in i do
        match c with
        | ';' -> a := !a + 1
        | '#' ->
            printf "%c" (char(!a % 127))
            a := 0
        |_->()
    ]

```

Try it online
> 4 votes

# Answer
# MATL, 29 bytes

```
';#'&mXz!"@o?T}vn127\c&YD]]vx

```

Input is a string enclosed in single quotes.

Try it online!

The FizzBuzz program is too long for the online interpreters; see it working offline in this gif:

### Explanation

The accumulator value is implemented as the number of elements in the stack. This makes the program slower than if the accumulator value was a single number in the stack, it but saves a few bytes.

```
';#'       % Push this string
&m         % Input string (implicit). Pushes row vector array of the same size with
           % entries 1, 2 or 0 for chars equal to ';', '#' or others, respectively
Xz         % Remove zeros. Gives a column vector
!          % Transpose into a row vector
"          % For each entry
  @        %   Push current entry
  o?       %   If odd
    T      %     Push true. This increases the accumulator (number of stack elements)
  }        %   Else
    v      %     Concatenate stack into a column vector
    n      %     Number of elements
    127\   %     Modulo 127
    c      %     Convert to char
    &YD    %     Display immediately without newline
  ]        %   End
]          % End
vx         % Concatenate stack and delete. This avoids implicit display

```
> 4 votes

# Answer
# C (gcc), 58 bytes

```
a;f(char*s){a+=*s^35?*s==59:-putchar(a%127);a=*s&&f(s+1);}

```

Try it online! (Hint: click **▼ Footer** to collapse it.)
> 4 votes

# Answer
## Perl, 25 bytes

```
$_=chr(y%;%%%127)x/#/

```

Run with `perl -043pe` (counted as 4 bytes, since `perl -e` is standard).

Explanation: `-043` sets the line-terminator to `#` (ASCII 043). `-p` iterates over the input “lines” (actually #-delimited strings, now). `y%;%%` counts the number of `;` in each “line”. `x/#/` makes sure that we don’t print an extra character for programs that don’t end in a # (like the third testcase). `%127` should be fairly obvious. `$_=` is the usual boilerplate.
> 4 votes

# Answer
# Brainfuck, 135 bytes

```
+[>+>>,>+++++[<------->-]<[<+>>++++[<------>-]<[<->[-]]<[>>>+<<<-]<->>[-]]<<[>>>--[>>+<<--]>[>->+<[>]>[<+>-]<<[<]>-]>[-]>.[-]<<<<<<-]<]

```

## Ungolfed

```
Memory layout
0   1   2   3   4   5   6   7
1   f1  f2  in  tmp acc d   acc%d

flag1 indicates hash
flag2 indicates semicolon

+[      infinite loop
    >+      set flag1
    >>,     input
    >+++++[<------->-]<     subtract 35 (hash)

    [       not hash
        <+> set flag2
        >++++[<------>-]<   subtract 24 more (semicolon)
        [   not semicolon
            <-> clear flag2
            [-] clear input
        ]
        <   goto flag2
        [   semicolon
            >>>+<<<-    inc acc and clear flag2
        ]
        <-  clear flag1
        >>[-]   clear input
    ]
    <<      goto flag1
    [       hash
        >>>--[>>+<<--]> set d 127 and goto acc
        [>->+<[>]>[<+>-]<<[<]>-]    mod
        >[-]>       clear d and goto acc%d
        .[-]        print and clear result
        <<<<<<- clear flag1
    ]
<]

```
> 4 votes

# Answer
# Labyrinth, ~~61~~ 47 bytes

```
_36},)@
;    {
; 42_-
"#-  1
_ ; 72
_ ) %
"""".

```

Try it online!

## Explanation

Code execution begins in the top left corner and the first semicolon discards an implicit zero off the stack and continues to the right.

### Orange

* `_36` pushes 36 onto the stack. This is for comparing the input with `#`
* `}` moves the top of the stack to the secondary stack
* `,` pushes the integer value of the character on the stack
* `)` increments the stack (if it's the end of the input, this will make the stack 0 and the flow of the program will proceed to the `@` and exit)
* `{` moves the top of the secondary stack to the top of the primary stack
* `-` pop y, pop x, push x - y. This is for comparing the input with `#` (35 in ascii). If the input was `#` the code will continue to the purple section (because the top of the stack is 0 the IP continues in the direction it was moving before), otherwise it will continue to the green section.

### Purple

* `127` push 127 to the stack
* `%` pop x, pop y, push x%y
* `.` pop the top of the stack (the accumulator) and output as a character

From here the gray code takes us to the top left corner of the program with nothing on the stack.

### Green

* `_24` push 24 onto the stack
* `-` pop x, pop y, push x-y. 24 is the difference between `#` and `;` so this checks if the input was `;`. If it was `;` the code continues straight towards the `)`. Otherwise it will turn to the `#` which pushes the height of the stack (always a positive number, forcing the program to turn right at the next intersection and miss the code which increments the accumulator)
* `;` discard the top of the stack
* `)` increment the top of the stack which is either an implicit zero or it is a previously incremented zero acting as the accumulator for output

From here the gray code takes us to the top left corner of the program with the stack with only the accumulator on it.

### Gray

Quotes are no-ops, `_` pushes a 0 to the stack, and `;` discards the top of the stack. All of this is just code to force the control-flow in the right way and discarding anything extra from the top of the stack.
> 4 votes

# Answer
# Awk, 57 bytes

`BEGIN{RS="#"}RT=="#"{printf("%c",gsub(";","")%127)}`

Explanation:

* `BEGIN{RS="#"}`: make `#` record delimeter
* `RT=="#"`: ignore the record without ending `#`
* `gsub(";","")%127`: count `;` and mod 127
* `printf("%c",_)`: print as ASCII
> 4 votes

# Answer
# Perl 5 with `-043paF(?!^);`, 17 bytes

Golfed down a bit by dom-hastings

```
$_=/#/&&chr@F%127

```

Try it online!
> 4 votes

# Answer
# Rockstar, ~~208~~ ~~168~~ ~~152~~ 148 bytes

```
listen to S
cut S
O's ""
N's 0
while S
roll S in C
let N be+C's ";"
if C's "#"
let M be N/127
turn down M
cast N-M*127 in N
let O be+N
N's 0

say O

```

Try it here (Code will need to be pasted in)

```
listen to S           :Read input string into variable S
cut S                 :Split into an array
O's ""                :Initialise O as an empty string
N's 0                 :Initialise N as 0
while S               :While S is not empty
roll S in C           :  Pop the first element of S into variable C
let N be+C's ";"      :  Increment N by C===";", implicitly casting from Boolean to integer
if C's "#"            :  If C==="#" then
let M be N/127        :    Initialise M as N/127
turn down M           :    Floor M
cast N-M*127 in N     :    Get the character at codepoint N-M*127 and assign it to N
let O be+N            :    Append N to O
N's 0                 :    Reset N to 0
                      :  End if
                      :End while loop
say O                 :Output O

```

---

If we need to be able to handle newlines in the input then we'll need this 169 byte version as each line in Rockstar is a separate input.

```
listen to S
O's ""
N's 0
while S
cut S
while S
roll S in C
let N be+C's ";"
if C's "#"
let M be N/127
turn down M
cast N-M*127 in N
let O be+N
N's 0

listen to S

say O

```
> 4 votes

# Answer
# Vyxal, 10 / 20 bytes

There's two main schools of thought for interpreting `;#`:

* Go through every command and apply it **(Iterative)**
* Split the program into strings of `;`, then count and output. **(Split 'n Count)**

Here's both!

---

# Iterative, 20 bytes

```
0$(\;n=ß›\#n=[₇‹%C₴0

```

Try it Online!

Explanation:

```
                      # Implicit input
0$                    # Initialize accumulator at the bottom of the stack
  (                   # For each command in the program
   \;n=ß              # If command = ';':
        ›             #  Increment accumulator
         \#n=[        # If command = '#':
              ₇‹%     #  Accumulator % 127
                 C    #  Convert accumulator to character
                  ₴   #  Print accumulator w/o newline
                   0  #  Reset accumulator

```

---

# Split 'n Count `K`, ~~<sup>14</sup>~~ ~~<sup>12</sup>~~ 10 bytes

*-1 byte thanks to @caird coinheringaahing.*

*-1 byte by using Map Lambda instead of a for loop.*

*-2 bytes by using Keg mode and removing the `n` I left in from the for loop.*

```
35€ƛ59O₇‹%

```

Try it Online!

Output is a list of characters.

Explanation:

```
            # Implicit input; characters are converted to ordinal values
35€         # Split input program at '#'
   ƛ        # For every section of program:
    59O     #   Count ';'
       ₇‹%  #   Modulus 127
            # 'K' flag - ordinal values are converted to characters

```
> 4 votes

# Answer
# Golfscript, ~~39~~ ~~29~~ ~~25~~ 24 bytes

```
'#'/);{';'/,(127%}%'':n+

```

Try it online!

## Explanation:

```
'#'/);                   # Splits the input with '#' and discards the last part.
                  %      # For each splited string, executes the preceding block:
      {';'/,(127%}       # Splits the string with ';' and counts how many splits were made(which is equal to the number of ';'s). Then, mods that number with 127.
                   '':n+ # Turns every calculated numbers into characters.

```

Note: The final `:n` isn't needed if a trailing newline is allowed. Also, there was a bug in the 29-bytes version that it couldn't handle the input without '#'. Luckily, I could fix that bug and golf my code at the same time.
> 4 votes

# Answer
# Red, 70 bytes

```
a: #""parse ask""[any[";"(a: a + 1)|"#"(prin a % 127 a: #"")| skip]]()

```

Try it locally in interpreter.
> 4 votes

# Answer
# C, ~~65 64~~ 60 bytes

(-2 thanks to ceilingcat)

```
c;f(char*s){for(c=0;*s;s++)c+=*s-35?*s==59:-putchar(c%127);}

```
> 3 votes

# Answer
# APL (Dyalog Unicode), 26 bytes

Anonymous tacit prefix function.

```
⎕UCS 127|1⊥¨';'='#'(⌽=⊂⊢)⌽

```

Try it online!

reverse the argument

`'#'(``)` apply the following tacit function with *hash* as left argument:

the right argument (the ;# code)

partitioned by…

`=` the equality (where there are *hash*es)

reverse that

`';'=` equality to *semicolon*

`1⊥¨` sum each (lit. evaluate each as unary)

`127|` division remainder when divided by 127

`⎕UCS` Convert to corresponding Unicode character
> 3 votes

# Answer
# Alice, 22 bytes

```
I!?';-n+?h$'@u%?'#-n$O

```

Try it online!

### Explanation

We keep on the stack only a single counter of how many `;` we have encountered. When the stack is empty (e.g. at the start of the program) this is implicitly a 0.

```
I!?';-n+?h$'@u%?'#-n$O
I                      Push codepoint of next char from input
 !?                    store it on the tape and reload it right away
   ';-n+               add 1 to the counter if this char is a semicolon,
                       0 otherwise
        ?h$'           If the input char was -1 (EOF) execute the next command,
                       otherwise push its codepoint
            @          Terminate the program (or push 64)
             u         Set all bits up to the most significant as equal to 1
                       this turns 64 (1000000b) into 127 (1111111b)
              %        Compute modulo
               ?       reload the input char from the tape
                '#-n$O if it is a hash, pop the counter and print
                       the corresponding character
                       wrap back to the start of the line

```

A shorter, but non-terminating version of this program can be found here.
> 3 votes

# Answer
# JS (ES6), ~~97~~ 92 bytes

```
c=>(a=0,y="",c.split``.map(x=>x=="#"?(a%=127,y+=String.fromCharCode(a),a=0):x==";"?a++:0),y)

```

Tried to take a different approach than Shaggy's answer. Oh well.
> 3 votes

# Answer
# Bash \+ coreutils, 46 39 bytes

```
tr -dc \;#|sed 'y/;/1/;s/#/.ZC7%P/g'|dc

```

Try it online!

# Explanation

(Thanks Cows Quack for -7 bytes!)

The `tr` portion removes all extraneous characters (I could put this in the `sed` for exactly the same bytecount, but then it doesn't handle the linefeed character correctly, since `sed` leaves them in and `dc` only gets up to the first linefeed with `?`)

`sed` takes the rest and builds a `dc` program:

Strings of `;` become strings of `1` (a long literal)

`#` becomes `.ZC7%P` (if this follows a string of `1`, the `.` is a decimal point for a no-op. But if it's at the beginning of the program, or following another `#`, it's a literal `0`. Then it takes the length of the number, mods it, and Prints the corresponding ASCII.)
> 3 votes

# Answer
# asm2bf, 74 bytes

Try it online!

Golfed code:

```
@l
in r1
ceqr1,.;
cadr2,1
ceqr1,.#
cjz%d
modr2,127
outr2
clrr2
@d
jnzr1,%l

```

Commented code:

```
; Wrap everything in a loop.
@l
; Read a character from stdin.
    in  r1
; if r1 = ';', set the condition flag.
    ceq r1,.;
; if condition flag is set, add 1 to r2
; r2 is used as an accumulator.
    cad r2,1
; if r1 = '#', set the condition flag.
    ceq r1,.#
; if condition flag is not set, jump to d
    cjz %d
; display acc%127 and clear it.
    mod r2,127
    out r2
    clr r2
@d
; loop if didn't hit an EOF
    jnz r1, %l

```
> 3 votes

# Answer
# Add++, 31 bytes

```
D,g,@,59C€=Bs127%
L^,"#"$t€gbUp

```

Try it online!

## How it works

```
D,g,@,		; Define a helper function g that takes one argument, S
	59C	; Push a ';' character
	€=	; Over each character in S, is it ';'?
	Bs	; Sum
	127%	; Mod 127

L^,		; Define the main lambda with one argument, P
		; The ^ flag tells the output to convert numbers to code points and concatenate
	"#"	; Push a '#' character
	$t	; Split P on '#' characters
	€g	; Run g over each section
	bU	; Splat to the stack
	p	; Remove the last one

```
> 3 votes

# Answer
# Vim, ~~<sup>58</sup>~~ 68 bytes

*@cairdcoinheringaahing and @kops pointed out a few issues, +10 bytes to fix them.*

```
:%j
:s/[^;#]//g
:s/#/x/g
A <Esc>^qqcfx<C-r>=nr2char(len("<C-r>"<BS>")%127)
<Esc>l@qq@qD

```

Try it online!

Explanation:

```
:%j                                                # Delete all newlines
:s/[^;#]//g                                        # Delete all unnecessary characters
:s/#/x/g                                           # Replace all '#' with 'x'
A <Esc>^                                           # Append ' ' to the line
        qq                                         # Define macro q:
          cfx                                      #   Cut from here through next 'x'
             <C-r>=nr2char(len("<C-r>"<BS>")%127)  #   Convert (length_of_the_cut_string % 127) to a character
<Esc>l                                             #   Exit insert mode and move to next ';'
      @q                                           #   Call macro q
        q@q                                        # End the macro and run it
           D                                       # Delete any remaining characters

```
> 3 votes

# Answer
# Subleq, ~~29~~ 18 binary words

*-11 from various changes explained below*

```
-1 35 -1
1 35 12
0 28 9
35 35 0
28 -1 15
28 28 9

```

## Changes

```
Old       New
-1 25 3  | -1 35 -1 'combined first two line to read character and exit if null;
24 25 -1 |          'changed address to 35 so it could be used for the comparison to "#"
26 25 15 | 1 35 12  'changed addresses of data and comparison
27 28 12 | 0 28 9   'increment 28: using 0: instead of another address containing -1
25 25 0  | 35 35 0  'changed address from 25 to 35
28 -1 18 | 28 -1 15 'no changes except for address in the 3rd argument (which isn't used)
28 28 21 | 28 28 9  'changed to goto line that sets 35: = 0 to eliminate duplicate next line
25 25 0  |          'deleted
0 0 35 -1 0 |       'eliminated initialization data because the two non-zero items are
                    'elsewhere and 0 values (28: and 35:) do not need to be initialized

```

## Original

```
-1 25 3
24 25 -1
26 25 15
27 28 12
25 25 0
28 -1 18
28 28 21
25 25 0
0 0 35 -1 0

```

## Explanation

```
-1 25 3     ' move next char in input to 25:
24 25 -1    ' 25: = 25: - 24:(0) if 25: <= 0 exit (if input empty exit)
26 25 15    ' 25: = 25: - 26:(35) if 25: <= 0 goto 15: (if input = "#" goto 15)
27 28 12    ' increment 28: by 1
25 25 0     ' 25: = 0 goto 0
28 -1 18    ' output 28:
28 28 21    ' 28: = 0
25 25 0     ' 25: = 0 goto  0
0 0 35 -1 0 ' values for 24: - 28:

```

Subleq emulator
> 3 votes

# Answer
# C, 96 bytes

This is my first golf attempt!

```
i;a;main(z,s)char**s;{while(s[1][i])switch(s[1][i++]){case 35:putchar(a%127);a=-1;case 59:++a;}}

```
> 3 votes

# Answer
## C#, ~~110~~ ~~108~~ ~~103~~ ~~101~~ 98 bytes

-2 bytes by removing braces, where unnecessary

-5 bytes by removing else, from else if

-2 bytes, thanks to TheLethalCoder

-3 bytes, thanks to Andrew Piliser

```
a=>{var b=0;var d="";foreach(var c in a){if(c==59)b++;if(c==35){d+=(char)(b%127);b=0;}}return d;};

```

Anonymous function, returns the output.
> 2 votes

# Answer
## QBIC, ~~48~~ ~~66~~ 57 bytes

```
[_l;||D=_sA,a,1|┘b=b-(D=@;`)~D=@#`|b=b%127?chr$(b)';`┘b=0

```

Explanation:

```
[    |           FOR
 _l;|              the length of the cmd line arg A$
 D=_sA,a,1|      Take the next character out of the string as D$
┘                Syntactic linebreak
b=b-(D=@;`)      If D$ == ";", this yields -1. Subtracting this from ACC reverses the sign
~D=@#`|          And if D$ == "#"
b=b%127          Do the Modulo-print thingy
?chr$(b)';`
┘b=0             And reset the acc

```
> 2 votes

# Answer
# JavaScript (ES6), ~~91~~ 85 bytes

ETH beat me to the punch with a variation on the Japt solution I was working on (that'll learn me to check the answers first!) so here's the JS solution I was using as the basis for it:

```
s=>s.split`#`.slice(0,-1).map(x=>String.fromCharCode(--x.split`;`.length%127)).join``

```

---

## Try it

```
f=
s=>s.split`#`.slice(0,-1).map(x=>String.fromCharCode(--x.split`;`.length%127)).join``
oninput=_=>o.innerText=f(i.value)
o.innerText=f(i.value=";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;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|-#';#:_@
^   >$' %,

```

Try it online!

Note that the input is terminated with a null byte and there is an unprintable (ASCII 127) on the third line after `'`
> 2 votes

# Answer
# Perl 6, 49 bytes

```
{S:g/(<-[#]>*)(\#)?/{chr($0.comb(';')%127)x?$1}/}

```
> 2 votes

# Answer
# Go, ~~104~~ 102 bytes

Yeeeeaaaaaaaaaah, Go.

```
import."fmt"
func f(c string){i:=0;for _,r:=range c{if';'==r{i++};if'#'==r{Print(string(i%127));i=0}}}

```

Try it online!
> 2 votes

# Answer
# C (gcc), 66 bytes

```
a;f(char*c){for(a=0;*c;a+=*c==59,a=*c++==35&&putchar(a%127)?0:a);}

```

Try it online!
> 2 votes

# Answer
# PowerShell, ~~67~~ 65

```
-join$(switch("$input"|% t*y){';'{$a++}'#'{[char]($a%127);$a=0}})

```

Fairly straightforward with not many surprising twists.

* 2018-09-06: Shorter way of converting the string to a character array.
> 2 votes

# Answer
## R, 66 bytes

```
intToUtf8(nchar(gsub("[^;]","",el(strsplit(scan(,""),"#"))))%%127)

```

Test:

```
> intToUtf8(nchar(gsub("[^;]","",el(strsplit(scan(,""),"#"))))%%127)
1: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;... <truncated>
2:
Read 1 item
[1] "Hello, World!"

```
> 2 votes

# Answer
# Pyth, 16 bytes

```
smC%/d\;127Pcw\#

```

Try it!

### explanation

```
smC%/d\;127Pcw\#
            cw\#    ## split the input on '#'
           P        ## remove the last element (everything after the last #)
 m                  ## map over this list of strings (variable: d)
    /d\;            ## count the semicolons
   %    127         ## modulo 127
  C                 ## the character with that number
s                   ## concat the list of characters

```

imperative version I did for fun: `J0FHwIqH\;=+J1)IqH\#pC%J127=J0`
> 2 votes

# Answer
# Cubix, 53 bytes

```
#..Wc.@n.!0i?\?;u...'u;.'\.U;.\w;;U.;).;'%o;c;.!;.U;

```

Contains one non-printable character, `DEL`, which is ASCII 127. If the accumulator is 0 and an ignored character is read in, an additional 0 is added to the stack so this runs the risk of stack overflow.

Try it online! and Watch it online

Cubified:

```
      # . .
      W c .
      @ n .
! 0 i ? \ ? ; u . . . '
u ; . ' \ . U ; . \ w ;
; U . ; ) . ; '   % o ;
      c ; .
      ! ; .
      U ; .

```
> 2 votes

# Answer
# Chip, 179 bytes

```
 HGFEDCB
,\\///\/A
`--v~.
   |z^.
 ,\#xZ<
a^xx/'`.
 ,\#xZ~<
b^xx/' |
 ,\#xZ~<
c^xx/' |
 ,\#xZ~<
d^xx/' |
 ,\#xZ~<
e^xx/' |
 ,\#xZ~<
f^xx/' |
 ,\#xZ~'
g^x-/'HGFEDCB
S÷^---\\/\\\/A

```

<sup>(UTF8, so `÷` is `\xc3\xb7`)</sup>

Try it online!

The upper block with `A`-`H` and the slashes is detecting the semicolon character, and the similar lower block is detecting the hash. If other bogus characters needn't be handled, the whole thing would be somewhere around 133 bytes.

The middle block does the following:

`Z`'s are the registers, one for each of the seven bits.

The half-adders `#` allow for incrementing by 1 in case of a semicolon. If not a semicolon, increment by 0.

If we get a hash, send the current register values to `a`-`g`, which outputs the desired character, and then reset the values to zero with the switches `\`.

If the registers are `0b1111110` (126), as determined by the right two columns, the next increment results in zero due to the switches `/`.
> 2 votes

# Answer
# Common Lisp, 89 bytes

```
(do((a 0))(())(case(read-char)(#\;(incf a))(#\#(princ(code-char(mod a 127)))(setf a 0))))

```

Try it online!.

This is an actual interpreter.
> 2 votes

# Answer
# SNOBOL4 (CSNOBOL4), ~~182~~ 167 bytes

```
	S =INPUT
R	S NOTANY(';#') =	:S(R)
K	K =
T	S LEN(1) . C REM . S	:F(O)
	K =IDENT(C,';') K + 1	:S(T)
	&ALPHABET LEN(REMDR(K,127)) LEN(1) . A
	Y =Y A	:(K)
O	OUTPUT =Y
END

```

Try it online!

Due to size limitations in this implementation of SNOBOL, it can only read in lines of 1024 characters at a time, discarding the rest. So it only manages to print `Hello, Worl`. Ah well.

```
	S =INPUT				;*read input
R	S NOTANY(';#') =Y	:S(R)		;*recursively remove non ;# characters
K	K =0					;*counter
T	EQ(SIZE(S)) :S(O)			;*if string is empty, goto output
	S LEN(1) . C REM . S			;*set C to the first char, the REMainder to S
	K =IDENT(C,';') K + 1	:S(T)		;*if C is identical to ';', increment C and goto T
	&ALPHABET LEN(REMDR(K,127)) LEN(1) . A	;*get the K % 127th character, set it to A
	Y =Y A	:(K)				;*append A to Y
O	OUTPUT =Y				;*output Y
END

```
> 2 votes

# Answer
# Haskell, 70 bytes

(-7 thanks to BWO)

```
n#(o:p)|o==';'=(n+1)#p|o=='#'=toEnum(mod n 127):0#p|1>0=n#p
_#p=p
(0#)

```

Try it online!
> 2 votes

# Answer
# Haskell, 66 bytes

```
f s|(a,_:b)<-span(/='#')s=toEnum(mod(sum[1|';'<-a])127):f b|1<3=[]

```

Try it online!

* `f` takes a string `s` as input and looks for the first `#` with `(a,_:b)<-span(/='#')s`, which splits `s` in the part `a` before the first `#` and `b` everything after.
* `sum[1|';'<-a]` counts the number of `;` in `a` which is converted into the corresponding character by `toEnum` after taking it modulo 127.
* `f b` recursively processes the rest of the string.
* The pattern match `(a,_:b)<-span(/='#')s` fails if no `#` exists anymore, in which case in the second pattern guard `1<3=[]` the empty list is returned.
> 2 votes

# Answer
# Julia 1.0, ~~90~~ 62 bytes

```
i(s)=print.(Char.(count.(==(';'),split(s,"#")[1:end-1]).%127))

```

Try it online!
> 2 votes

# Answer
# F# (.NET Core), 71 bytes

```
Seq.fold(fun a->function|';'->a+1|'#'->printf"%c"(a%127|>char);0|_->a)0

```

Try it online!
> 2 votes

# Answer
# Shakespeare Programming Language, ~~447~~ ~~439~~ 404 bytes

```
,.Ajax,.Ford,.Act I:.Scene I:.[Exeunt][Enter Ajax and Ford]Ajax:Open mind.Ford:Am I as big as the sum ofa pig twice twice the sum ofa pig a big big big big cat?If soyou be the sum ofyou a cat.Be you worse the sum ofa pig twice the cube ofa big big cat?If notyou zero.Am I as big as the sum ofa cat twice the sum ofa cat a big big big big cat?If soSpeak thy.If soYou zero.Am I nicer zero?If soLet usAct I.

```

Try it online!

*-35 bytes thanks to Joe King!*
> 2 votes

# Answer
# Stax, 12 bytes

```
î╟°♪ƒ▌○«*G<╠

```

Run and debug it
> 2 votes

# Answer
# APL, 41 bytes/chars

```
{⎕AV[⍋⎕NXLATE 0][127|≢¨⌽⊂⍨⌽2=⍵(⊢⍳∩)';#']}

```

Explanation:

vector of ASCII characters

```
{⎕AV[⍋⎕NXLATE 0]                          }

```

select elements from that vector

```
{                 [                         ]}

```

keep only characters from the stream belonging to the set ';#'

```
{                 [               ⍵(  ∩)';#']}

```

find position of each character of the stream in the set ';#'

```
{                 [               ⍵(⊢⍳ )';#']}

```

0 where there's ';' and 1 where there's '#'

```
{                 [             2=          ]}

```

reverse the stream, partition beginning at every 1, reverse back; note that trailing ';'s get discarded this way

```
{                 [       ⌽⊂⍨⌽            ]}

```

length of each partition modulo 127

```
{                 [127|≢¨                   ]}

```
> 2 votes

# Answer
# JavaScript (V8), 77 bytes

```
p=>([...p].map(e=>e==';'?i++:(s+=String.fromCharCode(i%127),i=0),i=0,s=''),s)

```

Try it online!

# JavaScript (V8), 77 bytes

```
p=>([...p].map(e=>i+=e==';'?1:(s+=String.fromCharCode(i%127),-i),i=0,s=''),s)

```

Try it online!
> 2 votes

# Answer
# Keg, `-ir`, `-lp`, 18 bytes

```
0&(¦\;⑹|\#⑻\ø%,0⑾™

```

Try it online!
> 2 votes

# Answer
# VBScript, 109 bytes

```
a=0
For i=0 to len(s)
x=Mid(s,i,1)
if x=";" then a=a+1
if x="#" then wscript.stdout.write chr(a mod 127)
next

```
> 2 votes

# Answer
# C (gcc), ~~72~~ 67 bytes

*-5 thanks to @ceilingcat*

```
a;main(i){for(;i=getchar()-10;a=i-49?i-25?a:0*putchar(a%127):a+1);}

```

Try it online!

Took longer than I should have for this one.
> 2 votes

# Answer
# GNU AWK, 43 bytes

```
BEGIN{FS=";";RS="#"}RT{printf"%c",NF-1%127}

```

Try it online!

A different approach to this answer, golfing 14 bytes. Works only on GNU AWK (gawk).

```
BEGIN{FS=";";RS="#"}    ; are fields' and # are records' separators

RT{                     This skips the last ; sequence without a #
   printf"%c",NF-1%127  Prints the number of fields (i.e., semicolons) minus 1,
  }                     converted to ASCII, of course

```
> 2 votes

# Answer
# Lua, 95 bytes

```
s=...n=0load(s:gsub('[^#;]',''):gsub('.',{[';']='n=n+1',['#']='io.write(s.char(n%127))n=0'}))()

```

Try it online!

Removes all non `#` or `;` characters, replaces the remaining characters with their respective Lua instructions, and then runs it.
> 2 votes

# Answer
# PHP, ~~84 79 70~~ 1 + 63 = 64 bytes

```
for(;$c=$argn[$i++];$a+=$c==";")$c^A^R||$a=~-print chr($a%127);

```

Run as pipe with `-nR`

Try it online!
> 1 votes

# Answer
# PHP, 61 Bytes

```
for(;~$c=a^$argn[$i++];)$n+=$c^r?$c==Z:-$n*print chr($n%127);

```

Try it online!

# PHP, 68 Bytes

```
for(;a&$c=$argn[$i++];)$c!=";"?$c!="#"?:$n=1-print chr($n%127):++$n;

```

Try it online!
> 1 votes

# Answer
# C, ~~74~~ ~~72~~ 70 bytes

```
a;f(char*s){for(;*s;s++){if(*s==59)a++;if(*s==35)putchar(a%127),a=0;}}

```

Test cases:

```
Output: Hello, World!
f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;###ffh#h#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ffea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o");

Output: !
f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#");

```
> 1 votes

# Answer
# shortC, 51 bytes

```
a;f(C*s){O;*s;s++){F*s==59)a++;F*s==35)Pa%127),a=0;

```
> 1 votes

# Answer
# , 29 bytes

```
[:u:127|[:+/"1[:';'&=;.1'#',]

```

Try it online!
> 1 votes

# Answer
# C, ~~56~~ 54 bytes

```
a;f(char*s){a+=*s-35?*s==59:-putch(a%127);*s&&f(s+1);}

```

Solution is based on Dennis's one ("C (gcc), 58 bytes"), but with elimination of two characters `a=`

Two more symbols can be taken off with substitution `putchar` with `putch`
> 1 votes

# Answer
# Cheddar, 57 bytes

```
@.split("#").head(-1).map(s->@"(s.count(";")%127)).join()

```

Try it online!
> 1 votes

# Answer
# Aceto, ~~38~~ 31 bytes

The program reads and processes one character at a time, so it will work with infinite ;# programs. Run with `-F` if you want immediate results (because buffering), but it works without it if the program is long enough.

```
  Ox%-12
  =_cpF7
d'#'O
,;=|xIO

```

`,` reads a character. We duplicate it and compare it with `;`. If it's equal, we mirror to the right side (`=|`), drop (`x`) the duplicate, `I`ncrement the value on the stack (implicitly zero), and go back to the `O`rigin.

If it's not equal, we compare the copy with `#`. If that is equal, we mirror upwards (`=_`; somewhere in empty space above, but the next non-nop we read will be the `2`). We push a `2` and a `7`, compute 2^7 (`F`), and substract 1 (`1-`). We then do a modulo operation (`%`) convert it to a `c`haracter, `p`rint it (without a newline) and go back to the `O`rigin.

If it's none of those characters, we drop the value on the stack (`x`) and go back to the `O`rigin.
> 1 votes

# Answer
# Gema, 63 characters

```
\A=@set{a;0}
\;=@incr{a}
\#=@int-char{@mod{$a;127}}@set{a;0}
?=

```

Sample run:

```
bash-4.4$ gema '\A=@set{a;0};\;=@incr{a};\#=@int-char{@mod{$a;127}}@set{a;0};?=' < '2d{.;#' | od -tad1
0000000    2  etb    d  nul  nul  nul  nul    {  nul  nul  nul
          50   23  100    0    0    0    0  123    0    0    0
0000013

```
> 1 votes

# Answer
## Clojure, 71 bytes

```
#(for[i(re-seq #"[^#]*#"%)](print(char(mod(count(filter #{\;}i))127))))

```

Splits into chunks by regex, counts how many `;`s there are in each chunk.
> 1 votes

# Answer
# Haxe, ~~145~~ 136 bytes

```
function(s){var a=0;for(i in 0...s.length){var c=s.charAt(i);if(c==';')a++;else if(c=='#'){Sys.print(String.fromCharCode(a%127));a=0;}}}

```

*-9 bytes thanks to Haxe's "inline function" (lambda) feature*

Don't think I've ever seen an answer given in Haxe before, probably because it's not very golfy, and not that well known.

The code's really quite self-explanatory, here's the un-golfed version:

```
function(s) {
    var a=0;
    for(i in 0...s.length) {
        var c=s.charAt(i);
        if(c==';') {
            a++;
        }
        else if(c=='#') {
            Sys.print(String.fromCharCode(a%127));
            a=0;
        }
    }
}

```
> 1 votes

# Answer
# Rust, 109 bytes

Rust was not created for golfing...

```
fn f(s:&str){let mut a=0u8;for c in s.chars(){if c==';'{a+=1;}if c=='#'{a%=127;print!("{}",a as char);a=0;}}}

```
> 1 votes

# Answer
# Rip, 33 chars

```
0gDiW[D';EI[Pi0]'#EI[27pdMo0]gDi]

```

Got around to testing this, and this works with the given examples.
> 1 votes

# Answer
# jq, 54 characters

(49 characters code + 5 characters command line options)

```
[scan(".*?#")|gsub("[^;]";"")|length%127]|implode

```

Sample run:

```
bash-4.4$ jq -Rrj '[scan(".*?#")|gsub("[^;]";"")|length%127]|implode' < '2d{.;#' | od -tad1
0000000    2  etb    d  nul  nul  nul  nul    {  nul  nul  nul
          50   23  100    0    0    0    0  123    0    0    0
0000013

```

On-line test
> 1 votes

# Answer
## Mathematica, 81 bytes

```
StringReplace[a=0;#,{";":>(a++;""),"#":>FromCharacterCode@Mod[a,a=0;127],_:>""}]&

```

Pure function expecting a string argument.

## Explanation

The basic evaluation procedure (it can be more complicated) for an expression in Mathematica is to evaluate the head of the epxression, then evaluate each of its arguments in order, then apply any definitions, then evaluate the entire expression again until nothing changes.

So first we evaluate `StringReplace` (no-op). The first argument is `a=0;#`, which sets the accumulator `a` to 0 and returns the first argument (denoted `#`) to the function. The second argument is a list of string replacement rules, which are applied in order starting at the beginning of the string.

If we encounter the substring `";"`, we replace it with `(a++;"")`. Since we used `:>` instead of `->`, this replacement expression is only evaluated whenever we actually find a match for `";"`. It (post-)increments `a` and returns the empty string, so finding a match for `";"` effectively increments the accumulator and deletes the semicolon. In the case of a match, we move to the next position in the string, otherwise we check the next rule in the list.

If we encounter the substring `"#"`, we replace it with `FromCharacterCode@Mod[a,a=0;127]`. `FromCharacterCode` does what you expect, but `Mod[a,a=0;127]` can be tricky if you don't understand Mathematica's evaluation procedure. We evaluate `Mod` (no-op), then evaluate the first argument `a` to get the value of the accumulator. When we evaluate the second argument `a=0;127`, we reset the accumulator to `0` and return `127`. Thus we end up with `Mod[<a>,127]`, where `<a>` is whatever the value of `a` was before the expression started evaluating. The only way I can think of to get this to work by resetting the accumulator after calculating the modulus without introducing additional variables is something like `"#":>Reap[Sow[FromCharacterCode[Mod[a,127]]];a=0][[2,1,1]]`. Introducing another variable I could do something like `"#":>(b=a;a=0;FromCharacterCode[b~Mod~127])`.

If we reach the last replacement rule, we replace any single character `_` with the empty string `""`.
> 1 votes

# Answer
# C# ~~75~~72 + 18 = ~~93~~90 Bytes

```
using System.Linq;
s=>string.Join("",s.Split('#').Select(p=>(char)(p.Count(c=>c==59)%127)))

```

-3 Bytes thanks to @Charlie

### Ungolfed full program with test cases

```
using System.Linq;

class P
{
    static void Main()
    {
        System.Func<string, string> f =
            s => string.Join("",                  //6. Combine results with empty string as separator
                s.Split('#')                      //1. Split the input by #
                    .Select(                      //2. For each part
                        p => (char)(              //5. Convert to character
                            p.Count(c => c == 59) //3. Count of all ;
                            % 127)                //4. Mod 127
                    ));

        System.Console.WriteLine(f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;###ffh#h#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ffea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o"));
        System.Console.WriteLine(f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#"));
    }
}

```
> 1 votes

# Answer
# Proton, 66 bytes

```
a=>''.join(map(len+((%)&127)+chr,a.rstrip(';').split('\#'))[to-1])

```

Try it online!
> 1 votes

# Answer
# Bash \+ coreutils + dc, 93 bytes

```
tr ';#' '69'|tr -dc '69'|dc -e '?0sa[10~rdZ1<P]dsPx[6=Ala127%P0sa]sR[la1+saq]sA[lRxz0<M]dsMx'

```

Try it online!

First time submitting a multi-utility answer, so if I botched that let me know - but just treating it as bash seems the least generous in terms of byte count anyway.

I thought this would be fun to do in `dc`, but obviously `dc` does not really care for strings, so the first thing to do was use `tr` to translate it into a new dialect, `69` which is just `;#` only... well, sixes and nines. After doing that, we also use `tr` to delete everything that isn't a 6 or a 9 so that we don't have to account for errant characters in `dc`.

With a giant number input into `dc`, we can make an interpreter. `0sa` clears the accumulator, `a`. `[10~rdZ1<P]dsPx` uses the divide-returning-both-quotient-and-remainder command, `~` to break our big number into a stack full of individual commands. Jump to the end, the main macro `[lRxz0<M]dsMx` executes macro `R` until the stack is empty. Macro `R` is `[6=Ala127%P0sa]sR`, which tests if the top-of-stack is a 6 and runs macro `A` if so. Macro `A` has a `q`uit command in it, which essentially makes the rest of `R` an else statement. This does the mod 127, `P`rint ASCII, and reset accumulator `a` to zero operations. Meanwhile, macro `A` is just a simple increment operation for the accumulator: `[la1+saq]sA`.

You can try just the dc portion online!
> 1 votes

# Answer
# Gol\>\<\>, ~~20~~ 18 bytes

Credit to Jo King.

```
iE;:`#=q$o`;=+`~P%

```

Try it online!

### How it works

```
iE;:`#=q$o`;=+`~P%
                    Accumulator (m) is stored at the bottom
iE;                 Take input (n) as char; halt if EOF
   :`#=q            If n == '#'... (preserving n on the top)
        $o            Output m as char, discarding it
          `;=+      If n == ';', increment m
              `~P%  m = m % 127
                    Repeat indefinitely

```

## Previous submission, 20 bytes

```
iE;:`#=Q$`~P%o|`;=?P

```

Try it online!

### How it works

```
iE;:`#=Q$`~P%o|`;=?P

                      Accumulator (m) is always stored at the bottom
iE;                   Take input (n) as char, halt if EOF
   :`#=Q      |       If n == '#'... (preserving n on the top)
        $`~P%o        Swap m to the top, output m%127 as char
               `;=?   If n == ';'... (discarding n; m is exposed to the top)
                   P  Increment m
                      Repeat indefinitely

```
> 1 votes

# Answer
# Coconut, 59 bytes

```
t->''.join(map(x->chr(x.count(';')%127),t.split('#')[:-1]))

```

Try it online!
> 1 votes

# Answer
# brainfuck, 201 bytes

```
+[>>,[>+>+<<-]>>>----[>+<----]>----[-<<->>]+<<[>>-<<[-]]>>[-<<<[-]<<+[->>+>+<<<]>>>>>--[<+>--]<[-<->]<[[-]<[->>+<<]>][-]<[-]>>[-<<<<+>>>>]>]<<<[>--[>--<+++++++]>-[<+>-]<[-<->]<[[-]-]+[[-]<<.[-]>>]]<<<]

```

Try it online! As a note, this will take 60 seconds to finish because the program will never halt, so it will stop after the Tio 60 second timeout.

### How it works

This works differently than the given algorithm. Instead of using mod it just wraps to 0 after counting 127 semicolons.

```
+[                              'while true
    >>,                         'read input
    [>+>+<<-]
    >>>----[>+<----]>----
    [-<<->>]+<<[>>-<<[-]]>>     'if(input == ';')
    [
        -<<<[-]<<+              'increment counter
        [->>+>+<<<]
        >>>>>--[<+>--]<
        [-<->]
        <[                      'if(counter == 127) counter = 0
            [-]<[->>+<<]>
        ]
        [-]<[-]
        >>[-<<<<+>>>>]>
    ]
    <<<[                        'if(input != 59)
        >--[>--<+++++++]>-
        [<+>-]
        <[-<->]
        <[                      'if(input == '#')
            [-]-
        ]
        +[
            [-]
            <<.[-]>>            'print counter as ascii and clear tape
        ]
    ]
    <<<
]

```
> 1 votes

# Answer
# Powershell, 67 bytes

See also Joey's answer

```
-join($args-split'#|[^#]*$'|%{[char]((($_-split';').Count-1)%127)})

```

Test script:

```
$f = {

    -join($args-split'#|[^#]*$'|%{[char]((($_-split';').Count-1)%127)})

}

$c00 = [char]0x0000
$c23 = [char]0x0017

@(
    ,($c00,'#')
    ,('',';;;;;;')
    ,("2$($c23)d$c00$c00$c00$c00{$c00$c00$($c00)",';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hafh;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;f;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#')
    ,(';#', ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#')
    ,('!', ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#')
) | %{
    $e,$s = $_
    $r = &$f $s
    "$($e-eq$r): $r"
}

```

Output:

```
True:
True:
True: 2d    {
True: Hello, World!
True: ;#
True: !

```

Explanation:

```
-join(                                   #
    $args-split'#|[^#]*$'|%{             # extract strings tailed by # symbol from arguments
        [char](                          #
            (($_-split';').Count-1)%127  # count ; symbol in each extracted string, get remain by 127
        )                                # convert int to char
    }                                    #
)                                        # join all chars

```
> 1 votes

# Answer
# Backhand, 37 bytes

```
}>_oi!{:0v] @! |{^:v-"%";"#""-"|{]~.

```

Try it online!

As usual with Backhand programs, I'm pretty sure this could be golfed further, but to do so would require some restructuring.

### Explanation

Note that by default the pointer moves three steps at a time

```
}>                 Start on the second character
    i  :  ]  ! |{  Get input and check if it is EOF
            @      Reflect and terminate if so
                  :  "  ;  "  - |{     Check if the character is a ;
                                   ~.  If so, pop the extra copy of the character
                      %  "    "  [    Increment by 1 and modulo by 127
                 ^ v    Decrement the pointer step value by one and then increment it again to skip the |{
 >_  !  0  And restart the loop
                                |      If it is not a ;, reflect
                    -  "  #  "         Check if it is a #
         v   !   ^   Increment pointer and decrement again
}>_o  !{    Output if the character was a # and restart the loop

```
> 1 votes

# Answer
# JavaScript (Node.js), 86 bytes

```
s=>[...s].map(e=>e==";"?++i:e=="#"?z+=String.fromCharCode(i%127,i=0)[0]:0,i=0,z="")&&z

```

Try it online!
> 1 votes

# Answer
# CJam, 18 bytes

```
q'#/{';e=127%c}%);

```

Try it online!

## Explanation

```
q                  "Take the whole input as a single string";
 '#/               "Split the input string with hashes";
                   "This counts the empty results";
                   "According to the challenge empty results can only be";
                   "generated from trailing #'s";
    {         }%   "Map every ; sequence in the string:";
     ';e=          "Count the semicolons"
         127%      "Find the remainder of the length w/ 127";
             c     "Convert to a character"
                ); "There is a trailing null string designed for this check";
                   "If there isn't a trailing null string (i.e.)";
                   "program doesn't end with #, this removes the last item of the list";
                   "Implicit flatten the list & print as string";

```
> 1 votes

# Answer
# C# (Visual C# Interactive Compiler), 66 bytes

```
s=>s.Split('#').Select(x=>(char)(x.Count(y=>y==59)%127)).ToArray()

```

Try it online!
> 1 votes

# Answer
# Packed Pyth, 14 bytes

Hex dump: `AD 43 1F 7B` `88 F8 43 4A` `BE 75 C7 6C` `59 37`

Try it online!

# Pyth, 16 bytes

```
VPcw\#pC%/N\;127

```

Try it online!

Python equivalent:

```
for N in input().split('#')[:-1]:
    print(end=chr(N.count(';') % 127))

```

Token by token explanation:

```
VPcw\#pC%/N\;127
V                 # for N in                        :
   w              #          input()                      # take one line of input
  c \#            #                 .split('#')
 P                #                            [:-1]      # discard last element
          N       #                N
         / \;     #                 .count(';')
        %    127  #                             % 127
       C          #            chr(                  )
      p           #  print(end=                       )   # print without trailing newline

```

After doing this, I looked at the other Pyth answers and found that KarlKastor's also got 16 bytes. However, I believe my answer is more correct, as it does not print a trailing newline. Since every `;;;;;;;;;;#` in the input results in outputting a newline, an extra one should not be added at the end.

Funnily enough, we also both made an imperative version. Mine comes in at **25 bytes**:

```
VwIqN\;=%hZ127)IqN\#pC~Z0

```

Try it online!

Python equivalent:

```
Z=0
for N in input():
    if N==';': Z = (Z % 127) + 1
    if N=='#': print(end=chr(Z)); Z=0

```
> 1 votes

# Answer
# Burlesque, 19 bytes

```
'#;;{';CN127.%L[}\m

```

Try it online!

```
'#;;     # Split strings at #s
{
 ';CN    # Count the number of ; in each
  127.%  # Mod 127
  L[     # Convert to char
}\m      # Map and concatenate

```
> 1 votes

# Answer
# PHP, ~~56~~ 75 bytes

```
foreach(explode('#',$argn,-1)as$c)echo chr((count_chars($c,1)[59]??0)%127);

```

Try it online!

Thanks to @Umbrella for the nudge. Actually read the question and bug fixed.
> 1 votes

# Answer
# Prolog (SWI), 104 bytes

It worked out to be shorter to write directly to stdout inside the predicate. The more idiomatic way of implementing something like this in Prolog would be to have third parameter for the predicate which would be the output from interpreting the program.

```
+A:-string_codes(A,B),0+B.
A+[E|T]:-E=35,!,C is A mod 127,put_code(C),0+T;E=59,!,B is A+1,B+T;A+T.
_+[].

```

Try it online!
> 1 votes

# Answer
# Ral, 136 bytes

```
,:1-11:+:+:+:++:+:+:+?:11:+:+:+:+-:+:+1-+:0?10*+0=1+0?10*-0=111:+:+:+:++:++-:0?0-0?0*:1:+:+:+:+:+:+:+1-+:1+1111:+:++:+:++:+:++?1=.00=10?

```

Try it online!

**Somewhat clarified**

```
Code                         Stack after       Description
,:1-11:+:+:+:++:+:+:+?       n                 Input a character (n) and jump to the end if zero
:11:+:+:+:+-:+:+1-+:0?       n, n-59           Jump to the start if n>59
10*+0=                       n, n-59           Add 1 to the accumulator
1+0?                         n                 Jump to the start if n>58
10*-0=                       n                 Remove 1 from the accumulator
111:+:+:+:++:++-:0?          35-n              Jump to the start if n<35
0-0?                                           Jump to the start if n>35
0*                           acc               Load the accumulator from memory
:1:+:+:+:+:+:+:+1-+          acc, acc-127          Remove 127 from the accumulator
:1+1111:+:++:+:++:+:++?      acc, acc-127          Continue the loop (with acc=acc-127) if acc≥127
1=.                                            Print the accumulator
00=                                            Clear the accumulator
10?                                            Jump to the start

```
> 1 votes

# Answer
# , ~~79~~ 76 bytes

*Edit: -3 bytes thanks to Giuseppe*

```
intToUtf8((attr(el(gregexpr(";*#",gsub("[^;#]","",scan(,"")))),"m")-1)%%127)

```

Try it online!

First deletes all non-`;#` characters from the input, then searches for the regex `;*#`, which finds runs of `;` characters followed by a `#` character. The `match.length` attribute of this (retrieved using 'm' for short) indicates the number of matched characters, of which the last one must be the `#`, and all the previous ones `;`s. So we subtract one and convert to utf8 characters.
> 1 votes

# Answer
# ThumbGolf, 24 bytes

Hexdump (little endian):

```
293b bf08 1c40 2923 d103 dec3 007f de10
2000 de19 d0f4 4770

```

The program starts 16 bytes in at the `2000`.

Commented assembly:

```
        // Include the ThumbGolf wrapper macros
        .include "thumbgolf.inc"
        // main starts below
.Lloop:
        // first check for semicolon
        cmp     r1, #';'
        // if equal, increment the accumulator
        it      eq
        addeq   r0, r0, #1
        // now check for hash
        cmp     r1, #'#'
        // skip if not equal (ThumbGolf doesn't work in IT blocks, unfortunately)
        bne     .Lnoprint
.Lprint:
        // modulo accumulator by 127
        umodi   r0, r0, 127
        // print accumulator
        putc    r0
        // -- fallthrough --
        // start here because why not (both print and entry need to reset the
        // accumulator, so it is convenient to do it here)
        .globl main
        .thumb_func
main:
        // reset accumulator to zero
        movs    r0, #0
.Lnoprint:
        // read next char into r1, sets zero flag on success
        getc    r1
        // if successful, continue interpreting
        beq     .Lloop
        // else return
        bx      lr

```

I actually found a bug in my recent refactor of ThumbGolf with this code.

When I executed `getc`, the illegal handler would trigger as normal, *then trigger on the next instruction*. After 2 hours fiddling with it, I realized that when switching the CPSR to use a nice bitfield struct, I forgot to account for some unused bits. This caused me to set the `IT_D` flag instead of the `Z` flag, putting the processor in a bad IT state, causing the crash.
> 1 votes

# Answer
# Pxem, 0 bytes (for content) + 50 bytes (for filename).

* Filename (unprintables are escaped): `M\177.w.i.c;.-\001.y.s\001.+;;;.a.c#.-\001.y.s\177.%.o###\177.a\001.+.a`
* Content is empty.

## Usage

* Full program.
* I/O with stdin and stdout.
* Accepts one program at once.

## With comments

```
XX.z
# let counter is 127
.aM\177XX.z
# loop
.a.wXX.z
  # c = getchar()
  .a.iXX.z
  # increment here
  .a.c;.-\001.y.s\001.+;;;.aXX.z
  # output and reset here
  .a.c#.-\001.y.s\177.%.o###\177.aXX.z
# break if c is EOF
.a\001.+.a

```

Try it online!
> 1 votes

# Answer
# Racket, 122 bytes

```
(let([n 0])(for([i s])(cond[(eq? i #\;)(set! n(+ 1 n))][(eq? i #\#)(display(integer->char(remainder n 127)))(set! n 0)])))

```

Try it online!
> 1 votes

# Answer
# Assembly (MIPS, SPIM), 108 bytes

```
c:li$4 0
l:lb$2($5)
add$5 1
beqz$2 e
beq$2 35p
bne$2 59l
add$4 1
bge$4 127c
j l
p:li$2 11
syscall
j c
e:j$ra

```

TIO includes test cases.

Try it online!

This is a function which takes a null terminated string in `$a1` and prints the result to `stdout`.

Ungolfed version with comments:

```
    # Input: Null terminated byte string in $a1
    # Output: Printed to stdout
semihash:
.Lclear:
    li      $a0, 0             # Clear accumulator
.Lloop:
    lb      $v0, ($a1)         # Load char from program string
    add     $a1, 1             # Advance pointer
    beqz    $v0, .Lreturn      # If char was '\0', return
    beq     $v0, '#', .Lprint  # If char was '#', print
    bne     $v0, ';', .Lloop   # If not ';', loop again
    add     $a0, 1             # Increment accumulator
    bge     $a0, 127, .Lclear  # Clear accumulator if it is >= 127
    j       .Lloop             # Otherwise loop
.Lprint:
    li      $v0, 11            # 11 = PRINT CHARACTER
    syscall                    # putchar($a0)
    j       .Lclear            # Clear accumulator and loop again
.Lreturn:
    j       $ra                # Return

```
> 1 votes

# Answer
# Ly, 33 bytes

```
0spir[';=[l+s!]p"#"=[l'~`%o!s]pp]

```

Try it online!

A different take using `Ly`

```
0sp                                - init backup cell to "0"
   ir                              - read input as codepoints and reverse stack
     [                           ] - loops once for each input char
      ';=                          - is it a ";"?
         [    ]p                   - then clause if true
          l                        - load the accumulate value
           +                       - increment by 1 ("if" result is on stack)
            s                      - update backup cell
             !                     - change top of stack to "0" to exit loop
               p                   - delete "if" result
                "#"=               - is is a "#"?
                    [        ]     - then clause if true
                     l             - load backup cell
                      '~`          - generate the number "127"
                         %         - calculate modulo w/ 127
                          o        - print top of stack as char
                           !       - convert to "0" (1)
                            s      - reset backup cell to "0"
                               p   - delete "if" result
                                p  - delete character we just processed

```

Note(1): If the input tries to print a null (meaning x'00') the code will fail. If that's a requirement I can tweak the code to harden it against that. I think it would just add one more character... Printing nulls sounds like a mistake though, so I'm not sure it's necessary?
> 1 votes

# Answer
# jq -Rr, 46 bytes

Splitting and counting

```
[((./"#")[:-1][]/";")[:-1]|length%127]|implode

```

Try it online!
> 1 votes

# Answer
# batch, 293 bytes

```
@Echo off& Set f=For /f "UsebackQ Delims=" %%z in
Setlocal EnableDelayedExpansion&%f% ("%~1")Do (Set "l=%%~z"&Set "l=!l:;=-!"&%f:z=G% (`cmd/u/c ^"Echo(!l!^"^|find/v ""^|findstr "^^"`)Do (If %%G==- (Set/a i=i%%127+1)Else if %%G==# ((CMD /C Exit !i!)&<nul Set/p "=ESC7!=EXITCODEASCII!"&Set i=0)))

```

This interpreter contain an unprintable escape character (0x1b), marked by the presence of the string **`ESC`** To obtain a version containing the escape character, visit: https://pastebin.com/Y6vUi9A7

The use of the Escape sequence prevents syntax errors that occur when outputting strings with leading whitespace or `=` characters via `set /p`

Run from cmd.exe command line providing the filepath as arg 1, using doublequotes if the file path contains spaces, IE: Interpreter.bat path\to\filename.extension Each line of the program must be doubequoted, Example Helloworld.sch: ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;# "

Breakdown:

```
%= Supress command echoing =% @Echo off
%= Define command as macro with the FOR metavariable being replaced via substitution =% Set f=For /f "UsebackQ Delims=" %%z in
%= Enable 'runtime' expansion of vars within codeblocks =% Setlocal EnableDelayedExpansion
%= For each line in Arg 1 sourcefile =% %f% ("%~1")Do (
%= Assign line and replace semicolons with a non-standard delim =%    Set "l=%%~z"&Set "l=!l:;=-!"
%= Split string by character and for each character do =% %f:z=G% (`cmd/u/c ^"Echo(!l!^"^|find/v ""^|findstr "^^"`)Do (
%= Assess character =% If %%G==- (
%= increment accumulater =% Set/a i=i%%127+1
        )Else if %%G==# (
%= Convert Accumulator to Ascci character =% CMD /C Exit !i!
%= Output and reset Accumulator =% <nul Set/p "=ESC7!=EXITCODEASCII!"&Set i=0
)   )   )

```
> 1 votes

# Answer
# (,), 305 Chars or \\$305\log\_{256}(3)\approx\\$60.43 Bytes

```
(,,,,((())))(()()(),((()),()))(()(),()()()()())((),(()())()()())((),((),,,,(),,(())(()))(()()()))(,((()()),((,,,,,())))(,((()),((()))())((()),((()))(()()(),,,,(),,(())),,,,((())),(())),,,((()())),(()()())(()(),,,,(),,(()())(()())()()))((()),(,,,,,()),,((())),(()(),,,,(),,(()())()()),((()()))),,,((()())))

```

More readable version (I don't actually write in psuedo-code):

```
(,,,,((())))
(4,((()),()))
(3,()()()()())
(1,(3)()()())
(1,(1,,,,(),,(1)(1))(4))
(,
(5,((,,,,,())))
(,
(2,(2)())
(2,(2)(4,,,,(),,(1)),,,,(2),(1))
,,,
(5),
(4)(3,,,,(),,(3)(3)()())
)
(2,(,,,,,()),,(2),(3,,,,(),,(3)()()),(5))
,,,(5)
)

```

TIO

Quite Slow. Also doesn't work when input contains non-;# characters.
> 1 votes

# Answer
# Morsecco:  ~~206~~  203 bytes

writing an interpreter for a two-symbol language using a three-symbol language seems to be a fair challenge:

```
.   -- . -- . --.-  . . .--
. . . - .-.
-- - -.-. - -.- .- . .-...-- .- --..
 . .--... .- --.. --.
- .- --. - . . - .- . .------- .- - - --.. .-. . ------- .- - .-. - . --.
 - . -.- - . - .-- . . - . --.

```

The first line creates an error handler (code written to special address `.`) to quit the program without error if the input is used up. Everything else is pretty straight forward. Without having MOD or compare I always add -127, adding 127 again if the result was not zero. Maybe I can think of a shorter solution on another day.
> 1 votes

# Answer
# Vyxal 3, 12 bytes

```
'#sṪᵛ';C₆v%O

```

Try it Online!
> 1 votes

# Answer
# Swift, 97 bytes

```
var a=0,s="",f={(($0+"").map{a=$0==";" ?a+1:$0=="#" ?(s+="\(UnicodeScalar(a%127)!)",0).1:a},s).1}

```
> 1 votes

# Answer
## F#, ~~165~~ 162 bytes

-3 bytes, thanks to Random User

```
let g a=
 let mutable b=0
 let mutable d=""
 for c in a do
  if c=';' then
  b<-b+1
  elif c='#' then
  d<-[|d;string(char(b%127))|]|>Array.fold(+)""
  b<-0
 d

```

It's basically a port of my C# answer.
> 0 votes

# Answer
# Actually, 20 bytes

```
'#@s⌠';@c7╙D@%c⌡MdXΣ

```

Try it online!

Explanation:

```
'#@s⌠';@c7╙D@%c⌡MdXΣ
'#@s                  split on "#"
    ⌠';@c7╙D@%c⌡M     for each chunk:
     ';@c               count occurrences of ";"
         7╙D@%          mod by 127 (2**7-1)
              c         convert to ASCII char
                 dX   discard last item
                   Σ  concatenate

```
> 0 votes

# Answer
# Python 3, 66 bytes

```
a=0
for c in input():a-=a*(c=='#'!=print(end=chr(a%127)))-(c==';')

```

Try it online!
> 0 votes

# Answer
# Java 8, 112 bytes

This expression is a `Consumer<String>`, so it assumes `s` is a `String`.

```
(s)->{int i=0;for(char c:s.toCharArray()){if(c==';')i++;else if(c=='#'){System.out.print((char)(i%127));i=0;}}};

```
> 0 votes

# Answer
# Ruby, ~~71~~ 50 bytes

```
$*[0].split(?#).each{|p|$><<(p.count(?;)%127).chr}

```

Edit: Complete rewrite. manatwork's solution is still shorter, but this does it a slightly different way!
> 0 votes

# Answer
# AHK, 83 bytes

```
Loop,Parse,1
{f:=A_LoopField
If(f=";")
i++
If(f="#"){
Send % Chr(Mod(i,127))
i=0
}}

```

By default, `Loop,Parse` will parse each character individually.

---

I had a 76 bytes version based on splitting the input on `#` but, as pointed out by manatwork as a comment, it'll print the very last section even without a `#` at the end.

```
Loop,Parse,1,#
Send % Chr(Mod(StrLen(RegExReplace(A_LoopField,"[^;]")),127))

```
> 0 votes

# Answer
# Fourier, 32 bytes

```
$(I~Q{59}{&A}Q{35}{A%127a0~A}&i)

```

**Try it on FourIDE!**

Enter the program between quotation marks.

***Explanation Pseudocode***

```
While i != Input length
    Q = Pop character off start of string and get char ASCII code
    If Q = 59 Then
        Increment A
    End If
    If Q = 35 Then
        Convert A mod 127 to character and Print
        A = 0
    End If
    Increment i
End While

```
> 0 votes

# Answer
Add `$p=";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#";` to actually enjoy this tasty script. (`$p` is the input variable)

# PowerShell, 98 bytes

```
[char[]]$p|%{if($_-eq';'){$o++}elseif($_-eq'#'){Write-Host -NoNewLine ([char]($o%127));[int]$o=0}}

```

Try it online!
> 0 votes

# Answer
# java, ~~86~~ 95 bytes

this is a lambda expression assignable to a `Consumer<String>`

```
s->{for(String t:s.split("#|[^#]*\\Z"))System.out.print((char)(t.split(";",-1).length-1%127));}

```

Explanation:

* split the input using `#` as the delimiter and ignore everything after the last match
* for each substring, count the number of `;`'s and output the count as a char
> 0 votes

# Answer
# JavaScript (ES6), 71 Bytes

```
p=>([...p].map(v=>v==";"?i++:b+=String.fromCharCode(i,i=0),i=0,b=""),b)

```

This can probably be golfed, but I think the concept passing extra arguments to functions is one of the reasons why JavaScript is one of the more interesting languages to golf in.
> 0 votes

# Answer
# Ly, 44 bytes

```
0<i[[";"=[pp>1+<2$]p"#"=[pp>(127)%o0<2$]]i];

```

Try it online!

This submission does not work with the latest version of the Ly interpreter.
A version that does work, for 43 bytes:

```
ir[[";"=[pp>1+<2$]p"#"=[pp>(127)%o<2$]pp]];

```

Try it online!
> 0 votes

# Answer
# MaybeLater, 99 bytes

```
s=read()wheni is*{if((S=s[i])!=u){if(S==";")a++if(S=="#"){writechra%127a=0}when0secondpass i++}}i=0

```

## Ungolfed & Commented

```
input_string=read()                                 // Read the input from STDIN
when index is *{                                    // When index updates...
    if((this_char=input_string[index])!=undefined){ // If it's not undefined (So we've iterated onto another entry)...
        if(this_char==";")                          // If this character is a ;
            accumulator++                           // Increment the accumulator (Which defaults to 0)
        if(this_char=="#"){                         // If it's # however
            write(chr(accumulator%127))             // Write the character value of the accumlator % 127, and reset the accumulator.
            accumulator=0
        }
        when 0 second pass                          // When 0 seconds pass, to prevent stack overflow, increment the index. Which loops.
            index++
    }
}
                                                    // Start off the index.
index = 0

```

Try it online!
> 0 votes

# Answer
# Kotlin, 105 bytes

## Submission

```
fun d(l:String):String=l.split("#").map{(it.length%127).toChar()}.joinToString("").removeSuffix("\u0000")

```

## TryItOnline

Link

## Explanation

* It splits the string into ; chunks
* Then it changes them into characters
* It joins them into a string
* Then it removes the null byte from the end
> 0 votes

# Answer
# Pyth, 18 bytes

My misunderstanding works anyways... hmm?

```
Jcw"#"VtlJpC/@JN";

```

Explanation:

```
Jcw"#"        Split the input by "#" and store it in J
VtlJ          For the length of J - 1...
 p            Print without newline...
  C/@JN";       Character from charcode (length of ';'s at the Nth position in J)

```

Try it online!
> 0 votes

# Answer
# Clojure, 69 bytes

```
#(reduce(fn[a c](case c\;(inc a)\#(do(print(char(mod a 127)))0)a))0%)

```

A simple reduction over the code. Alters the accumulator accordingly for each character that's read.

```
(defn interpret [code]
  (reduce (fn [acc chr]
            (case chr
              \; (inc acc)
              \# (do (print (char (mod acc 127))) ; Print the char,
                     0) ; then reset the accumulator
              acc)) ; An ignored character; don't do anything
          0 ; The initial accumulator
          code))

```
> 0 votes

# Answer
# Ahead, 26 bytes

```
r  o%721$<
~>j@i:'#=n';=+~

```

Try it online!
> 0 votes

# Answer
# Noether, 42 bytes

```
I~sL(si/~c{";"=}{!a}c{"#"=}{a127MBP0~a}!i)

```

Try it online!
> 0 votes

# Answer
## Haskell, 73 bytes

```
f[]a=""
f(c:s)a|c==';'=f s(a+1)|c=='#'=toEnum(a`mod`127):f s 0|0<1=f s a

```
> 0 votes

# Answer
# Clojure, 65 bytes

```
(fn[c](map #(char(mod((frequencies %)\;)127))(re-seq #"[^#]+"c)))

```

Splits the code by '#', counts the number of ';', and turns the number (mod 127) into its ascii value

Try it online!
> 0 votes

# Answer
# Swift, 117 bytes

```
func f(i:String){var a=0;for c in i{if c==";" {a+=1}else{print(Character(UnicodeScalar(a%127)!),terminator:"");a=0}}}

```

Expanded out:

```
func f(i: String) {
    var a = 0
    for c in i {
        if c==";" {
            a += 1
        } else {
            print(Character(UnicodeScalar(a%127)!),terminator:"")
            a=0
        }
    }
}

```

Run it online
> 0 votes

# Answer
# Pascal (FPC), ~~134~~ ~~133~~ 122 bytes

```
var c:char;a:word;begin repeat read(c);if c='#'then begin write(chr(a mod 127));a:=0 end;if c=';'then Inc(a)until eof end.

```

Try it online!

Assumes non-empty input.
> 0 votes

# Answer
# Forth (gforth), 77 bytes

```
: f 0 tuck do over i + c@ '# - ?dup if 24 = - else 127 mod emit 0 then loop ;

```

Try it online!

### Code Explanation

```
: f            \ start a new word definition
  0 tuck       \ put 0 on the top of the stack and stick a copy behind the second stack item
  do           \ begin a counted loop from 0 to string length - 1
    over i +   \ get the address of the next character
    c@ '# -    \ get the next character's ascii value and subtract ascii # (35)
    ?dup       \ if result is not 0, duplicate
    if         \ if result is true (not 0)
      24 = -   \ check if result = 24, and subtract -1 from accumulator if it is (0 otherwise)
    else       \ else (if result was equal to 35)
      127 mod  \ get accumulator mod 127
      emit 0   \ output accumulator and replace with 0
    then       \ end if
  loop         \ end loop
;              \ end word definition

```
> 0 votes

# Answer
# PHP, 84 bytes

**First attempt ~~144~~ 133 bytes**

I was able to remove 11 by using all ternary conditions, this required adding some `( )` to cement in the operation order. PHP has a weird thing with that.

```
function f($s,$i,$c,$r){echo''==($a=$s[$i])?$r:('#'==$a?f($s,++$i,0,$r.=chr($c%127)):(';'==$a?f($s,++$i,++$c,$r):f($s,++$i,$c,$r)));}

```

Test it like this:

```
error_reporting(0);

$strings =[';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ffea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#au###h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;h;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;o',
    ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#'
];

foreach($strings as $s){
    f($s,0,0,''); echo "\n";
}

function f($s,$i,$c,$r){echo''==($a=$s[$i])?$r:('#'==$a?f($s,++$i,0,$r.=chr($c%127)):(';'==$a?f($s,++$i,++$c,$r):f($s,++$i,$c,$r)));}

```

Output

```
Hello, World!
;#
2d����{���
!

```

Sandbox

**Notes/Explanation**

This is a recursive function. Most of the space savings comes from using ternary conditionals,short variable names and grouping some of the setters into the aforementioned conditions. It takes 4 input arguments and sets 1 local variable:

Arguments/Variables

`$s` \- the `;#` string to parse.

`$i` \- the iterator, to keep track of the current position in the string, starts at `0`.

`$c` \- the register keeps the count of `;` prior to `#`, starts at `0`.

`$r` \- the results, the output of the parser, starts as an empty string.

Expanded version:

```
function f($s,$i,$c,$r){
    if( '' == ( $a = $s[$i] ) ){
         echo $r;
    }else{
        if( '#' == $a ){
            f( $s, ++$i, 0, $r.=chr( $c % 127 ));
        }else{
            if( ';' == $a ){
                f( $s, ++$i, ++$c, $r);
            }else{
                f( $s, ++$i, $c, $r);
            }
        }
    }
}

```

**Update attempt 2, ~~77~~ 84 Bytes (PHP \< 7)**

Had to add aomw to fix a bug with it having an empty element in the array at the end.

```
 function f($s){foreach(split('#',$s)as$a)echo!$a?'':chr(substr_count($a,';')%127);}

```

You can change `split` to `explode` to make it compatible with PHP7, but add 2 bytes. Test it the same as above, produces the same output.

Sandbox2

Expanded version:

```
function f($s){
     $array = split('#',$s)
     foreach($array as $a){
        if(!$a){
           echo '';
        }else{
           $count = substr_count($a,';');
           echo chr($count%127);
        }
     }
}

```

It's shorter, simpler, and should be faster. The key to this one was `substr_count` which I already know about but didn't think of right away, as I was a bit rushed for time on the first attempt. After thinking about it some, I came up with this and almost cut it in half. Not bad!

Basically it splits it on the `#` and then counts the occurrences of `;` in each array item and outputs the character that generates.

Cheers!
> 0 votes

# Answer
# VBA (Excel) 103 Bytes

```
Function a(b)
  For Each c In Split(b,"#")
    a=a &Chr((Len(c)-Len(Replace(c,";","")))Mod 127)
  Next
End Function

```

Un-golfed With Comments:

```
Function fromSemiHash(myString)    'SemiHash is how I think it should be pronounced :D
    'For each string in myString split by hashes
    For Each littleString In Split(myString,"#")
        'Append the char from((the length of everything minus length of everything but ;'s) mod 127)
        toSemiHash = toSemiHash & Chr((Len(littleString) - Len( Replace( littleString , ";" ,""))) Mod 127)
    Next littleString
End Function

```
> 0 votes

# Answer
# Kotlin, 77 bytes

```
{Regex(";*#").findAll(it).fold(""){a,v->a+((v.value.length-1)%127).toChar()}}

```

Try it online!
> 0 votes

# Answer
# Whitespace, 119 bytes

```
[S S S N
_Push_0][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][S N
S _Duplicate_top][T N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve][S N
S _Duplicate_input][S S S T S S S T T   N
_Push_35][T S S T   _Subtract][N
T   S S N
_If_0_Jump_to_Label_PRINT_CHAR][S S S T T   T   S T T   N
_Push_59][T S S T   _Subtract][N
T   S T N
_If_0_Jump_to_Label_INCREASE][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT_CHAR][S N
N
_Discard_top][S S S T   T   T   T   T   T   T   N
_Push_127][T    S T T   _Modulo][T  N
S S _Print_as_character][S S S N
_Push_0][N
S N
N
_Jump_to_Label_LOOP][N
S S T   N
_Create_Label_INCREASE][S S S T N
_Push_1][T  S S S _Add][N
S N
N
_Jump_to_Label_LOOP]

```

Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.
`[..._some_action]` added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

**Pseudo-code:**

```
Integer i = 0
Label LOOP:
  Character c = STDIN as character
  If(c == '#'):
    Jump to Label PRINT_CHAR
  If(c == ';'):
    Jump to Label INCREASE
  Jump to Label LOOP

Label PRINT_CHAR:
  i = i modulo-127
  Print i as character to STDOUT
  i = 0
  Jump to Label LOOP

Label INCREASE:
  i = i + 1
  Jump to Label LOOP

```
> 0 votes

# Answer
# Rutger, 170 bytes

```
a=0;
f=Each[Array[$Argv]];
f=f[@c];
f=f[{p=Add[$a];s=Equal[";"];h=Equal["#"];a=p[s[$c]]];i=If[{h[$c];}];i=i[{m=Modulo[$a];a=0;PrintEnd[Char[m[127]]];}];Do[$i];}];
Do[$f];

```

Try it online!

Man, Rutger is verbose

## How it works

```
accumulator = 0;

each = Each[Array[$Argv]]; // Read a string from argv, cast to list and create an each loop

each = each[@char]; // Iterate over each character

each = each[{

	plus = Add[$accumulator]; // Partial function to add a value to the accumulator
	semicolon = Equal[";"]; // Comparison function to ";"
	hash = Equal["#"]; // Comparison function to "#"

	accumulator = plus[semicolon[$char]]; // Add 1 to $accumulator if $char is a semicolon

	if = If[{
		hash[$char]; // If $char is a hash
	}];

	if = if[{
		mod = Modulo[$accumulator]; // Partial function to mod the accumulator
		accumulator = 0; // Reset the accumulator to 0

		PrintEnd[Char[mod[127]]]; // Print, without a trailing newline, the accumulator, mod 127, converted to char
	}];

	Do[$if]; // Run the if statement

}];

Do[$each]; // Run the each loop

```
> 0 votes

# Answer
# Thunno 2 `J`, 13 bytes

```
'#/ṫı';c127%C

```

Attempt This Online!

Port of Adnan's 05AB1E answer.

#### Explanation

```
'#/ṫı';c127%C  # Implicit input
'#/            # Split on "#"
   ṫ           # Remove the last item
    ı          # Map over the list:
     ';c       #  Count of ";"s
        127%   #  Mod 127
            C  #  Convert to character
               # Implicit output, joined

```
> 0 votes

---
Tags: code-golf, interpreter
---