parrot/parrot — Issue #179: [abc] exponentiation fails (cannot locate 'pow' opcode)
Author: pmichaud
Created: 2011-10-20 13:31:44+00:00
State: open

Issue #178 notes that exponentiation doesn't work in the 'abc' language -- a typical failure is:

> 3 ^ 4
error:imcc:syntax error, unexpected NREG, expecting '(' ('$N102')
in file '(file unknown)' line 12

The correct answer should be '81'. The problem appears to be that the 'pow' opcode (a dynop) isn't being recognized by IMCC.

I tried adding .loadlib 'trans_ops' to abc.pir, but that doesn't seem to have resolved the problem. Thus, this ticket.

On a related note, it makes absolutely no sense to me that the 'pow' opcode (a basic mathematical operation) belongs in 'trans_ops'. At the least I'd expect it to be in 'math_ops', and I really think it ought to be a core opcode. By way of comparison, the 'sqrt' opcode is a core opcode, it seems odd that square roots are 'core' but exponentiation is not.

Pm