interpreter

Relation between REPL, interpreter and compiler

巧了我就是萌 提交于 2019-11-30 17:25:09
问题 From Wikipedia: The REPL is commonly misnamed an interpreter. This is a misnomer—many programming languages that use compilation (including bytecode compilation) have REPLs, such as Common Lisp and Python. From a reply to this post Interactive interpreters use REPLs. An interpreter is not required to have one. You can run Python, for example, in non-interactive mode (on a file) and it will not use a read-eval-print loop. I was wondering if REPL [del] always exists [/del] exists only for an

Clarification regarding traditional interpreter, compiler and JIT compiler/interpreter

喜你入骨 提交于 2019-11-30 17:23:00
问题 I'm learning Java and the following things are a bit confusing for me. What I understood is: Java Compiler → The Java compiler just converts .java programs into .class files, which means converting our source code into bytecode (it is a list of op codes for the virtual machine (JVM) which makes Java platform-independent). Java Interpreter → merely "interprets" the code and does not transform it into native machine code. It executes each and every instruction of the byte code one-by-one as a

scala.reflect.internal.FatalError: package scala does not have a member Int

本小妞迷上赌 提交于 2019-11-30 15:26:32
问题 I am currently working on a project using Scala and Play Framework 2. I want to compile some Scala code during runtime and get the result from the interpreter. I found some examples on the internet and finally came up with the following code: package controllers import play.api.mvc.{Action, Controller} import javax.script.ScriptEngineManager class Interpreter extends Controller { val interpreter = new ScriptEngineManager().getEngineByName("scala") val settings = interpreter.asInstanceOf[scala

How can I make a python script change itself?

坚强是说给别人听的谎言 提交于 2019-11-30 14:58:43
问题 How can I make a python script change itself? To boil it down, I would like to have a python script ( run.py )like this a = 0 b = 1 print a + b # do something here such that the first line of this script reads a = 1 Such that the next time the script is run it would look like a = 1 b = 1 print a + b # do something here such that the first line of this script reads a = 2 Is this in any way possible? The script might use external resources; however, everything should work by just running the

How can I make a python script change itself?

有些话、适合烂在心里 提交于 2019-11-30 13:55:04
How can I make a python script change itself? To boil it down, I would like to have a python script ( run.py )like this a = 0 b = 1 print a + b # do something here such that the first line of this script reads a = 1 Such that the next time the script is run it would look like a = 1 b = 1 print a + b # do something here such that the first line of this script reads a = 2 Is this in any way possible? The script might use external resources; however, everything should work by just running the one run.py -file. EDIT: It may not have been clear enough, but the script should update itself, not any

Is there Dart VM available?

这一生的挚爱 提交于 2019-11-30 13:48:41
问题 Just read news that Google had announced an early preview of the new web programming language Dart. The documentation on the dartlang.org states: You will be able to run Dart code in several ways: Translate Dart code to JavaScript that can run in any modern browser: Chrome, Safari 5+, and Firefox 4+ (more browser support coming shortly). Execute Dart code directly in a VM on the server side Use Dartboard to write, modify, and execute small Dart programs within any browser window And I'm

scala.reflect.internal.FatalError: package scala does not have a member Int

送分小仙女□ 提交于 2019-11-30 13:27:03
I am currently working on a project using Scala and Play Framework 2. I want to compile some Scala code during runtime and get the result from the interpreter. I found some examples on the internet and finally came up with the following code: package controllers import play.api.mvc.{Action, Controller} import javax.script.ScriptEngineManager class Interpreter extends Controller { val interpreter = new ScriptEngineManager().getEngineByName("scala") val settings = interpreter.asInstanceOf[scala.tools.nsc.interpreter.IMain].settings settings.embeddedDefaults[Interpreter] settings.usejavacp.value

What opcode dispatch strategies are used in efficient interpreters?

跟風遠走 提交于 2019-11-30 13:06:09
问题 What techniques promote efficient opcode dispatch to make a fast interpreter? Are there some techniques that only work well on modern hardware and others that don't work well anymore due to hardware advances? What trade offs must be made between ease of implementation, speed, and portability? I'm pleased that Python's C implementation is finally moving beyond a simple switch (opcode) {...} implementation for opcode dispatch to indirect threading as a compile time option, but I'm less pleased

“Strictly positive” in Agda

为君一笑 提交于 2019-11-30 12:44:25
问题 I'm trying to encode some denotational semantics into Agda based on a program I wrote in Haskell. data Value = FunVal (Value -> Value) | PriVal Int | ConVal Id [Value] | Error String In Agda, the direct translation would be; data Value : Set where FunVal : (Value -> Value) -> Value PriVal : ℕ -> Value ConVal : String -> List Value -> Value Error : String -> Value but I get an error relating to the FunVal because; Value is not strictly positive, because it occurs to the left of an arrow in the

There is no such thing as a “compiled language” or “interpreted language”

假装没事ソ 提交于 2019-11-30 11:50:00
问题 "There is no such thing as a "compiled language" or "interpreted language". Whether a language implementer chooses to write a compiler, an interpreter or anything in between is an implementation detail and has nothing to do with the language. " Is the above statement is true ? 回答1: Yes, it is true in the strictest interpretation. You can find both a C++ interpreter and a Javascript compiler, for example. However, you will find that some types of languages (statically typed, for example) lend