What is an interpreted language?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 1407 Views - Last Post: 24 March 2020 - 11:14 AM

#16 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2768
  • View blog
  • Posts: 4,429
  • Joined: 21-June 11

Re: What is an interpreted language?

Posted 22 March 2020 - 08:46 AM

View Postjustawebuser, on 22 March 2020 - 04:28 PM, said:

I'm not saying the students should understand the compiler construction. Because I don't understand it my self either.
I'm saying the interpreter they're using should do it for them.


Skydiver wasn't talking about students using an interpreter, but about students writing an interpreter (for the simple language of arithmetic expressions).

Quote

And the code you put there is just the BASIC equivalent of my PHP code. It doesn't say anything about the BASIC interpreter.


Right, the code doesn't say anything about the interpreter, but Skydiver is saying that the BASIC interpreter will run that code without any compilation (which is true for MS BASIC and its derivatives at least) and it still runs fine (albeit slow). Ergo compilation isn't necessary.

That may be missing your point a bit though because (as I understood you) you weren't saying that "pure interpretation" (i.e. with no form of compilation) can't work, but that it's not efficient enough for real-world applications. So maybe you two are talking past each other a bit there.

This post has been edited by sepp2k: 22 March 2020 - 08:47 AM

Was This Post Helpful? 3
  • +
  • -

#17 O'Niel   User is offline

  • D.I.C Addict

Reputation: 25
  • View blog
  • Posts: 572
  • Joined: 13-September 15

Re: What is an interpreted language?

Posted 24 March 2020 - 08:24 AM

Maybe the Shell part is also important.
Take for example this Python shell:

[email protected] qt_rs_3 % python3
Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 5
>>> if x > 5:
...     print("bigger than 5")
... elif x < 5:
...     print("Smaller than 5")
... else:
...     print("Equals to 5")
...
Equals to 5
>>>



I was able to execute this Python code by coding directly into the Python shell. However, it is totally interrupted and not compiled. I think all interpreted languages have this kind of shell?
Was This Post Helpful? 0
  • +
  • -

#18 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2768
  • View blog
  • Posts: 4,429
  • Joined: 21-June 11

Re: What is an interpreted language?

Posted 24 March 2020 - 11:14 AM

View PostO, on 24 March 2020 - 04:24 PM, said:

I was able to execute this Python code by coding directly into the Python shell. However, it is totally interrupted and not compiled.


It's still compiled to bytecode (I'm pretty sure), but in this case not a whole file at a time because, of course, there are no files (unless you import a file, in which case it will still be bytecode-compiled in its entirety).

Quote

I think all interpreted languages have this kind of shell?


Not all, but many. It's not just interpreters though. Some compilers (including classical ahead-of-time native compilers) also come with REPLs - especially for functional languages.

PS: Just to be clear, when I said "shells work that way" in an earlier post, I was talking about command line shells like sh, bash, zsh, cmd, PowerShell etc., not about REPLs.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2