Parse ascii art math!

APL (Dyalog Unicode), 46 44 bytes

'/(80-)63+92145*7'[16|43|25⊥¨(×⊆⊢)2⊥' .\'⍳⎕]

Try it online!

evaluated input, must be a character matrix

' .\'⍳ replace spaces with 0, .s with 1, \s with 2, and everything else with 3

2⊥ base-2 decode the columns

(×⊆⊢) split on zeroes

25⊥¨ base-25 decode each group

16|43| mod 43, mod 16

'/(80-)63+92145*7'[ ] use as indices in the given string

Python 2, 154 139 bytes

while s[i:]:d=3**(max((s+[' '])[i+1])>' ')+i;print'+/5(_41_7802*6__-9)3'[hash(tuple(s[i:d]))*3%67%21];i=1+d

Try it online!

APL (Dyalog Unicode), 69 61 bytes

Anonymous tacit prefix function. Requires ⎕IO←0.


Try it online!

⎕UCS convert characters to code points

{} "dfn"; argument is

('+-*/()',⎕D) the involved symbols followed by the Digits

[] index into that using the following indices:

  '∆JV⍺TgucKmre3Ha'⍳ indices in this string (missing elements get index=length) of

  ⎕AV[] index into the Atomic Vector (the character set) using the following:

   94| the division remainder when divided by 94 of

   2⊥¨ the base-2 evaluation of each of

   ,⌿ the vertically joined and flattened

   ⍵⊆⍨ segments of the argument, as indicated by trues in

   ∨⌿ the vertical OR-reduction of

   32≠⍵ the Boolean mask indicating where the argument is different from 32 (space)