Having to do with issues arising when implementing a programming language.
Questions tagged [language-implementation]
141 questions
1
vote
1 answer
How do I find out what Python implementation I am using?
Is there a simple way, like one command, that will enable me to find what Python implementation I am using (CPython, JPython, etc.)?

Rohan
- 482
- 6
- 16
1
vote
2 answers
How does the decimal accuracy of Python compare to that of C?
I was looking at the Golden Ratio formula for finding the nth Fibonacci number, and it made me curious.
I know Python handles arbitrarily large integers, but what sort of precision do you get with decimals? Is it just straight on top of a C double…

Chris Cooper
- 17,276
- 9
- 52
- 70
1
vote
1 answer
Creating FFI between C and my language
Let's say that I have implemented a programming language, (we'll call it A for now). A is pretty similiar to C.
I want my users to be able to access functions and data structures from already-existing C libraries. Is this possible? If it is, how…

sjaustirni
- 3,056
- 7
- 32
- 50
1
vote
2 answers
Location of methods and classes in Python3 interpreter
Our professor told us today that we can build an iterator, e.g.
class IteratorExample:
def __init__(self, n):
pass
def __iter__(self):
return self
def __next__(self):
if cond:
pass
else:
…

blz
- 403
- 6
- 12
1
vote
1 answer
Is it safe to create a DynamicExpression inside the Fallback of another DynamicExpression?
The title is pretty self explanatory on this one.
To clarify: I've built a pretty complete language infrastructure using dynamic expressions and thought it would be cool to try outputting an assembly. Anybody with experience doing this knows…

SilverX
- 1,509
- 16
- 18
1
vote
1 answer
JavaScript conventions for implementation-defined identifiers
In C, if a compiler wants to provide implementation-defined identifiers (language extensions, intrinsics, pseudo-functions and pseudo-macros, basically anything that's not a reserved keyword by the language standard but also isn't a regular…

rwallace
- 31,405
- 40
- 123
- 242
1
vote
2 answers
Garbage collection and runtime type information
The fixnum question brought my mind to an other question I've wondered for a long time.
Many online material about garbage collection does not tell about how runtime type information can be implemented. Therefore I know lots about all sorts of…

Cheery
- 24,645
- 16
- 59
- 83
1
vote
3 answers
How to implement a functional language
I'm trying to learn the differences between imperative and functional languages.
And also, I want to learn about closures and how garbage collectors are implemented. So I decided to try to implement an interpreter for a functional language.
Since…

haipeng31
- 635
- 1
- 7
- 16
1
vote
1 answer
Implementation of Prolog in a Pure Functional Language
I would be greatly appreciative of a simple pseudo-code algorithm for implementing Prolog, where the pseudo-code is taken to be for a pure functional language.

Jimster
- 131
- 2
1
vote
2 answers
What would the consequences be of allowing special forms to be treated as normal values?
I discovered that special forms can not be passed as arguments or saved in variables, both in Clojure:
user=> (defn my-func
[op]
(op 1 2 3))
#'user/my-func
user=> (my-func +)
6
user=> (my-func if)
java.lang.Exception: Unable to…

Matt Fenwick
- 48,199
- 22
- 128
- 192
0
votes
2 answers
Are function declarations and function expressions implemented differently in Go? If yes, why?
I just got into programming again with Go (with no experience whatsoever in low-level languages), and I noticed that function expressions are not treated the same as function declarations (go1.18.5 linux/amd64).
For instance, this works…

marcosdly
- 29
- 2
0
votes
3 answers
How CPython handles multiline input in REPL?
Python's REPL reads input line by line.
However, function definitions consist from multiple lines.
For example:
>>> def answer():
... return 42
...
>>> answer()
42
How does CPython's parser request additional input after partial def answer():…

gavrilikhin.d
- 554
- 1
- 7
- 20
0
votes
1 answer
What am I doing wrong? Implementing a custom Google Search using NationBuilder
I have followed all the instructions on how to Implement a custom Google Search using NationBuilder (https://nationbuilder.com/implementing_a_custom_google_search_using_nationbuilder?page=2)
The search bar comes up on the website, but no search…

Lissy_G
- 1
0
votes
1 answer
Precedence/associativity implmentation
I'm currently implementing a LR(k) parser interpreter, just for fun.
I'm trying to implement the precedence and associativity.
I got a little stuck when it came to how to assign associativity and precedence for the 'action' part i.e. what the…

kam
- 590
- 2
- 11
0
votes
0 answers
How is myArray.size() implemented in Salesforce Apex? Does the method retrieve a value stored on the List.class object, or calculated at time of call?
Often when I'm writing a loop in Apex, i wonder if it's inefficient to call myArray.size() inside of a loop. My question is really: should I use myArray.size() inside the loop, or store myArray.Size() in an Integer variable before starting the loop…

Dunks184
- 1
- 1
- 2