interpreter

Managing libraries and imports in a programming language

I've created an interpreter for a stupid programming language in C++ and the whole core structure is finished (Tokenizer, Parser, Interpreter including Symbol tables, core functions, etc.). Now I have a problem with creating and managing the function libraries for this interpreter (I'll explain what I mean with that later) So currentl...

Interpreter in C++: Function table storage problem

In my interpreter I have built-in functions available in the language like print exit input, etc. These functions can obviously be accessed from inside the language. The interpreter then looks for the corresponding function with the right name in a vector and calls it via a pointer stored with its name. So I gather all these functions i...

"Strictly positive" in Agda

I'm trying to encode some denotational semantics into Agda based on a program I wrote in Haskell. data Value = FunVal (Value -> Value) | PriVal Int | ConVal Id [Value] | Error String In Agda, the direct translation would be; data Value : Set where FunVal : (Value -> Value) -> Value PriVal : ℕ...

Are there any FreeRTOS interpreted language libraries available?

I work for a company that created firmware for several device using FreeRTOS. Lately our request for new features has surpassed how much work our firmware engineers are capable of, but we can't afford to hire anyone new right now either. Making even tiny changes requires firmware people to go in and modify things at a very low level. ...

Implementing Brainf*ck loops in an interpreter

I want to build a Brainf*ck (Damn that name) interpreter in my freshly created programming language to prove it's turing-completeness. Now, everything is clear so far (<>+-,.) - except one thing: The loops ([]). I assume that you know the (extremely hard) BF syntax from here on: How do I implement the BF loops in my interpreter? How...

Language Design: Combining Gotos and Functions

I'm designing and currently rethinking a low-level interpreted programming language with similarities to assembler. I very soon came across the functions/loops/gotos decision problem and thought that while loops like while and for would be too high-level and unfitting, gotos would be too low level, unmaintainable and generally evil agai...

Interpreters: Handling includes/imports

I've built an interpreter in C++ and everything works fine so far, but now I'm getting stuck with the design of the import/include/however you want to call it function. I thought about the following: Handling includes in the tokenizing process: When there is an include found in the code, the tokenizing function is recursively called w...

Why are the interpreters of all popular scripting languages written in C (if not in C at least not in C++)?

I recently asked a question on switching from C++ to C for writing an interpreter for speed and I got a comment from someone asking why on earth I would switch to C for that. So I found out that I actually don't know why - except that C++ object oriented system has a much higher abstraction and therefore is slower. Why are the interpr...

Building your own Interpreter that can function as a compiler

It is possible for me to build my own Interpreter that could then be transformed into a compiler? If yes, how do I go about building it? ...

How do Ruby and Python implement their interactive consoles?

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

C++ interpreter conceptual problem

I've built an interpreter in C++ for a language created by me. One main problem in the design was that I had two different types in the language: number and string. So I have to pass around a struct like: class myInterpreterValue { myInterpreterType type; int intValue; string strValue; } Objects of this class are passed around mil...

C++ and its type system: How to deal with data with multiple types?

"Introduction" I'm relatively new to C++. I went through all the basic stuff and managed to build 2-3 simple interpreters for my programming languages. The first thing that gave and still gives me a headache: Implementing the type system of my language in C++ Think of that: Ruby, Python, PHP and Co. have a lot of built-in types which ...

Best Java library(ies) for forgiving command interpreter

I am looking for a library or set of libraries that will help me write a forgiving command interpreter. A forgiving command interpreter would be a command interpreter which can deal with simple and even not so simple spelling and word order mistakes in the input. My goal is to have an interpreter which would take the input (a command) ...

Ignoring (serious) errors to keep the program alive?

One of the main things I wanted to achieve in my experimental programming language was: When errors occur (Syntax, Name, Type, etc.) keep the program running, no matter how serious or devastating it is. I know that this is probably very bad, but I just wanted something that doesn't kill itself on every error - I find it interesting what ...

How exactly is a PHP script executed?

I was just thinking to myself "How exactly is a PHP script executed?" I thought it was parsed first for syntax errors etc, and then interpreted and executed. However, I don't know why I believe that is correct. I'm probably wrong. So, how exactly is a PHP file interpreted and executed? What stages does this involve? How do included fil...

Interpret Objective C scripts at runtime on iPhone?

Is there anyway to load an objective c script at runtime, and run it against the classes/methods/objects/functions in the current iPhone app? MAJOR NOTE: The major reason I'd like to do this is to allow me to rapidly prototype an application, and then, after I'm done a major prototyping phase, take the scripts I was writing and compile...

Do comments slow down an interpreted language?

I am asking this because I use Python, but it could apply to other interpreted languages as well (ruby, php, javascript). Whenever I leave a comment in my code, is it slowing down the interpreter? My limited understanding of an interpreter is that it reads program expressions in as strings and converts those strings into code. It seems ...

Python 3 online interpreter / shell

Does anyone know about an online interpreter like http://codepad.org/ or http://try-python.mired.org/ with Python 3? ...

C++: GUI libraries for embedding into an interpreter

I've got my interpreter up and running - quite bug-free and stable for now - now I want to add some visual options to my language to play around. What is a good GUI library easy to use and mainly easy to embed and "link" to my programming language? What general rules do I have to follow? I'm currently on XP with Microsoft Visual Stud...

dynamically create class in scala, should I use interpreter?

Hi, I want to create a class at run-time in Scala. For now, just consider a simple case where I want to make the equivalent of a java bean with some attributes, I only know these attributes at run time. How can I create the scala class? I am willing to create from scala source file if there is a way to compile it and load it at run tim...