3

Do the MATLAB and GNU Octave interpreters work like interpreters in the old sense? Do they parse each line, translate it into machine code and execute or do they translate the entire code into an Intermediate Representation (like Python bytecode, perl AST etc.) first and then interpret the IR.

For GNU Octave and MATLAB, it seems pretty reasonable to have a bytecode or Intermediate Representation for efficiency (not for obfuscation only).

Kraken
  • 189
  • 5
  • 4
    MATLAB uses [JIT compilation](https://blogs.mathworks.com/loren/2016/02/12/run-code-faster-with-the-new-matlab-execution-engine/#a10b1355-2da4-47e8-87b9-bac247d0b6a6), which does produce an intermediate representation. Octave seems to have [something similar](https://www.gnu.org/software/octave/doc/interpreter/JIT-Compiler.html), but still experimental – Luis Mendo Sep 13 '17 at 15:16
  • @LuisMendo From what I know, the JIT compiles hot-spots in code like large loops. Infrastructures that use JIT technique like spidermonkey and Dalvik VM compile the code to a bytecode and then JIT it. So my question stands: Even before being JIT'ed, is the code translated to a nearer to binary bytecode or IR? – Kraken Sep 13 '17 at 16:35
  • It seems it does both, since some statements can't be evalin'd (like return), also some functions return values are cached, in parrot loops matlab behave – tommsch Dec 05 '20 at 20:28

0 Answers0