Skip to main content
Computer Science

Questions tagged [compilers]

Questions about programs that read code in one language (source language) and translate it into an equivalent program in another language (target language).

Filter by
Sorted by
Tagged with
3 votes
0 answers
40 views

(Prolog) Warren's Abstract Machine, Argument Registers

I am currently reading "Warren's Abstract Machine: A Tutorial Reconstruction" and I'm trying to follow along with the exercise as well as code my own implementation. I am trying to ...
0 votes
0 answers
44 views

How to minimize parentheses when stringifying arithmetic AST for right-to-left evaluation languages with different precedence rule?

I'm looking at translations to and from APL, which has right-to-left evaluation and no operator precedence. Is there a known algorithm to minimize parentheses usage when keeping the same operators for ...
3 votes
2 answers
162 views

Is there any research on "fixed points of bugs"?

Is there any research on or at least formulation of the concept of "fixed points of bugs"? That is, suppose we have an implementation $I$ (e.g., a compiler or interpreter) of a programming ...
1 vote
0 answers
39 views

Why does the G-machine push arguments before the function for application (MKAP)?

I'm reading The implementation of functional programming languages (1987) by Peyton Jones and he mentions (p.307) that the MKAP (make application) instruction is more convenient if the argument is ...
1 vote
0 answers
24 views

$IN[BB]=\emptyset$ for all $BB$ instead of $IN[BB]=U,\text{for all other BB != BB_EXIT}$ in Init of Anticipated Expression Dataflow analysis in SSA

I am implementing an LLVM pass for anticipated expressions using dataflow analysis and code hoisting. The reference I am following is the Purple Dragon Book (Compilers: Principles, Techniques, and ...
1 vote
0 answers
46 views

Drawing the syntax tree for directly converting Regex to DFA

I am learning compiler design and I came across a problem for converting a Regex to DFA by direct method. But I couldn't draw the syntax tree or I would say I couldn't find a systematic approach for ...
12 votes
3 answers
2k views

Why is a program operating system dependent?

I understand that processors belonging to different architectures have different instruction set and therefore a program compiled for one processor (hardware platform) can't run on a processor with ...
0 votes
0 answers
33 views

Compilers [LR and LL parsing}

I was supposed to implement a stack machine code and I wrote a production and the code works. I am not able to understand if I have written a LL parser or an LR parser. Can anyone take some time to ...
0 votes
1 answer
74 views

Number of LR(0) item sets of the grammar (Dragon Book, exercise 4.6.7)

I'm stuck on exercise 4.6.7 part b from the dragon book. The task is to show that the given grammar Gn: S → Aibi for 1 ≤ i ≤ nAi → ajAi | aj for 1 ≤ i,j ≤ n i≠j has ...
2 votes
0 answers
49 views

Reference counting operation insertion in syntax tree

This question might be too open-ended, but I can't seem to find any resources online. When implementing reference counting as a form of GC in a language, how do you know when to increase/decrease ...
1 vote
2 answers
499 views

How do logic gates handle if-else statements?

There are questions here and on electrical engeneering stackexchange with similar titles, but they do not quite address the part that is bugging me. I hope I can explain it here in a clear way and ...
Vincent's user avatar
  • 761
1 vote
1 answer
52 views

How can the symbol table be used in code generation after the semantic analysis phase?

I am writing a basic compiler that compiles a language down into custom bytecode instructions. The language allows for variable shadowing (this is a cause of one of the main problems I am running into)...
RIVERMAN2010's user avatar
1 vote
1 answer
44 views

Livout analysis of control flow graph of a program

I just started reading about data flow analysis in compilers and I am trying to understand the concept of live-out variables. For this I read the algorithm to compute live-out variables in each bloc ...
1 vote
1 answer
79 views

Possible mistake in a book regarding parsing and lexical analysis

I was just reading a book (Algorithms and Theory of Computation Handbook, Volume 1) and I came across the following passage : "From a practical point of view, for each grammar G = (Σ,V, S, P) ...
1 vote
1 answer
47 views

How would setjmp differ in runtime environments with stack-allocated vs. heap-allocated stack frames?

I am stumped on Engineering a Compiler, 3rd ed. Section 6.3, Review Question 1. The book uses the term 'activation record' to refer to a generalized procedure frame. The question asks: In C, '...

15 30 50 per page
1
2 3 4 5
...
45

AltStyle によって変換されたページ (->オリジナル) /