interpreter

Custom interpreter in java

半世苍凉 提交于 2019-12-10 15:53:26
问题 Hi I want to write a program to be able to parse & execute some files The file consists of some custom commands (I want to be able to define commands and appropriate methods so when program see that command it should execute the appropriate method) It's grammar is not important for me; I just want to be able to define commands Something like a simple and small interpreter written in java. Is there any library for this purpose? Or I need to write by myself? Thanks 回答1: Java 6 (and newer) have

zeppelin hive interpreter throws ClassNotFoundException

亡梦爱人 提交于 2019-12-10 15:18:26
问题 I have deployed zeppelin 0.6 and configured hive under Jdbc interpreter. Tried executing %hive show databases Throws: org.apache.hive.jdbc.HiveDriver class java.lang.ClassNotFoundException java.net.URLClassLoader.findClass(URLClassLoader.java:381) java.lang.ClassLoader.loadClass(ClassLoader.java:424) sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) java.lang.ClassLoader.loadClass(ClassLoader.java:357) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:264)

Read Something After a Word in C++

点点圈 提交于 2019-12-10 12:19:11
问题 I'm building a simple interpreter of a language that i'm developing, but how i can do a cout of something that is after a word and in rounded by "", like this: #include <iostream> #include <fstream> #include <string> #include <cstdlib> using namespace std; int main( int argc, char* argv[] ) { if(argc != 2) { cout << "Error syntax is incorrect!\nSyntax: " << argv[ 0 ] << " <file>\n"; return 0; } ifstream file(argv[ 1 ]); if (!file.good()) { cout << "File " << argv[1] << " does not exist.\n";

How would I code a complex formula parser manually?

大城市里の小女人 提交于 2019-12-10 03:52:28
问题 Hm, this is language - agnostic, I would prefer doing it in C# or F#, but I'm more interested this time in the question "how would that work anyway". What I want to accomplish ist: a) I want to LEARN it - it's about my ego this time, it's for a fun project where I want to show myself that I'm a really good at this stuff b) I know a tiny little bit about EBNF (although I don't know yet, how operator precedence works in EBNF - Irony.NET does it right, I checked the examples, but this is a bit

How do interpreters written in C and C++ bind identifiers to C(++) functions

我们两清 提交于 2019-12-10 03:49:11
问题 I'm talking about C and/or C++ here as this are the only languages I know used for interpreters where the following could be a problem: If we have an interpreted language X how can a library written for it add functions to the language which can then be called from within programs written in the language? PHP example: substr( $str, 5, 10 ); How is the function substr added to the "function pool" of PHP so it can be called from within scripts? It is easy for PHP storing all registered function

Will the Javascript performance improvements from Trace Trees find their way into other interpreted languages?

岁酱吖の 提交于 2019-12-09 17:25:42
问题 It sounds like Mozilla is having good luck improving JavaScript performance with TraceMonkey. See also Andreas Gal's paper on Trace Trees. Are these improvements available to other interpreters/compilers and if so, does this mean we'll see a cascade of improvements in other interpreted languages? 回答1: There's a research JVM by Andreas Gal called HotPath, and some people from his team are currently working on adding nested trace tree based JITting to Maxine (Sun's new research JVM written in

How do Ruby and Python implement their interactive consoles?

只谈情不闲聊 提交于 2019-12-09 16:39:42
问题 When implementing the interpreter for my programming language I first thought of a simple console window which allows the user to enter some code which is then executed as a standalone program as a shell. But there are severe problems: If every line of code the user enters is handled as a standalone program, it has to go through the tokenizer and parser and is then just executed by the interpreter - what about functions then? How can the Python/Ruby interactive consoles (IDLE, irb) "share"

python: ignoring leading “>>>” and “…” in interactive mode?

天大地大妈咪最大 提交于 2019-12-09 15:46:55
问题 Many online python examples show interactive python sessions with normal leading ">>>" and "..." characters before each line. Often, there's no way to copy this code without also getting these prefixes. In these cases, if I want to re-paste this code into my own python interpreter after copying, I have to do some work to first strip off those prefixes. Does anyone know of a way to get python or iPython (or any other python interpreter) to automatically ignore leading ">>>" and "..."

Performance improvement strategies for VM / interpreter?

冷暖自知 提交于 2019-12-09 13:37:17
问题 I have written a simple VM in C, using a simple switch of instructions, without any instruction decoding whatsoever, but performance is terrible. For simple aritmetic operations the VM is about 4000 times slower than native C code for the same operations. I tested with a group of arrays of length 10 million, the first consisting of the program instructions, random + - * / operations, 2 arrays holding random integers and the third array being the operation target storage. I was expecting to

What is the process of creating an interpreted language? [duplicate]

为君一笑 提交于 2019-12-09 06:54:29
问题 This question already has answers here : Learning to write a compiler [closed] (39 answers) Closed 6 years ago . I want to create a very simple experimental programming language. What are some resources can i check out to get an overview of the process of creating an interpreted language. I will be using c++ to build and compile the interpreter. 回答1: You need to implement both a parser and an interpreter. There is a great free text book called "Programming Languages: Application and