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).

3
  • 4
    MATLAB uses JIT compilation, which does produce an intermediate representation. Octave seems to have something similar, but still experimental
    – Luis Mendo
    Commented Sep 13, 2017 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
    Commented Sep 13, 2017 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
    Commented Dec 5, 2020 at 20:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.