interpreter

Printing Unicode from Scala interpreter

半世苍凉 提交于 2019-11-28 09:43:20
When using the scala interpreter (i.e. running the command 'scala' on the commandline), I am not able to print unicode characters correctly. Of course a-z, A-Z, etc. are printed correctly, but for example € or ƒ is printed as a ?. print(8364.toChar) results in ? instead of €. Probably I'm doing something wrong. My terminal supports utf-8 characters and even when I pipe the output to a seperate file and open it in a texteditor, ? is displayed. This is all happening on Mac OS X (Snow Leopard, 10.6.2) with Scala 2.8 (nightly build) and Java 1.6.0_17) I found the cause of the problem, and a

Is it possible to have multiple PyPlot windows? Or am I limited to subplots?

帅比萌擦擦* 提交于 2019-11-28 08:07:46
I'm not sure how to word my question more clearly. Basically, is PyPlot limited to one instance/window? Any hack or workaround I try either causes my program to freeze or for the second pyplot window to be queued until the first one is closed. Joe Kington Sure, just open a new figure: import matplotlib.pyplot as plt plt.plot(range(10)) plt.figure() plt.plot(range(10), 'ro-') plt.figure(), plt.plot(...) plt.show() # only do this once, at the end If you're running this in the default python interpreter, this won't work, as each figure needs to enter the gui's mainloop. If you want to run things

How do I get the current depth of the Python interpreter stack?

巧了我就是萌 提交于 2019-11-28 07:58:52
问题 From the documentation: sys.getrecursionlimit() Return the current value of the recursion limit, the maximum depth of the Python interpreter stack. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python. It can be set by setrecursionlimit(). I am currently hitting the recursion limit when pickling an object. The object I am pickling only has a few levels of nesting, so I am a bit puzzled by what is happening. I have been able to circumvent the issue

scala as scripting language [duplicate]

孤街醉人 提交于 2019-11-28 07:17:28
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: “eval” in Scala I know scala is a compiled language, but I do also know that I can dynamically load classes into the jvm, and I can call the scala compiler at runtime, last but not least I do also have an awesome repl, so having scala as a scripting language should be possible. so there are some tasks I need to get to run: simple interpret: val src = """ println("Hello World") """ interpret(src) call external

AST interpreter?

好久不见. 提交于 2019-11-28 07:03:40
I have an AST (abstract syntax tree) and now i want to test my compiler by giving it 2 or more numbers and expect an output with the result of math operations (like a calculator). My question is, what is the best way to build the interpreter? The visiting of the AST nodes is recursive, so i don't know how many encapsulated calculations exists until i get to the end of the tree. But since this is done iteration by iteration, how can i make all the operations in the end? Thank you Intepreters are pretty easy to code, once you have an AST: int interpret(tree t) { /* left to right, top down scan

Is Ruby really an interpreted language if all of its implementations are compiled into bytecode?

爱⌒轻易说出口 提交于 2019-11-28 06:55:58
In the chosen answer for this question about Blue Ruby , Chuck says: All of the current Ruby implementations are compiled to bytecode. Contrary to SAP's claims, as of Ruby 1.9, MRI itself includes a bytecode compiler, though the ability to save the compiled bytecode to disk disappeared somewhere in the process of merging the YARV virtual machine. JRuby is compiled into Java .class files. I don't have a lot of details on MagLev, but it seems safe to say it will take that road as well. I'm confused about this compilation/interpretation issue with respect to Ruby. I learned that Ruby is an

C# Scripting language

谁说胖子不能爱 提交于 2019-11-28 06:34:17
This is a somewhat odd question. I want to provide a scripting language for modding games that I build for XNA. If I was deplying these games for the PC then I would just be able to use C# files, compiled at runtime (Using reflection.emit ) as scripts and that would be fine - a nice simple way to mod the game. However, the .net compact framework (which is what the xbox provides) does not support reflection.emit, so how can I write a scripting language taking this into account? Are there any projects already doing this Are there any good resources to start my own project to do this What would

Assigning a value to single underscore _ in Python/IPython interpreter

不想你离开。 提交于 2019-11-28 05:10:37
I created this function in Python 2.7 with ipython : def _(v): return v later if I call _(somevalue) , I get _ = somevalue . in[3]: _(3) out[3]: 3 in[4]: print _ out[4]: 3 The function has disappeared! If I call _(4) I get: TypeError: 'int' object is not callable` Why? What's wrong with this function? The Python interpreter assigns the last expression value to _ . This behaviour is limited to the REPL interpreter only, and is intended to assist in interactive coding sessions: >>> import math >>> math.pow(3.0, 5) 243.0 >>> result = _ >>> result 243.0 The standard Python interpreter goes to some

What is the difference between implementing a compiler and an interpreter?

佐手、 提交于 2019-11-28 05:01:19
I've read the whole Dragon Book recently (just for fun, I'm not really planning to implement an actual compiler), and I was left with this big question dangling in my head. What is different between implementing a compiler and an interpreter? To me a compiler is made up of: Lexer Parser (which builds the syntax tree) Generate Intermediate code (like 3 address code) Do all these crazy things to optimize if you want :-) Generate "assembly" or "native code" from the 3 address code. Now, obviously, the interpreter also has the same lexer and parser as the compiler. But what does it do after that?

Does Pycharm have Interactive Python Interpreter?

∥☆過路亽.° 提交于 2019-11-28 04:55:46
I am a fairly new Pycharm user switched from other IDEs recently. One question I have is about the interactive python interpreter, which is the "window" I can type in variables to check them after I ran my script. Pyscripter has this thing called "Python interpreter" and I know Pycharm also has. I tried "Python Console" under "Tools", but I don't think it's the same thing. So I am wondering how I can find this Python Interpreter in Pycharm? I am using Community version 3. I'm using Pycharm community edition version 2016.1.2 I do the following to get an interactive prompt when debugging Debug a