Questions tagged [interpreters]

Interpreters are tools to execute a programme or a script by reading statements written in a programming language and performing the actions required according to the semantics of the interpreted language.

Filter by
Sorted by
Tagged with
4 votes
1 answer
363 views

How to bind C/C++ functions for my language [closed]

I'm making an interpreter (currently in python but later I'll remake it in C++) and I wondered how I could use a C/C++ function in my language so when somebody wants to write an extension for my ...
Oliver JT's user avatar
-1 votes
2 answers
169 views

When writing a tokenizer, what is the standard practice for handling aliased language keywords?

When writing a tokenizer, what is the standard practice for handling aliased language keywords? For example, notethat signed short int is a language keyword in C++ and several aliases might be allowed....
Samuel Muldoon's user avatar
26 votes
10 answers
7k views

Why are commonly compiled languages not interpreted for faster iteration?

We're all too familiar with waiting for compilation, especially on large projects. Why isn't a thing to interpret a codebase for quick iterative development instead of generating code for a binary ...
gust's user avatar
  • 377
5 votes
3 answers
696 views

How does a JIT compiler actually emit and then call the emitted native code?

Assuming that a VM runs a JIT compiler on otherwise "interpreted" code, such as a line by line interpreter or some form of bytecode/IL code and determines that it can create optimised native ...
AIWalker's user avatar
  • 1,287
1 vote
1 answer
107 views

Variable binding time (Steve McConnell)

Currently reading Steve McConnell "Code complete". "General issues in using variables" chapter, "Binding time" section. He says about variable's binding time in such ...
CoderDesu's user avatar
  • 1,015
2 votes
3 answers
159 views

How to deal with interpreter dependencies

Consumer software often has interpreter dependencies. How should a situation where the required interpreter is not by default installed on the targeted system be handled for consumer software, soft ...
eds1999's user avatar
  • 165
0 votes
0 answers
120 views

Does v8 have nested stack frames?

In chapter 4 of the Zone JS primer the following is mentioned: So far, we have discussed how zones are created, forked and how they maintain their state across asynchronous operations. Zones are ...
p32094's user avatar
  • 177
3 votes
2 answers
108 views

How do language implementations implement native-extension class instantiation?

I'm writing a language interpreter in C. I'm currently implementing a system that allows writing extension modules in C for the interpreter. These modules are loaded into a code file like a normal ...
Aviv Cohn's user avatar
  • 21.3k
1 vote
2 answers
140 views

How do VMs and GCs treat objects which wrap yet active resources, but that are unreachable from user code?

I am building an interpreter in C for a simple programming language. The interpreter is fitted with a built in garbage collector. The GC simply marks all objects which are linked from some root (the ...
Aviv Cohn's user avatar
  • 21.3k
3 votes
1 answer
176 views

How can one bake a GUI framework inside an interpreter without freezing the interpreter?

I am writing a bytecode interpreter in C for a simple programming language. I want to add GUI capabilities to the language. As a first step, I decided to bake into the interpreter a wrapper for the ...
Aviv Cohn's user avatar
  • 21.3k
4 votes
4 answers
1k views

Ahead-of-time compilation to native machine code of dynamically typed languages

It is my understanding that: It's particularly difficult to compile ahead of time, to efficient native machine code, a dynamically typed language like Python. Largely as a result of the above, the ...
Amelio Vazquez-Reina's user avatar
-3 votes
1 answer
62 views

What are the existing solutions for creating object graphs in an interpreter?

Please let me know if this isn't the right SE site (or otherwise) for this kind of question, it's the best match I could find. I'm working on a humble interpreter written in C for a simple language I'...
Aviv Cohn's user avatar
  • 21.3k
-2 votes
3 answers
3k views

Is it really always easier to write an interpreter than a compiler?

I've read that generally it's easier to write an interpreter than a compiler. If that's true, what's the reason? Writing an interpreter seems to me equivalent in the level of difficulty as writing a ...
Ben's user avatar
  • 35
0 votes
1 answer
268 views

Are parser generators useful for parsing a shell language?

From my understanding, parser generators accept as input some form of context-free grammar description. The context-sensitive features are handled during semantic rather than syntactic analysis (...
sealmove's user avatar
7 votes
2 answers
611 views

Transpiling <XY> language into a custom one

Our company has a legacy assembly-like language with some terrible design choices. I'm pretty sure the language is not going to change, since way too many legacy things might change their behavior ...
original.roland's user avatar
0 votes
3 answers
243 views

Resolving function calls as function arguments using a stack

After doing a bit of reading, I have a vague understanding of the use of a stack in calling functions when one function calls another, where the arguments are placed on the stack for the called ...
mydoghasworms's user avatar
7 votes
2 answers
2k views

How can one interpret an Abstract Syntax Tree without recursion?

I am busy building an interpreter for a Rebol-like language. I have previously built a Lisp interpreter where I used recursion, but now I just want to use a stack and not rely on the recursion ...
mydoghasworms's user avatar
2 votes
5 answers
1k views

Why do we need to embed an interpreter in a program?

Emacs loads into memory as: An editor that has m functions with n inputs. An elisp interpreter that can be used to change the behavior without restart. Why do programs need such an extension that is ...
Nishant's user avatar
  • 575
1 vote
3 answers
1k views

Language of an interpreter

I am trying to make my own programming language by making an interpreter for it in Java, but lately people have been telling me that an interpreter needs to be in the same language as the one it is ...
bhalec's user avatar
  • 31
-4 votes
1 answer
57 views

Writing an application that calls another application for some tasks: how it works?

I have written a C++ code that calls a solver called CPLEX to solve an integer linear optimization problem (under Ubuntu 18.04). I have three sets of data and I use make command to create 3 ...
rasul's user avatar
  • 93
2 votes
4 answers
2k views

Why use Java as a server-side language over an interpreted language?

Web pages are usually tested by refreshing the page, clicking some UI component, then either writing to a debug log or adding some breakpoints in the IDE... in larger applications, unit tests are ...
Kellen Stuart's user avatar
3 votes
2 answers
506 views

Direction to take to improve a AST interpreter

I'm looking for some opinions/advices about a particular subject. Here is the situation : I'm developing for fun, in my spare time, a programming language interpreter made in C# and I'm looking for ...
Veler's user avatar
  • 41
0 votes
2 answers
4k views

What does it mean, "Php doesn't have its own runtime"?

Speaking of php. It doesn't really have its own runtime in compare to python, ruby or go. Php is jsut a text preprocessor. What exactly does it mean by, Php doesn't have runtime?
Caleb's user avatar
  • 141
13 votes
3 answers
7k views

How are variables stored in a language compiler or interpreter?

Say we set a variable in Python. five = 5 Boom. What I'm wondering is, how is this stored? Does the compiler or interpreter just put it in a variable like so? varname = ["five"] varval = [5] If ...
baranskistad's user avatar
24 votes
2 answers
3k views

Is it possible to create a "bootstrapped" interpreter independent of the original interpreter?

According to Wikipedia, the term "bootstrapping" in the context of writing compilers means this: In computer science, bootstrapping is the process of writing a compiler (or assembler) in ...
Christian Dean's user avatar
61 votes
14 answers
14k views

Can we make general statements about the performance of interpreted code vs compiled code?

I'm comparing two technologies in order to reach a recommendation for which one should be used by a company. Technology A's code is interpreted while technology B's code is compiled to machine code. ...
EpicSam's user avatar
  • 870
2 votes
1 answer
1k views

Do bytecode compilers compile syntax directly or intermediate assembly language?

I am going to write a very simple VM and bytecode compiler. Is it typical for a bytecode compiler to read the syntax and attempt to create the bytecode directly or is there an intermediate stage to ...
Synaps3's user avatar
  • 147
0 votes
1 answer
782 views

Designing a small object-oriented interpreter

I'm building a small interpreter for a language I created. The grammar, lexer and syntax analyzer are already done. What's confusing me is the interpreter part. I know interpreter pattern, but it ...
Gabriel's user avatar
  • 119
1 vote
0 answers
495 views

Properly implementing the dot notation with ANTLR4 visitors?

I am implementing the dot operator/notation you see in languages (obj.method();) with ANTLR4. Everything is working fine (except one thing), a simple hello world program works: module test; sfunc ...
mid's user avatar
  • 124
1 vote
2 answers
655 views

How can an interpreter produce output of some code, without having the computing components like ALU of a processor?

I have gone through lot of explanations about a compiler and interpreter. I think I understood the difference between compiler and interpreter clearly. I'll explain my learning through the following ...
AV94's user avatar
  • 161
1 vote
1 answer
218 views

Does Groovy/Grails have code completion/pre-runtime error detection/find refrences like Java?

I have been using Java for a while and PHP recently. Some things I miss from Java is Code completion suggestions from the IDE Error detection before runtime Find places where a method/function is ...
Can't Tell's user avatar
  • 1,161
27 votes
2 answers
1k views

What semantic features of Python (and other dynamic languages) contribute to its slowness?

I don't know very well Python. I'm trying to understand more precisely what exact features of dynamic languages (à la Python, Lua, Scheme, Perl, Ruby, ....) are forcing their implementations to be ...
Basile Starynkevitch's user avatar
5 votes
3 answers
5k views

How Does An Interpreter Work? [closed]

I've been searching for tons of websites for how an interpreter works, but I found none of these explain how Interpreter works internally. But I found in many places how compiler works with all the ...
Susantha7's user avatar
  • 396
-1 votes
2 answers
174 views

Parse expressions on custom interpreter

I'm currently developing my own (sort of) programming language. It currently looks something like this: asdf = 2; print(asdf); And print(2); And surprisingly, it works. (Both output 2) However, ...
mid's user avatar
  • 124
0 votes
3 answers
3k views

Are browser console errors 'compiler errors', 'runtime errors', or neither?

I was trying to communicate with a coworker about a JavaScript error I was being notified about in my browser's console window when I realized that I wasn't sure if I should refer to this as a ...
8protons's user avatar
  • 1,369
25 votes
3 answers
3k views

In which process does syntax error occur? (tokenizing or parsing)

I'm trying to understand compilation and interpretation, step by step figuring out a total image. So I came up to a question while reading http://www.cs.man.ac.uk/~pjj/farrell/comp3.html this article ...
FZE's user avatar
  • 469
4 votes
0 answers
152 views

Laissez faire memory management [duplicate]

I noticed that various scripting language interpreters leak memory even for very simple programs, like the canonical "Hello world!" program. To illustrate the problem with examples: Perl 5.22 leaks ...
Mael's user avatar
  • 2,335
5 votes
2 answers
592 views

Testing strategies for interpreter language parser

For a recent personal project, I started working on an interpreter for my own programming language. One of the ground rules I set for myself on this project is that I need to properly test as much of ...
Chris's user avatar
  • 98
1 vote
0 answers
312 views

Does PyPy or Jython run untrusted Python 3 code more secure while still being fast?

I know that one can not securely restrict normal CPython's capabilities to properly run foreign code without allowing it to access some builtins like open() or allowing other kinds of I/O. So I ...
Byte Commander's user avatar
1 vote
1 answer
486 views

Scheme : Lambda inside quoted list is unbound

I'm programming a small lisp/scheme interpreter and I came across the following situation : When a quoted list contains lambdas, they are not parsed as lambdas. Here is a sample code (live on repl....
Julien__'s user avatar
  • 249
3 votes
1 answer
240 views

what happens at Java interpreter level when IncompatibleClassChangeError is thrown?

I am a noob at JVM internals. Can someone explain what happens at Java interpreter level when IncompatibleClassChangeError is thrown? I am facing an issue similar to the one described here: https:...
xerocool's user avatar
1 vote
2 answers
97 views

Scheduling/suspending embedded interpreters

Let's say that I want to embed a scripting engine inside some other program, to allow users to create custom behaviours for objects. For example, when a particular event happens, the server would ...
user avatar
4 votes
1 answer
186 views

How to approach syntax errors when developing a lexical analyser?

I am writing an interpreted domain-specific language for my application. Each statement is parsed and executed as soon as lexical analyser decides that the end of statement is reached. It's handling ...
Mirac7's user avatar
  • 149
2 votes
1 answer
443 views

Questions about compiler/interpreter design [closed]

I am implementing a programming language, for fun, in C. I have most of the parsing code done and also the AST ready. I once did write a runtime for this language some time ago, but I had some trouble ...
Guilherme Nemeth's user avatar
49 votes
6 answers
15k views

Does an interpreter produce machine code?

I study the topics of compilers and interpreters intensively. I want to check if my base understanding is right, so let's assume the following: I have a language called "Foobish" and its keywords are ...
GrayFox's user avatar
  • 629
24 votes
4 answers
20k views

How does Chrome V8 work? And why was JavaScript not JIT-Compiled in the first place?

I have been researching Interpreters/Compilers, then I stumbled across JIT-Compilation - specifically Google Chrome's V8 Javascript Engine. My questions are - How can it be faster than standard ...
b0yfriend's user avatar
  • 669
2 votes
2 answers
241 views

What should JITed bytecode do exactly?

I'm working on a VM (and a scripting language for it) that I plan to implement JITing for. I'm only working on the "plumbing" of it now, but I don't want the JIT compiler to be an afterthought. ...
Famand's user avatar
  • 21
-2 votes
1 answer
1k views

Why is Ruby's interpreter so small? [closed]

I noticed that the filesize of Ruby's interpreter seems suspiciously small. I would have expected /bin/dash to be the smallest of all, but is 20x larger than Ruby: Interpreter Bytes -----------...
Caleb Paul's user avatar
1 vote
1 answer
143 views

how do interpreters differ for statically- or dynamically-typed languages?

Writing an interpreter for a dynamically typed language usually involves creating an Environment, a data structure which stores mappings of variable names to their values. Values are boxed in some ...
Daniel Shapero's user avatar
9 votes
8 answers
2k views

What stops C from being compiled/interpreted/JIT'ed?

Java is often praised for its amazing portability, which I presume is because of the JVM. My question is what stops C from being being compiled/interpreted/JIT'ed.., if so, C can also be write once ...
SphericalCow's user avatar