in reply to perl language

It is compiled into a tree of "opcodes". B::Concise can show you this tree.

>perl -MO=Concise -e"my $x = 1; $x += 2; print $x" e <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 5 <2> sassign vKS/2 ->6 3 <$> const[IV 1] s ->4 4 <0> padsv[$x:1,2] sRM*/LVINTRO ->5 6 <;> nextstate(main 2 -e:1) v ->7 9 <2> add[t2] vKS/2 ->a 7 <0> padsv[$x:1,2] sRM ->8 8 <$> const[IV 2] s ->9 a <;> nextstate(main 2 -e:1) v ->b d <@> print vK ->e b <0> pushmark s ->c c <0> padsv[$x:1,2] l ->d -e syntax OK

Replies are listed 'Best First'.
Re^2: perl language
by salva (Canon) on Nov 12, 2007 at 14:43 UTC
    Being a little fussy, the final data structure used on the execution stage is not a tree but a directed graph that represents the program flow.

    The tree is only an intermediate result.

      The tree form is the natural representation of perl code. That representation is never lost either. It's only an optimization that the program flow is superimposed on top of the nodes to make another DAG.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Yeah, I suppose it's not really a tree, it's only represented as one. You can even see from the B::Concise output (->##) that it's really a graph.