Questions tagged [language-implementation]

Having to do with issues arising when implementing a programming language.

141 questions
2
votes
1 answer

What's meant by a thread-safe Ruby interpreter?

In a 2000 interview (that is, pre-YARV), Matz said Matz: I'd like to make it faster and more stable. I'm planning a full rewrite of the interpreter for Ruby 2.0, code-named "Rite". It will be smaller, easier to embed, thread-safe, and faster.…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
1
vote
1 answer

C++ unordered_map implementation problem previous values in map get forgotten

In the below code why map size is always 1, it is not saving previous values of root->val in the map as I can see in stdout. I was expecting that it should remember all the values put in the map. /** * Definition for a binary tree node. * struct…
randomUser
  • 653
  • 6
  • 23
1
vote
1 answer

What are the versions of cpython which different implementations(jython/ironpython/pypy/etc) are roughly compatible with

i.e. jython(or other implementation) version x.y is roughly equivalent to cpython version a.b Please list version of alternative implementation, and feel free to list multiple versions so this list will still be useful in the future. If possible…
Roman A. Taycher
  • 18,619
  • 19
  • 86
  • 141
1
vote
1 answer

How does the std::is_union implementation work?

I'm currently going through the C++ standard library in some more detail, and I was wondering how the implementation of std::is_union works. In libcxx (LLVM), apart from directly using a possibly built-in __is_union, it is defined as template
NotNik.
  • 422
  • 3
  • 14
1
vote
0 answers

How to check the maximum number of std::placeholders?

According to cppref: The std::placeholders namespace contains the placeholder objects [_1, . . ., _N] where N is an implementation defined maximum number. I checked libstdc++'s header file functional and found the N is 29. Is there a standard way…
xmllmx
  • 39,765
  • 26
  • 162
  • 323
1
vote
1 answer

Expression for defining letrec implementing little language in Haskell

I'm writing an evaluator for a little expression language, but I'm stuck on the LetRec construct. This is the language: data Expr = Var Nm | Lam (Nm,Ty) Expr | App Expr Expr | Val Int | Add Expr Expr | If Expr Expr Expr | Let Nm Expr…
1
vote
1 answer

SICP Ch 5: How would dispatch-on-type be more efficient in the explicit control evaluator?

I am going through SICP, and am on Ch 5 -- implementing the explicit control evaluator. They start out by writing the machine language for eval-dispatch eval-dispatch (test (op self-evaluating?) (reg exp)) (branch (label ev-self-eval)) (test…
Stepan Parunashvili
  • 2,627
  • 5
  • 30
  • 51
1
vote
2 answers

basic question about structure

struct { int integer; float real; } first_structure; So we can refer to a member of the first_structure by writing first_structure.integer = 7 If I write: struct two_numbers { int integer; float real; } …
Rounak
  • 613
  • 3
  • 8
  • 22
1
vote
1 answer

Difference between places and workers in APGAS framework and how are the workers implemented in Java?

I have been reading the Lifeline Global Load Balancing Paper (the paper is available on the link http://www.cs.columbia.edu/~martha/courses/4130/au12/p201-saraswat.pdf). I am new to x10 language. I am actually confused between the terminology of…
unkemptArc99
  • 39
  • 1
  • 5
1
vote
1 answer

Warning types in Python and MATLAB

I am trying to translate some code from MATLAB to Python. Right now I am having trouble understanding the syntax of MATLAB (and in general reading this section of the code) and converting it to Python. The following is the code: if (verbose == 0)…
A.Torres
  • 413
  • 1
  • 6
  • 16
1
vote
3 answers

Matlab to Python Matrix Code

I am trying to translate some code from MATLAB to Python. I have been stumped on this part of the MATLAB code: [L,N] = size(Y); if (L
A.Torres
  • 413
  • 1
  • 6
  • 16
1
vote
0 answers

Method for implementing objects in programming languages

Overview I have been reading through several implementations of programming languages (mainly CPython and YARV, plus a couple smaller languages), and I have noticed two main different ways of implementing objects. They both usually define some sort…
dangee1705
  • 3,445
  • 1
  • 21
  • 40
1
vote
2 answers

Lisp macros quotation implementation in JavaScript

I have basic scheme like lisp in JavaScript and have problem with backquote and quote macros, they evaluate symbols if they are at first element of the array like > `(foo 10) give error foo not found it work for code like this > (define x '(1 2…
jcubic
  • 61,973
  • 54
  • 229
  • 402
1
vote
1 answer

In Scheme, what is the returned value of `(begin)`?

I know that (begin expr1 expr2 ...) will evaluate all of the expressions and will return the last one evaluated. I found that in Chez Scheme it's allowed to use begin without expressions like so: (begin). I'm using Chez Scheme as part of my studies.…
1
vote
1 answer

Access iterator object within a debugger

Is there really no way to access the iterator object or its state from inside a for-loop? Using pdb or ipdb for example, I can loop over and over again with n, but not see in which iteration I am (ex post, I mean; of course I could use enumerate,…
Ilja
  • 2,024
  • 12
  • 28