interpreter

Ruby Interpreter crashes with a certain word

Ok, this one's a little ridiculous, and I'm almost afraid no one will believe me. But here it goes: I have written a Ruby Rails application that handles content for tons of domains. Now I know this breaks the cardinal rule of Rails, but each domain has all of its information housed in a config file. I know this is probably wrong, but...

Python: Analyzing complex statements during execution

I am wondering if there is any way to get some meta information about the interpretation of a python statement during execution. Let's assume this is a complex statement of some single statements joined with or (A, B, ... are boolean functions) if A or B and ((C or D and E) or F) or G and H: and I want to know which part of the state...

how to simulate the concept of object identity in Haskell

I am considering the design of an interpreter for Python like object oriented language in Haskell. One particular problem I am facing is related to the concept of object identity. If we consider Python's id(object) function, the definition suggests that it returns the "identity" of an object. This is an integer (or long integer) which is...

Shift Reduce Conflict

import java_cup.runtime.*; import java.io.*; import java.util.*; /* Preliminaries to set up and use the scanner. */ parser code {: SMPLLexer lexer; public SMPLParser (SMPLLexer lex) { super(lex); lexer = lex; } public void report_error(String message, Object info) { System.err.println(messag...

C# Scripting language

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

C/C++ J2ME interpreter

Hello, do anyone know some C or C++ interpreter for cell phones? I have Nokia 5310 and found some Basic interpreter (CellBasic) and want to develop in C or C++ on the go. Or, does anybody knows Scheme J2ME intepreter? ...

Which perl can I use from the Windows command line?

Hi all: Can anyone recommend me a Perl interpreter that can run on Windows command line to read LCOV files (and generate a report of some sort)? I looked at genhtml, and it seems to need a lot of setup and must run in the bash shell environment, which doesn't sound good for Windows command line. Thanks. ...

What programming languages target J2ME?

I recently received a Nokia 5000 phone. Now I want to write software for it. Trouble is, I don't know Java. Now I've heard of other languages which supposedly make possible development without recourse to Java, languages like CellularBASIC (which looks a bit like QBASIC) and Hecl (which seems to be based on Tcl). Are these the only on...

WXPython xHTML/css interpreter

Is there an opensource library/package available that we could use to parse an xHTML/css file into wxPython layout instructions (inside a larger python program)? For the Pythics project, we need a better parser than the one written by our primary programmer, but his attempts to improve it are both making things better (stops ignoring CSS...

How to write an interpreter?

I have decided to write a small interpreter as my next project, in Ruby. What knowledge/skills will I need to have to be successful? I haven't decided on the language to interpret yet, but I am looking for something that is not a toy language, but would be relatively easy to write an interpreter for. Thanks in advance. ...

Doubt on using polymorphism in coding an expression parse tree/evaluator

I am working on an interpreter for a toy language, just to learn about building an interpreter. I have already implemented a simple parser for the grammar that generates a parse tree. Now, the usual way of evaluating the parse tree would be to use polymorphism on the nodes of the parse tree, with code that looks something like below (in ...

Printing Unicode from Scala interpreter

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

Are numerically indexed PHP arrays initialized contiguously or mapped?

Hello, I have a question in regard to PHP arrays. If I create an array $ids = array(); then put something in position 1000 of it: $ids[1000] = 5; How would the interpreter do this internally? Are arrays contiguous lumps of memory like Java? Would it be like int[1000] where 1000 ints are initlialized? Or is it more of a map wher...

C nested switches: outer switch's case inside inner switch

I'm adding coroutine support to an interpreter I'm writing and I'd like to do something like the following: typedef enum { bar_stuff, bar_other } Bar; typedef enum { foo_error=-1, foo_none=0, foo_again } Foo_state; Foo_state do_foo(Bar bar,Foo_state foo) { switch(foo) { case foo_none...

How can I write a quick and dirty interpreter?

I have an interview where one of the areas I was told I might brush up on is "dynamic programming languages". So I figured I might spend this weekend writing one to bring as sample code. :-) Of course, given the time constraints, I plan on writing something very basic and preferably using a language and/or toolset that will make it ex...

Interpreter that ignores leading >>> characters and ellipsis

Hi, I am studying some examples in a tutorial where there are a lot of leading >>> characters and ellipsis in the text. This makes it hard to cut and paste into the IPython interpreter since it doesn't like these strings. Is there another interpreter I could use that will appropriately ignore and interpret these leading terms? For exa...

Looking for a BASIC interpreter implemented in PHP

Does anyone know of a PHP program that will interpret BASIC code? I have seen a LOLCODE implementation that looks like it's a good place to start, but if anyone has already developed something like that, i'd be grateful. ...

Interpreted languages with manual memory management?

Which interpreted languages pointer-free languages (IE: Python, Java, Perl, PHP, Ruby, Javascript, etc) have manual memory management? I don't recall ever hearing of one. Isn't the major concern about interpreted languages the non-deterministic delays (or space complexity when there isn't enough delay) of garbage collection? So why not ...

What do you think about interpreter of usually compiled languages?

I worked with a C++ interpreter (CINT) and my experience was disastrous. It's full of bugs, strage behaviours, not standards... and I'm arrived to a conclusion: it's wrong to create an interpreter of a language born to be compiled because I think that the design of a language is strictly bounded to the fact that it will be interpreted or...

Drop into interpreter during arbitrary scala code location

I come from a Python background, where at any point in my code I can add import pdb; pdb.set_trace() and at runtime I'll be dropped into an interactive interpreter at that spot. Is there an equivalent for scala, or is this not possible at runtime? ...