Questions tagged [compiler-development]

Used for questions about compiler development (but not design).

Used for questions about compiler development (but not design).

21 questions
17
votes
2 answers

What is the A-Normal Form?

I was reading about various intermediate forms but I cant get information about A-normal forms besides the wiki-like entries. Does anyone here know about this or has good resources about it?
unj2
  • 52,135
  • 87
  • 247
  • 375
6
votes
2 answers

How do I implement forward references in a compiler?

I'm creating a compiler with Lex and YACC (actually Flex and Bison). The language allows unlimited forward references to any symbol (like C#). The problem is that it's impossible to parse the language without knowing what an identifier is. The only…
Zifre
  • 26,504
  • 11
  • 85
  • 105
6
votes
5 answers

Compiler Optimizations Questions

What are some of the ways a compiler eliminates repeated subexpressions recomputations? How do you keep track of the sub-expressions? And How do you identify the repeated ones? Besides the usage of bitwise operators, what are some of the strength…
unj2
  • 52,135
  • 87
  • 247
  • 375
5
votes
1 answer

Partial application in LLVM

I am trying to create a function "add" that can be applied to a single argument, and subsequently another. I can't figure out how to represent this with LLVM IR, as I don't understand how to call a function with a single value, then save the value…
altschuler
  • 3,694
  • 2
  • 28
  • 55
4
votes
9 answers

How can I make my own C++ compiler understand templates, nested classes, etc. strong features of C++?

It is a university task in my group to write a compiler of C-like language. Of course I am going to implement a small part of our beloved C++. The exact task is absolutely stupid, and the lecturer told us it need to be self-compilable (should be…
chester89
  • 8,328
  • 17
  • 68
  • 113
4
votes
6 answers

Compiler that recognize different-different languages and send them to their corresponding compilers. Possible?

I was thinking whether it is possible to bridge asp.net, php and java to form a single page. Actually i dont need any such thing as of now. It was just an idea that stiked to my mind as some features of some languages are good and some features or…
2
votes
0 answers

Getting AST of some C code programmatically

What I'm doing? I'm building a C code analyzer. to do some checks at the compile time. and if passed, compile it. What do I want? for my goal, I should lex and parse user source code. maybe in the future, I write a lexer and parser for this, but now…
2
votes
1 answer

C grammar generates invalid expression

I am reading a book namad A Retargetable C Compiler: Design and Implementation. In this book, the C language grammar is specified like this: expression: assignment-expression { , assignment-expression } assignment-expression: …
1
vote
3 answers

Does Loop Fission Work in Single Cores?

When does it make sense to use Loop fission/distribution if I am compiling for a single core processor?
unj2
  • 52,135
  • 87
  • 247
  • 375
1
vote
1 answer

What is Object Oriented Scanner (Lexical Analysis)?

Recently I came across the concept of Lexical Analysis called "Object Oriented Scanner", but I wasn't able to distinguish it from the normal scanning technique. What can be the extra things in object oriented scanner, please help me understanding…
1
vote
1 answer

Does Java compiler have a problem with method return paths detection

recently I started to do some experiments with different language compilers due to my studies in Compiler Design, and I found a very odd thing, that happens in Java and that is, as you may know, if we have a method with no return path, there is no…
1
vote
1 answer

Why we count a string as a single token in lexical analysis of compiler design?

I am learning about compiler design. The task of lexical analyser in compiler is to convert the code into stream of tokes. But I am confused why we consider a string as a single token . For example - printf("%d is integer", x); In this statement…
1
vote
0 answers

How to design an intermediate representation for language with a nested functions?

I am writing a compiler for language with nested functions. I decided to use display to access local variables of outer functions from inner ones, I don't know how to represent writing of activation record to display array in intermediate…
1
vote
1 answer

Compiler Type Promotion of Right Hand Side expressions automatically in an Assignment Statement

Why does a compiler not type promote all evaluations of expressions in the right hand side of an assignment expression to at least the left hand sides type level? e.g. "double x = (88.0 - 32) * 5 / 9" converts to Celsius from Fahrenheit correctly…
1
vote
1 answer

Reduce number of temporary variables

I'm writing something like a compiler. The problem is following: I have a code, consisting of a sequence of assignments: t1=a+b+c t2=t1*d t3=sqrt(t1+t2) t4=t2+5 ... most of "t"-variables are temporary. I want to reduce the…
Pavel
  • 363
  • 1
  • 2
  • 14
1
2