All Questions
18 questions
5
votes
1
answer
1k
views
Does strict typing increase Python program performance?
Based on questions like this What makes C faster than Python? I've learned that dynamic/static typing isn't the main reason that C is faster than Python. It appears to be largely because python ...
-2
votes
1
answer
306
views
Symbol Lookahead in Compilers/Interpreters
While building some sort of interpreter for a simple programming language, i stumbled upon an interesting problem. I call it the "Symbol Lookahead" problem.
What do i mean with this? For example, in ...
2
votes
1
answer
255
views
compiling assignment expression to bytecode [closed]
I am trying to wrap my head around compiling a assignment expression to bytecode. I am writing my own language, and this part has really got me stumped. My language takes the source code and converts ...
5
votes
1
answer
3k
views
Converting an AST to bytecode
So I'm writing a little interpreter in C at the moment for a language I have created (which is pretty similar to Python). I have written the lexer and parser and currently my program outputs an AST, ...
-3
votes
1
answer
93
views
Storing values in bytecode [closed]
I am in the process of writing an interpreter for a language I am creating in C. Currently it can lex the source code into tokens, and then parse these tokens into an AST. After doing some reading, I ...
1
vote
2
answers
2k
views
Building an interpreter: designing an AST
So I am making an interpreter for a language which I am making which is similar to Python. Now I understand that this is no small task and I don't expect it to work very well or do much but I would ...
4
votes
1
answer
765
views
Is there some way to use pointers inside C switch statements?
Usually in a dynamically typed programming language, the object struct has a tag field used to identify the object type.
For example:
struct myObject {
int tag;
...
}
So it is easy to perform ...
1
vote
3
answers
889
views
in C, what is the maximum amount of identifiers you can have?
what is the max amount of variables/identifiers you can have in C? Learning compiler theory and interpreter design, I've learned that identifiers and their values are stored via a symbol dictionary/...
2
votes
0
answers
64
views
Efficient representation of class properties at runtime
I am developing a class based language and virtual machine (using C). Language is dynamically typed and I am designing how a class must be represented at runtime.
Basically a syntax like:
class ...
2
votes
0
answers
80
views
Efficient numeric operations on my object model [closed]
I am developing a dynamic language and a virtual machine, my object model looks like:
typedef struct {
int tag;
union {
int64_t n;
double_t d;
void *p;
} _v;
} ...
0
votes
2
answers
121
views
Name for compiler/interpreter phase which identifies special methods?
Is there a succinct term for the phase of a compiler or interpreter which identifies special methods, such as constructors and destructors? I think it probably fits under semantic analysis somewhere ...
1
vote
2
answers
604
views
Function call by value memory leak
As far as I know, call a function in C or C++ is call by value, meaning while calling functions compiler makes a copy of all parameters and then passes them to the function body.
Hence, is that ...
3
votes
2
answers
2k
views
Alternatives to stack-based VM for an interpreter
When building an interpreter for another language, it's often recommended to create a stack-based virtual machine that can interpret bytecode generated by the actual interpreter. The interpreter would ...
3
votes
7
answers
6k
views
confusion between compiler and interpreter?
I read the following documentation about compiler and interpreter somewhere :-
A compiler searches all the errors of a program and lists them. If the program is error
free then it converts the ...
4
votes
1
answer
693
views
How do I tell if computed gotos are supported?
I'm writing a bytecode interpreter that can either use computed gotos or a normal switch for the main instruction dispatching loop. The key bits are wrapped up in a couple of macros that can either be ...