Are interpreters really going to be remembered?

Ok guys, I thought that I would take my old notes from CS and take a look at the compiler theory a little more. I have to say that I can’t, because life in me remembers how it all works, but I have a great sample application from my college days that helps me understand a few things.

In this example application, a compiled language is executed and compiled to intermediate assembly code, such as a language. Then a simple VM implementation is executed, which accepts this intermediate language and executes the instructions.

The thing I can't figure out with is that if I were a direct interpreter and not a compiler, it would still collect these intermediate commands in memory, which will be executed at the end. Or does the interpreter actually “execute” conditional sections of code fragments at a time?

+3
source share
4 answers

. ( , ++, ). , . ? , , - .

+1

. (Perl, Python Ruby, ) , (citation).

+4

, , (AST), , AST , . , : .

  • 8 , ( FORTH).
  • , AST.
  • , . ( , , Lua, VM, Java VM.)
+3

Most modern interpreters analyze the program for intermediate code, which is later interpreted. Some store this intermediate code explicitly (e.g. Python .pyc). For example, there are exceptions; shell scripts are directly interpreted and then analyzed in an intermediate format.

Some more advanced "interpreters" do not actually interpret, but compile JIT (just in time) (for example, Java or .NET).

+1
source

Source: https://habr.com/ru/post/1704358/


All Articles