interpreter

Simplest language to make an interpreter for

I want to make an interpreter of a very simple language for practice. When I say simple I don't mean easy to use, I mean simple. Brainf**k is a good example of a language I want. I already have made a brainf**k interpreter in python (which is the language I would be using to write the interpreter). I would appreciate any suggestions of s...

Interpreted languages: The higher-level the faster?

I have designed around 5 experimental languages and interpreters for them so far, for education, as a hobby and for fun. One thing I noticed: The assembly-like language featuring only subroutines and conditional jumps as structures was much slower than the high-level language featuring if, while and so on. I developed them both simultan...

Interpreters: How much simplification?

In my interpreter, code like the following x=(y+4)*z echo x parses and "optimizes" down to four single operations performed by the interpreter, pretty much assembly-like: add 4 to y multiply <last operation result> with z set x to <last operation result> echo x In modern interpreters (for example: CPython, Ruby, PHP), how simplifi...

How to implement arrays in an interpreter?

I have managed to write several interpreters including Tokenizing Parsing, including more complicated expressions such as ((x+y)*z)/2 Building bytecode from syntax trees Actual bytecode execution What I didn't manage: Implementation of dictionaries/lists/arrays. I always got stuck with getting multiple values into one variable. My ...

What does it mean for a language to be ‘interpreted’?

Hi! A newbie question. Do languages like e.g. Ruby (if running MRI, I mean not compiled to byte-code) run actually parsed everytime when an execution of, e.g., method or loop body is needed? I mean, to execute a loop, you need to parse its body N times? I just always thought that all these programs are being parsed one time at the boot...

How fast should an interpreted language be today?

Is speed of the (main/only viable) implementation of an interpreted programming language a criteria today? What would be the optimal balance between speed and abstraction? Should scripting languages completely ignore all thoughts about performance and just follow the concepts of rapid development, readability, etc.? I'm asking this be...

Books On Creating Interpreted Languages

Are there ANY books (maybe even long tutorials) which cover making a basic, interpreted language? ...

How to efficently build an interpreter (lexer+parser) in C?

I'm trying to make a meta-language for writing markup code (such as xml and html) wich can be directly embedded into C/C++ code. Here is a simple sample written in this language, I call it WDI (Web Development Interface): /* * Simple wdi/html sample source code */ #include <mySite> string name = "myName"; string toCapital(strin...

Interpreter with a one-register VM - possible to evaluate all math. expressions?

I'm writing an interpreter. I've done that before but never tried one which can work with expressions like 3 + 4 * 2 / ( 1 − 5 ) ^ 2 ^ 3. I'm not having a problem with the parsing process, actually it is about my VM which then executes the code. My goal was a fast interpreter and so I decided not to use a stack-based VM where you would...

How does an interpreter switch scope?

I'm asking this because I'm relatively new to interpreter development and I wanted to know some basic concepts before reinventing the wheel. I thought of the values of all variables stored in an array which makes the current scope, upon entering a function the array is swapped and the original array put on some sort of stack. When leavi...

OpenSource programming-languages in development?

I'm very interested in interpreter and compiler development and because I don't want to continue building mini compilers and interpreters I thought I could help some open-source project. Are there currently open-source projects on compilers/interpreters in early stages seeking developers? I mean yeah.. There won't be much to do for som...

How would I code a complex formula parser manually?

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

Concatenative language inrepreter in Java

I'm interested in finding a concatenative language interpreter in Java. Ideally, it should satisfy the following conditions: It has an interpreter, not (only) a bytecode compiler for JVM. The language itself has decent documentation, not only a few examples and a "I'll document the rest someday" notice. The project is not completely ab...

What is the process of creating an interpreted language?

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

Interpreter typing in C

I'm developing an interpreter and I have some questions to it. I recently saw a small C interpreter that used a very simple struct like the below for all its objects/values in the language: struct Object { ubyte type; ubyte value; }; This struct can hold strings, integers, bools and lists (I think) used in the language the in...

PHP Interpreter/Compiler

I am trying to understand how the php compiler/interpretor works. I tried to download the php source code and tried to understand how it works. I was not able to find proper documentation. WOuld be great if someone could throw light on th modules that make the php compiler and also how the apache server uses the php compiler.. Thanks ...

Worst compiler error message

I had this from Visual Studio: 1>lol.cpp(780): error C2780: ''unknown-type' Wide::Interpreted::State::GlobalPush(T1 &&,T2 &&,T3 &&)' : expects 3 arguments - 1 provided 1> lol.cpp(312) : see declaration of 'Wide::Interpreted::State::GlobalPush' 1>lol.cpp(780): error C2780: ''unknown-type' Wide::Interpreted::State::GlobalPush(T1 ...

every language eventually compiled into low-level computer language?

Isn't every language compiled into low-level computer language? If so, shouldn't all languages have the same performance? Just wondering... ...

Python Code Introspection and Analysis

Hi, I am trying to write a Python code analyzer, and I am trying to avoid having to parse bare Python text files. I was hoping that once the Python compiler/interpreter parses the code there's a way to get to the object code or parse tree from within a running Python program. Is there anyway to do this? Thank you ...

what does the '~' mean in python?

what does the '~' mean in python? i found this BF interpreter in python a while ago. import sys #c,i,r,p=0,0,[0]*255,raw_input() c=0 i=0 p=raw_input() r=[0]*255 while c<len(p): m,n,u=p[c],0,r[i] if m==">":i+=1 if m=="<":i-=1 if m=="+":r[i]+=1 if m=="-":r[i]-=1 if m==".":sys.stdout.write(chr(u)) ...