interpreted-language

How does an interpreter run code?

江枫思渺然 提交于 2021-01-27 12:06:38
问题 Reading all the compiled vs interpreted articles it seems like compiled means the machine will run the compiled code directly whereas interpreted, the interpreter will run the code. But how does the interpreter run the code if it's on a machine? Doesn't it still end up having to convert what it's interpreting into machine code and STILL having the machine run it? At the end of the day, everything has to end up being machine code in order for the machine to run it right? It seems like

Recursion overhead — how serious is it? [duplicate]

扶醉桌前 提交于 2020-06-24 22:26:50
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Is recursion ever faster than looping? I was first trained to program seriously in C, about 15 years ago. My employer wanted highly optimized code for computationally difficult tasks. I remember being advised more than once to rewrite recursions as loops, even at the expensive of readability, in order to avoid "recursion overhead." As I understood it then, recursion overhead was the extra effort required to push

What gives Smalltalk the ability to do image persistence, and why can't languages like Ruby/Python serialize themselves?

Deadly 提交于 2020-01-22 10:35:08
问题 In smalltalk, you're able to save the state of the world into an image file. I assume this has to do with Smalltalk's ability to "serialize" itself -- that is, objects can produce their own source code. 1) Is this an accurate understanding? 2) What is the challenge in adding this ability to modern languages (non-lisp, obviously)? 3) Is "serialization" the right word? What's the correct jargon? 回答1: It's much simpler than "serializing". A Smalltalk image is simply a snapshot of the object

What are the pros and cons of interpreted languages?

跟風遠走 提交于 2020-01-01 01:14:13
问题 I'm now learning Perl. What are the pros and cons of the interpreted languages? 回答1: Blatant copy from wikipedia so I'll make this community wiki. Advantages of interpreted languages Interpreted languages give programs certain extra flexibility over compiled languages. Features that are easier to implement in interpreters than in compilers include (but are not limited to): platform independence (Java's byte code, for example) reflection and reflective usage of the evaluator (e.g. a first

Is Javascript compiled or an interpreted language? [closed]

不打扰是莪最后的温柔 提交于 2019-12-29 02:24:09
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Can Javascript be called a pure interpreted language? Or does it also have some compiled flavor to it? Could someone guide at the

Is Ruby a scripting language or an interpreted language?

我怕爱的太早我们不能终老 提交于 2019-12-20 09:12:33
问题 I just noticed that in the wikipedia page of Ruby, this language is defined as interpreted language. I understood that probably there's something missing in my background. I have always known the difference between an interpreted language that doesn't need a compiler and a compiled language (who require to be compiled before the execution of programs), but what characterize a scripting language ? Is Ruby definable as a scripting language ? Thank you and forgive me for the black out 回答1:

How would you create an expression parser in c#?

家住魔仙堡 提交于 2019-12-20 05:19:13
问题 I am just curious. Like in interpreted languages or even statement calculators how do people convert the strings given by input or files to actual expressions? e.g "Enter Calculation: " and you write "2*7/4" which is a string. How does the program convert the string into an actual expression? It is easy to convert a string to an int but how do you convert operators like + , - , / , etc.? I understand that these kind of things are usually implemented in C/C++ but is it possible to make such a

How would you create an expression parser in c#?

*爱你&永不变心* 提交于 2019-12-20 05:19:06
问题 I am just curious. Like in interpreted languages or even statement calculators how do people convert the strings given by input or files to actual expressions? e.g "Enter Calculation: " and you write "2*7/4" which is a string. How does the program convert the string into an actual expression? It is easy to convert a string to an int but how do you convert operators like + , - , / , etc.? I understand that these kind of things are usually implemented in C/C++ but is it possible to make such a

Is C# partially interpreted or really compiled?

五迷三道 提交于 2019-12-17 21:43:25
问题 There is a lot of contradicting information about this. While some say C# is compiled (as it is compiled into IL and then to native code when run), others say it's interpreted as it needs .NET. EN Wiki says: Many interpreted languages are first compiled to some form of virtual machine code, which is then either interpreted or compiled at runtime to native code. So I'm quite confused. Could anyone explain this clearly? 回答1: C# is compiled into IL, by the c# compiler. This IL is then compiled

How does python implement mutual recursion?

▼魔方 西西 提交于 2019-12-14 00:18:59
问题 Moving to python with C/Java background, I recently had to implement a mutual recursion, but something in python is bothering me: since a python program is interpreted line by line, if I have two functions one after another in the same python file: def A(n): B(n-1) # if I add A(1) here, it gives me an error def B(n): if n <= 0: return else: A(n-1) When the interpreter is reading A , B is not yet defined, however this code does not give me an error TL;DR My understanding is that, when def is