interpreter

How exactly does the Java interpreter or any interpreter work?

一笑奈何 提交于 2019-12-21 12:28:32
问题 I have been figuring out the exact working of an interpreter, have googled around and have come up with some conclusion, just wanted it to be rectified by someone who can give me a better understanding of the working of interpreter. So what i have understood is: An interpreter is a software program that converts code from high level language to machine format. speaking specifically about java interpreter, it gets code in binary format (which is earlier translated by java compiler from source

PyCharm doesn't detect interpreter

≯℡__Kan透↙ 提交于 2019-12-21 10:49:52
问题 I'm new to programming and just started a course on Python. I want to use PyCharm, so I downloaded and intalled it (v. 4.5, community edition). I had previously installed Python 3.5 64-bit from python.org (I'm using Windows 10). To start using PyCharm, I need a project interpreter, which I can select in the settings. As far as I'm concerned, the interpreter is "py.exe", but when I select it, I get this error message: "The selected file is not a valid home for Python SDK". I also tried to use

Python CTRL+C to exit interpreter?

南笙酒味 提交于 2019-12-21 05:12:09
问题 Python 2.73 Why is it on my laptop when I hit CTRL + C , I can exit the interpreter and on my desktop hitting CTRL + C will make the interpreter shoot back at me a KeyboardInterrupt message. How can I get rid of this KeyboardInterrupt and go back to exiting with CTRL + C ! On my desktop it's required to input CTRL + Z and hitting enter to exit. I am using PowerShell on both computer. Same 64bit, one is Win7 one is Win8 回答1: You could change the signal handler for CTRL - C to something that

Order of functions in JavaScript

点点圈 提交于 2019-12-21 04:35:14
问题 My question is based on the example from a book "Object Oriented JavaScript" (page 81 - Lexical Scope) So, i understand from this example ... function f1(){var a = 1; f2();} function f2(){return a;} f1(); ... that: a is not defined But, how f1 get's to know about f2, which is defined after f1 ? This behavior raises a question: How JavaScript interpreter works ? I assume, that it: scans the code and simply stores the functions, not assigned to any var, in a global environment Invokes a

Embed python interpreter in a python application

大兔子大兔子 提交于 2019-12-21 04:28:30
问题 i'm looking for a way to ship the python interpreter with my application (also written in python), so that it doesn't need to have python installed on the machine. I searched google and found a bunch of results about how to embed the python interpreter in applications written in various languages, but nothing for applications writtent in python itself... I don't need to "hide" my code or make a binary like cx_freeze does, i just don't want my users to have to install python to use my app,

interpret Parigot's lambda-mu calculus in Haskell

☆樱花仙子☆ 提交于 2019-12-21 01:06:13
问题 One can interpret the lambda calculus in Haskell: data Expr = Var String | Lam String Expr | App Expr Expr data Value a = V a | F (Value a -> Value a) interpret :: [(String, Value a)] -> Expr -> Value a interpret env (Var x) = case lookup x env of Nothing -> error "undefined variable" Just v -> v interpret env (Lam x e) = F (\v -> interpret ((x, v):env) e) interpret env (App e1 e2) = case interpret env e1 of V _ -> error "not a function" F f -> f (interpret env e2) How could the above

Compile and execute Scala code at runtime

馋奶兔 提交于 2019-12-20 12:07:37
问题 Is is possible to compile and execute scala code as a string at runtime either in Scala or in Java? My idea is to build a DSL using Scala then let Java programmers use the DSL inside Java. I heard that the class scala.tools.nsc.Interpreter can do something like that, but when I imported it inside my scala file, I got "object tools is not a member of package scala." So could anybody give me a hint? 回答1: In 2.10.0 we expose Scala reflection API, which among everything else includes a runtime

Haskell interpreter on Android? [closed]

孤街醉人 提交于 2019-12-20 08:57:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is there a Haskell interpreter (with standard libraries) that can be installed on Android? So that someone with an Android device can do some Haskell exercises on an Android device: write and run some example code in Haskell. 回答1: Taking a note from imz, all you need is ConnectBot or similar A remote machine

How does one implement a “stackless” interpreted language?

梦想的初衷 提交于 2019-12-20 08:39:23
问题 I am making my own Lisp-like interpreted language, and I want to do tail call optimization. I want to free my interpreter from the C stack so I can manage my own jumps from function to function and my own stack magic to achieve TCO. (I really don't mean stackless per se, just the fact that calls don't add frames to the C stack. I would like to use a stack of my own that does not grow with tail calls). Like Stackless Python, and unlike Ruby or... standard Python I guess. But, as my language is

How does Python read and interpret source files?

僤鯓⒐⒋嵵緔 提交于 2019-12-20 02:44:09
问题 Say I run a Python (2.7, though I'm not sure that makes a difference here) script. Instead of terminating the script, I tab out, or somehow switch back to my editing environment. I can then modify the script and save it, but this changes nothing in the still-running script. Does Python load all source files into memory completely at launch? I am under the impression that this is how the Python interpreter works, but this contradicts my other views of the Python interpreter: I have heard that