Skip to main content
9 of 12
deleted 9 characters in body

PowerShell 7, 133 127 126 124 120 119 117 106 bytes

Takes input as an array of directives; the output is a TIO-Compatible PowerShell program.

'$a=0;switch($args[0]|% T*y){'
$args|%{$1,$2,$3=$_
"$1{`$a="
$2[1]?"""`$a*""*$3+1|iex}":"`$a$2$3}"}
"}`$a"

Link is to a 120-byte TIO-Friendly (PowerShell 6 and below) version of the code. Try it online!

Explanation

'$a=0;switch($args[0]|% T*y){'  # The first part of the interpreter sets the
                                # accumulator to 0 and switches on the input
                                # program's characters. Switching on an array
                                # in powershell processes the switch statement
                                # for each element.

$args|%{$1,$2,$3=$_             # For each array in the input array, set $1,
                                # $2, $3 to the first, second, and third 
                                # element, respectively.

"$1{`$a="                       # output the case for the letter of the command
                                # start the case with setting the accumulator
                                # equal to whatever else is in this case

$2[1]                           # If the second character of the command exists
                                # In other words, the command is '**'

    ?"""`$a*""*$3+1|iex}"       # Make the body of the case a special way to
                                # calculate powers in PowerShell which is
                                # shorter than [Math]::Pow - effectively
                                # builds a string representation of the 
                                # calculation, then evaluates that string.

    :"`$a$2$3}"}                # If the command isn't '**', we just make the
                                # command '{accumulator}{command}{number}'
                                # for example: '$a/3', making the whole case
                                # '{$a=$a/3}'

"}`$a"                          # Close the switch block, output the accumulator

Output

Outputs a very ugly interpreter; for the example input provided in the challenge, the interpreter looks like this:

$a=0;switch($args[0]|% T*y){
a{$a=
"$a*"*3+1|iex}
b{$a=
$a*2}
c{$a=
$a+15}
d{$a=
$a=0}
e{$a=
$a/8}
}$a

And, of course, Try The Output Interpreter!