Questions tagged [compilers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
114 views

Is beta normalization used for program optimization?

Beta normalization reduces a lambda term to its beta normal form, if it exists. The beta normal form is a computationally equivalent term with no "redundant" computation, in a sense; for ...
Hirrolot's user avatar
  • 105
3 votes
1 answer
150 views

Is there a high level (functional) language compiling to Mixed Integer Linear Programming problems?

Many different kinds of optimization problems can be expressed as Mixed Integer Linear Programming (MILP). The translation is usually very direct, and one has to encode invariants as constraints in a ...
Turion's user avatar
  • 616
-1 votes
1 answer
82 views

Generating grammar from a string

Given a string generated with a valid grammar, how can I find list of all the valid grammar for that particular string? Problem statement - I'm trying to build a code base scanner, and I'd like to ...
Vetrivel's user avatar
-1 votes
1 answer
152 views

Locally nameless representation implementation

ORIGINAL: I am programming a functional compiler and found out about locally nameless representation (using de brujin indeces for bound variables and names for free variables). I just don't understand ...
Deonisos's user avatar
0 votes
0 answers
187 views

The difference between the 1st and 2nd editions. "Compilers Principles, Techniques, and Tools" by Aho, Sethi and Ullman

I bought "Compilers Principles, Techniques, and Tools 1st Edition" by Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman long years ago and it has been sitting on my bookshelf ever since. I ...
tchappy ha's user avatar
2 votes
0 answers
111 views

Does GHC use graph reduction?

I have read somewhere that GHC does not use graph reduction for compiling/evaluating expressions. Is this right? If yes, what does it use as an alternative?
geeko's user avatar
  • 131
0 votes
0 answers
26 views

Quantifying the cost of procedures

Is there any research on quantifying the cost of a procedure, with regard to compiler optimization? I.e. assigning some kind of cost in terms of CPU time or memory to a procedure, either so the ...
Ari Fordsham's user avatar
5 votes
1 answer
136 views

Commutative operation benefits

With an associative operation I can rewrite a computation tree + / \ + 4 / \ + 3 / \ + 2 / \ 0 1 to be more efficient ...
andi's user avatar
  • 71
4 votes
0 answers
131 views

Origin of simulation relations for compiler correctness

Leroy uses simulation relations as a means of showing compiler correctness; the basic idea is that a simulation relation is an asymmetric binary relation between states in two different small step ...
denotational's user avatar
1 vote
1 answer
65 views

Why can a Predictive Parser contain E' -> TE' | ε

I am studying the basics of predictive parsing and I think I have missed a concept that I would like to understand instead of just accepting and memorizing. I am watching this video and I am confused ...
Aaron Miller's user avatar
1 vote
0 answers
80 views

Is there an unambiguous grammar that has no left recursion or left factors, but is not in $LL(1)$?

I know that, for a grammar $G$ to belong to $LL(1)$, it is necessary that $G$ is not ambiguous; that is, every sentence has a unique parse tree in $G$. $G$ has no left recursion; that is, we can't ...
Berserker's user avatar
5 votes
2 answers
229 views

Does Standard ML validate (CBV) eta equivalence?

$\eta$ equality of functions is fundamental in their Category-theoretic semantics but in practice even "functional" languages include "impure" features that violate it. Note that this is not an issue ...
Max New's user avatar
  • 1,685
7 votes
4 answers
7k views

Difference between syntax and semantic error in programming languages

When compilers generate errors for a specific programming language, there's distinction between syntax & semantic errors. E.g. ) + f 3 has ill-formed syntax, ...
Rui Liu's user avatar
  • 181
1 vote
1 answer
246 views

Optimal evaluation of polynomials / rational functions

A common way to compute the value a polynomial is to write it in Horner form. However, this isn't always the fastest way to evaluate it. Setting aside concerns of numerical precision, take the ...
Arthur B's user avatar
  • 429
-3 votes
1 answer
523 views

Can we say that Church encoding is a form of Gödelization?

We see here the following statement about Godelization: Gödel numbering in computer science means more or less "source code" and "data in binary format", so I hope the ...
hawkeye's user avatar
  • 2,581
0 votes
1 answer
2k views

Computing the DAG of a program given source code or AST

I've seen many papers on scheduling components or tasks once a DAG for the program is known, either by user-input or by domain restriction (i.e. all cross shaped 5-pt stencil codes have a known DAG). ...
Snakes and Coffee's user avatar
1 vote
1 answer
175 views

Name a set of program variables

I am interested in the set of the variables that satisfy the following properties. I would like to find a proper name for them. We assume that a program $\phi$ has a set of variables $v_0, \ldots, ...
SoftTimur's user avatar
2 votes
2 answers
235 views

Would it be possible for a compiler to convert a recursive sum into the average formula?

def sum1(n): if n==0: return 0 else: return n + sum1(n-1) def sum2(n): return n*(n+1)/2 A compiler can not convert ...
MaiaVictor's user avatar
  • 3,147
-4 votes
1 answer
291 views

Fermat's last theorem and the LLVM compiler [closed]

The following blog: http://blog.regehr.org/archives/140 discusses how the LLVM compiler seems to prove that Fermat's last theorem is false by showing that the compiler optimizes the $while(1)$ "...
mathersjj1's user avatar
10 votes
1 answer
226 views

Program Minimization

Circuit Minimization is the problem to minimize the size of a given circuit. Is there anything similar for general programs? In particular my question is - Do there exist algorithms to minimize the ...
Opt's user avatar
  • 1,311
4 votes
1 answer
159 views

Is it possible to create an algorithm-aware optimizer?

I've recently implemented a physics system where each object has to interact with eachother. It consisted of, pretty much, the following algorithm: ...
MaiaVictor's user avatar
  • 3,147
3 votes
1 answer
336 views

Compiler Optimization: How do you automatically fuse conditionals into the loop index?

Let's say that you have some loop for(i=0;i<n;i++){ if(i > 3 && i < 8){ p(i); } } How would I go about automatically fusing that into ...
Evan's user avatar
  • 141
2 votes
1 answer
1k views

How can an inherited attribute be simulated using a synthesized attribute?

Is it possible to simulate an inherited attribute using a synthesized attribute? For example, can the inherited attribute SYMTAB used in normal code generation modules be simulated using a synthesized ...
saikat's user avatar
  • 175
9 votes
3 answers
491 views

Can one automate algorithmic analysis?

Has anyone thought about the possibility of a programming language, and a compiler, such that the compiler can automatically do worst-case asymptotic analysis? The use case I have in mind is a ...
manoj's user avatar
  • 341
13 votes
2 answers
2k views

Is compiler for dependent type much harder than an intepreter?

I have been learning something about implementing dependent types, like this tutorial, but most of them is implementing interpreters. My question is, it seems that implementing a compiler for ...
molikto's user avatar
  • 347
2 votes
1 answer
366 views

Monotonicity in data flow analysis

I am studying program analysis and synthesis, I was reading a presentation about some data flow analysis. I can't seem to understand why $$\bigcap_{s'\in\text{pred (s)}}\text{Out}(s')$$ and $$\...
Belgi's user avatar
  • 161
10 votes
1 answer
354 views

Literature on alias analysis

I am writing my master's thesis in CS and I am working with alias analysis. The thing that I am interested in is intraprocedural, flow sensitive must- and may-alias analysis for Java-like languages. ...
Lii's user avatar
  • 211
6 votes
3 answers
273 views

Preserving termination when rewriting recursive programs

Powerful program transformations like partial evaluation, deforestation and supercompilation are based on applying three kinds of transformations: Rewrite using axioms, e.g. a+b = b+a. Unfolding/...
Jules's user avatar
  • 390
10 votes
2 answers
1k views

Certified compiler and optimizations in Coq/Agda

I am interested in verified compilers formalized in Martin-Löf type theory, i.e. Coq/Agda. At the moment I’ve written a small toy example. Therewith I can prove that my optimizations are correct. For ...
mrsteve's user avatar
  • 443
5 votes
2 answers
306 views

Why do we need PAP (partial aplication) objects in heap?

In the paper “Making a Fast Curry: Push/Enter vs. Eval/Apply for Higher-order Languages” by Simon Marlow and Simon Peyton Jones it is told that a PAP heap object may be created in the push/enter model ...
beroal's user avatar
  • 557
10 votes
1 answer
482 views

What are possible implementations of Haskell's type classes and what are their (dis)advantages?

As far as I know, a Haskell function with type classes constraints is internally compiled to a function with additional arguments that receive dictionaries with the necessary implementations of each ...
Petr's user avatar
  • 2,601
8 votes
1 answer
3k views

machine learning for code and compiler optimization?

I am looking into ML for generating more efficient code (i.e. compile time and run time heuristics). I have a phd (compilers, hpc), but very little ML experience. I would appreciate any references ...
OA1's user avatar
  • 81
-5 votes
1 answer
3k views

Proof that DFA that accepts string has NFA that accepts reversal of string

I have seen descriptions for an algorithm that can take a regular deterministic finite automata and create a non-deterministic finite automata that is guaranteed to generate the reverse of string ...
Prov's user avatar
  • 7
20 votes
5 answers
1k views

Compiler correctness proofs

I am looking for tutorial material that covers compiler correctness proofs, preferably using denotational methods, at the level of a beginning grad student. Alternatively, do you know of some ...
Uday Reddy's user avatar
  • 4,806
1 vote
1 answer
212 views

How is the iteration space of a nested for-loop containing two sequential nested loops represented?

In a general for loop of the form: for (i = 0, i <= n, i++) { for (j = i, j <= n, j++) ... for (k = i, k <= n, k++) ... } What ...
Magnus's user avatar
  • 127
2 votes
2 answers
401 views

Can any language be modeled as LR(k)

If L(G1) is the language that is produced by grammar G1 and G1 is not LR(k) parsable (specifically speaking for k = 1). Does there exist a grammar Gx that is L(Gx) = L(G1) where Gx is LR(1) parsable ? ...
Mike G's user avatar
  • 121
14 votes
1 answer
2k views

The Stalin compiler brutally optimizes, but how?

J.M. Siskind's research statement states: Stalin is an optimizing compiler for Scheme that performs whole-program static analysis and uses the results of that analysis to generate extremely efficient ...
Jules's user avatar
  • 390
1 vote
0 answers
155 views

Optimal inlining algorithm

I seek an algorithm to optimise the process of inlinling. Is there such an algorithm, or set of such algorithms? Is there an efficient functional algorithm? To be specific assume we have an Algol ...
Yttrill's user avatar
  • 111
8 votes
2 answers
298 views

Where can I find an elementary small-step structural operational semantics for closures?

Lexical closures are an implementation technique in languages with first-class functions. I'm interested in a simple operational description of function closures. Does anyone know of such a ...
Ohad Kammar's user avatar
  • 2,677
0 votes
1 answer
187 views

Describing a grammar and associated parser

In the process of writing a Turing machine simulator, I decided on a machine representation in ASCII that closely mirrors Turing's original machine tables. I am interested in the formal categorization ...
Rein Henrichs's user avatar
2 votes
2 answers
912 views

Equivalence of two basic blocks

My questions: What are other names for this and similar problems and their fields? ("equivalence of varieties in universal algebra", "equivalence of algebraic structures", "rewriting systems for ...
5 votes
2 answers
1k views

Brackets expression incremental parsing algorithm

I am looking for efficient and easy in implementation algorithm for incremental parsing of expressions with brackets. Consider the example with expression like "((1)())(2)". Parse tree for that ...
Eliah's user avatar
  • 151
15 votes
2 answers
469 views

Has anyone used Pottier and Gauthier's polymorphic defunctionalization in a modular compiler?

Defunctionalization is a program transformation that converts higher-order programs into first-order programs. The idea is that given a program, there are only finitely many lambda-abstractions, so ...
Neel Krishnaswami's user avatar
15 votes
4 answers
1k views

What's new in compiler optimization techniques over last few years?

I'm interested in optimization of data flow and control flow graphs and in particular more computationally complex. But it will also be interesting to know about the latest inventions in the field of ...
Evgeny Gavrin's user avatar
13 votes
2 answers
3k views

What are current open problems in compiler theory?

Compiler theory seems to be a pretty vetted subject. What are some open problems or current research happening in the field?