Questions tagged [interpreter]

An interpreter is a program that executes, i.e. performs, instructions written in a programming language. The tag [interpreter] should be applied to questions concerning the programming of interpreters or for questions about the detailed inner workings of interpreters. Use [interpreter-pattern] (possibly with this tag) for questions about the Gang of Four design pattern.

An interpreter is a program that executes, i.e. performs, instructions written in a programming language.

An interpreter may be a program that either

  1. executes the source code directly
  2. translates source code into some efficient intermediate representation (code) and immediately executes this
  3. explicitly executes stored precompiled code1 made by a compiler which is part of the interpreter system

From wikipedia

2265 questions
68
votes
7 answers

How to write a Parser in C#?

How do I go about writing a Parser (Recursive Descent?) in C#? For now I just want a simple parser that parses arithmetic expressions (and reads variables?). Though later I intend to write an xml and html parser (for learning purposes). I am doing…
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
65
votes
10 answers

"/usr/bin/python^M: bad interpreter"

Cannot figure out, where to change EOF in PyCharm. My scripts start with : #!/usr/bin/python # -*- coding: utf-8 -*- It outputs something like this when I try to run it like an executable (chmode +x) : -bash: ./main.py: /usr/bin/python^M: bad…
woozly
  • 1,363
  • 1
  • 14
  • 24
65
votes
7 answers

Compiler vs Interpreter vs Transpiler

During a ReactJS session that I was attending, the presenter used a term transpiler for some code conversion/porting happening. In the past, I have heard the terms compiler and interpreter. I've used in the context of converting a user written…
RBT
  • 24,161
  • 21
  • 159
  • 240
58
votes
3 answers

How to get the current Python interpreter path from inside a Python script?

I want to run a Python script from a Python script with subprocess, and I wish to do it using the same interpreter for each of them. I'm using virtualenv, so I'd like to do something like: subprocess.Popen('%s script.py' % python_bin) How do I get…
Bite code
  • 578,959
  • 113
  • 301
  • 329
55
votes
3 answers

mod_php vs cgi vs fast-cgi

I have been trying to understand the exact meaning/purpose of loading php as an apache module vs the rest. When php is installed as an apache module, what exactly happens? For example, does reading the php-ini file happen every time the php request…
Karthick
  • 2,844
  • 4
  • 34
  • 55
53
votes
4 answers

Is it possible to have multiple PyPlot windows? Or am I limited to subplots?

I'm not sure how to word my question more clearly. Basically, is PyPlot limited to one instance/window? Any hack or workaround I try either causes my program to freeze or for the second pyplot window to be queued until the first one is closed.
wnewport
  • 1,013
  • 2
  • 10
  • 13
53
votes
2 answers

Python Compilation/Interpretation Process

I'm trying to understand the python compiler/interpreter process more clearly. Unfortunately, I have not taken a class in interpreters nor have I read much about them. Basically, what I understand right now is that Python code from .py files is…
NickHalden
  • 1,469
  • 2
  • 20
  • 31
51
votes
2 answers

Difference between compiled and interpreted languages?

What are the relative strengths and weaknesses of compiled and interpreted languages?
50
votes
1 answer

Constructing an Abstract Syntax Tree with a list of Tokens

I want to construct an AST from a list of tokens. I'm making a scripting language and I've already done the lexical analysis part, but I have no idea how to create an AST. So the question is, how do I take something like this: WORD, int WORD,…
metro-man
  • 1,763
  • 2
  • 15
  • 28
49
votes
2 answers

Why is string comparison so fast in python?

I became curious to understand the internals of how string comparison works in python when I was solving the following example algorithm problem: Given two strings, return the length of the longest common prefix Solution 1: charByChar My intuition…
david_adler
  • 9,690
  • 6
  • 57
  • 97
47
votes
8 answers

What are the differences between a Just-in-Time-Compiler and an Interpreter?

What are the differences between a Just-in-Time-Compiler and an Interpreter, and are there differences between the .NET and the Java JIT compiler?
Rookian
  • 19,841
  • 28
  • 110
  • 180
45
votes
6 answers

Is there an "immediate window" in Visual Studio Code to run Javascript?

Yes, I use F12 in the browser all the time to test out Javascript snippets with the console. I'm tired of that (for the moment anyway). I've read that in Visual Studio you can use the immediate window to run Javascript interactively.. I've haven't…
44
votes
1 answer

remove Anaconda environment with no name?

I was trying to create an Anaconda environment from Pycharm, but while I was experimenting different paths, one of the environments was created with no name. like the following: base * /Applications/anaconda3 snowflaks …
Amber G
  • 441
  • 1
  • 4
  • 3
44
votes
4 answers

Java Threads vs OS Threads

Looks like I have messed up with Java Threads/OS Threads and Interpreted language. Before I begin, I do understand that Green Threads are Java Threads where the threading is taken care of by the JVM and the entire Java process runs only as a single…
Geek
  • 23,089
  • 20
  • 71
  • 85
43
votes
8 answers

What are the primitive Forth operators?

I'm interested in implementing a Forth system, just so I can get some experience building a simple VM and runtime. When starting in Forth, one typically learns about the stack and its operators (DROP, DUP, SWAP, etc.) first, so it's natural to think…
Barry Brown
  • 20,233
  • 15
  • 69
  • 105