interpreter

Lisp evaluation of let statements

I am writing a Scheme interpreter, and I am faced with a valid let statement such as: ;; should print 7 (let ((a 4) (b 3)) (let ((a (* a a)) (b (* b b))) (+ a b) (- a b))) My interpreter implements only a purely functional subset of Scheme, so there will be no side effects such as set!. In a purely functio...

Tab-completion in Python interpreter in OS X Terminal

Several months ago, I wrote a blog post detailing how to achieve tab-completion in the standard Python interactive interpreter--a feature I once thought only available in IPython. I've found it tremendously handy given that I sometimes have to switch to the standard interpreter due to IPython unicode issues. Recently I've done some work...

How would one go about testing an interpreter or a compiler?

Hello all! I've been experimenting with creating an interpreter for Brainfuck, and while quite simple to make and get up and running, part of me wants to be able to run tests against it. I can't seem to fathom how many tests one might have to write to test all the possible instruction combinations to ensure that the implementation is p...

Is there a quick-starting Haskell interpreter suitable for scripting?

Does anyone know of a quick-starting Haskell interpreter that would be suitable for use in writing shell scripts? Running 'hello world' using Hugs took 400ms on my old laptop and takes 300ms on my current Thinkpad X300. That's too slow for instantaneous response. Times with GHCi are similar. Functional languages don't have to be slow...

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

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...

How to add external library to the classpath in scala's interpreter?

I'm trying to reference some classes in the Scala Interpreter that were writen and compiled using Eclipse. Eclipse stores compiled Java byte code in a folder {workspace}/myProject/bin. Is there some command which will add this folder to the classpath used by the Scala Interpreter? Maybe scala.bat should be edited or parameterized with s...

Errors in Flex 3 XML implementation? Rewriting xml:lang

So I'm working on a quick utility to allow simple editing for TMX files. TMX is basically an XML-based standard for storing multilingual translations. Anyhoo, I'm importing TMX into an Adobe AIR app via a File reference, then grabbing the file stream, slapping the UTF-8 characters into a string, and then that string into an XML object. T...

Can a Non-Interpreted language have a Garbage Collector ?

Is it possible for a Non-Interpreted language to have a Garbage collector. Interpreted languages have the Interpretor executing the Program line by line so the Interpretor might just as well provide a runtime with a GC. But is it possible to have a Garbage collector for any other language without building the GC in your code itself ? ...

How does code written in one language get called from another language

This is a question that I've always wanted to know the answer, but never really asked. How does code written by one language, particularly an interpreted language, get called by code written by a compiled language. For example, say I'm writing a game in C++ and I outsource some of the AI behavior to be written in Scheme. How does the c...

Difference between a bytecode parsed instruction and machine language?

"A bytecode program is normally executed by parsing the instructions one at a time. This kind of bytecode interpreter is very portable. Some systems, called dynamic translators, or "just-in-time" (JIT) compilers, translate bytecode into machine language as necessary at runtime: this makes the virtual machine unportable." A question ...

Why python compile the source to bytecode before interpreting?

Why python compile the source to bytecode before interpreting? Why not interpret from the source directly? ...

How to Represent Classes in an Abstract Syntax Tree Based Interpreter

I have read the related questions, but none of them appears to address the question directly. I am working on writing a PHP script interpreter. I have the AST generating proper nodes for everything except classes. Handling classes is a bit different than handling functions, so I am looking for how to handle classes that are standalone...

VM Design: More opcodes or less opcodes? What is better?

Don't be shocked. This is a lot of text but I'm afraid without giving some detailed information I cannot really show what this is all about (and might get a lot of answers that don't really address my question). And this definitely not an assignment (as someone ridiculously claimed in his comment). Prerequisites Since this question can...

Problem with Python interpreter in Eclipse

When trying to set the interpreter for python in Eclipse by choosing the executable, clicking OK displays "An error has occured." Does the interpreter name matter? ...

javacc parseException... lookahead problem?

I'm writing a parser for a very simple grammar in javacc. It's beginning to come together but at the moment I'm completely stuck on this error: ParseException: Encountered "" at line 4, column 15. Was expecting one of: The line of input in question is z = y + z + 5 and the production that is giving me problems is my expression w...

Is INTERPRETER an anti-pattern?

To me, the Interpreter patten sounds very much like an anti-pattern known as Greenspun's tenth rule: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. That is, if you need to use Interpreter, you're likely to create something that's sl...

Interpret something, and run the generated bytecode in Java?

I'm writing a toy interpreter with a REPL in Java. I'd like to generate bytecode from the language and run that, instead of interpreting an AST and running that instead. Since my Java is a bit rusty, is it possible to run generated bytecode on the fly on the JVM? ...

Using ML in "Real-World" Applications

I really liked learning ML at college. I find functional programming often a refreshingly elegant way to write certain algorithms. I have heard of F# and played around with that a bit. Still, I've written some interesting functions in ML and would like to integrate them as libraries I could use in other applications. Usually I paste ...

What kind of language should I design for a particle engine scriptable engine?

I was wondering which kind of expressiveness fits a language used to generate particle effects.. Supposing to want an engine as flexible as possible what kind of 'features' should it have? (in addition to trivial ones like color, position, velocity, acceleration) ...

Images for Assembler, Interpreter and Compiler?

I got an assignment to make hand-drawn posters of Assembler Interpreter Compiler I googled for images of above three but not able to get some exact images which can define the above three properly. Can anyone share some image links which will give an idea about what is Assembler, Interpreter and compiler in computers. Thanks ...