Questions tagged [compiler-construction]

The tag compiler-construction should be applied to questions concerning the programming of compilers or for questions about the detailed inner workings of compilers. DO NOT USE for questions about *using* specific compilers or compilation errors.

-1
votes
0answers
10 views

CSE vs GVN in compiler optimization

I get one question when I read Lecture 11, Common Subexpression Elimination, of Advanced Compilers course of umass amherst. (https://people.cs.umass.edu/~emery/classes/cmpsci710-spring2004/)The ...
0
votes
2answers
33 views

Is batching same functions with SIMD instruction possible?

I have a scenario that many exact same functions(for simplicity let's just consider C/C++ and python here) will be executed at the same time on my machine. Intuitively I just use multi-threading to ...
-1
votes
1answer
30 views

Why print the number of Parsetree.implementation fail at ocaml compiler source code?

This code works fine:let ()=let filename="/home/wk/prog/LocationTest/b.ml" inLocation.input_name :=filename ;let readhandle=open_in filename inlet buf=Lexing.from_channel readhandle ...
0
votes
0answers
9 views

llvm intrinsic with union arguments

How can i add an union type argument to LLVM intrinsic. Which LLVMType should be used? I have tried using llvm_any_ty type. For which i'm not sure how to generate IR (CGBuiltin::EmitBuiltinExpr).
0
votes
0answers
21 views

Will any compiler ever boil away a stateless function?

Let's say I have the following code:function add(a, b)return a + bendnum1=add(2, 3)num2=add(4, 5)num3=add(6, 2)…Will any compiler out there ever compile this code as though it ...
-1
votes
1answer
25 views

How am I able to put my own programming language made partially with some assembly [on hold]

I had read many articles and watched YouTube lectures about Docker, but still not sure with some parts. Especially confusing since I am currently studying compiler course.1) This is my understanding ...
0
votes
1answer
28 views

Why can't get lexbuf.lex_buffer_len in ocaml's compiler code?

I have this prog:let ()=let filename="/home/wk/prog/LocationTest/b.ml" inLocation.input_name :=filename ;let readhandle=open_in filename inlet buf=Lexing.from_channel readhandle in...
0
votes
1answer
29 views

Where symbol table gets stored?

I'm studying about compilers, and I suddenly got curious that if I compile a program (let's say test.c) with -g option, does an actual file with a symbol table gets created and stored somewhere or it ...
0
votes
1answer
26 views

Can any tell me the regular expression for the given language?

all strings which contains even number of 0s or even number of 1s. Here I am asking about 'or' not 'and'.I have come up with this: (1*01*0)*|(0*10*1)* so far...but this seems wrong to me cause when ...
0
votes
1answer
33 views

Format-independent binary object?

Normally object files output by a compiler are in a specific format, e.g. ELF on Linux & etc., mach-O on macOS, and COFF/PE on Windows.Now, assuming the source code is compatible across ...
-1
votes
1answer
25 views

Bison parse global variables and functions

I'm building a compiler for fun, and I'm currently stuck at How to parse when multiple global variables or function definitions are in a single file f.e.int a;int b;int main(){int c;}my ...
0
votes
1answer
23 views

How can I traverse the parse tree generated by yacc?

Suppose I have given a valid arithmetic expression to my yacc file. And now I want to show how the parse tree looks by traversing it in pre or post order. Is it possible to traverse the parse tree....
0
votes
0answers
17 views

Counting the number of character in a comment, Lex

I have a coding assignment to count the number of comments, lines, characters, keywords, and numbers within a file using lex. I believing I've gotten the line counter, keywords counter, number counter,...
3
votes
0answers
125 views

What is zero overhead principle in C++? Examples? [closed]

When I am reading design goals of C++11, it mentioned about zero-overhead principle without any examples or features which uses this principle. I can understand that it could be there to avoid ...
2
votes
1answer
45 views

scanner.l:22: warning, rule cannot be matched

I am currently attempting to write a program that counts the number of characters and lines in a .in file. The issue is that when I input the command:lex scanner.lIt produces an error that says:...
1
vote
1answer
66 views

Is ocaml compiler use compiler front-end module parse to parse the source code or use ocamlyacc to parse source code?

I try to read ocaml compiler source code,use 4.07 source codeI read it from driver/main.ml I notice it use driver/pparse.ml line 161 function "parse" to parse lex buf(I add a line Printf.printf "...
4
votes
0answers
78 views

Practical applications of and recent progress on “Efficient and Safe-for-Space Closure Conversion” by Appel and Shao [closed]

When compiling a functional program to machine language, the compiler has to choose how to implement closures. In the following example (Scheme syntax), the function f returns the procedure (lambda (y)...
0
votes
1answer
37 views

Syntax problem with sum operation in java-pyton translator

I'm trying to realize a java-pyton translator. I'm using flex to recognize some java tokens. I managed integer number with this regular expression:...digit [0-9]number (\+|\-)?{digit}+...%%.....
1
vote
1answer
57 views

Ensure nil or null value when objects deallocate at runtime

Reference Counting & ARC PerspectiveIn Swift or Objective-C, if the reference counter become zero, the object is deallocated and every pointer values pointing to the object (including the weak ...
2
votes
0answers
39 views

Optimal way of emitting multiple asm instructions from single LLVM IR instruction

I am implementing an LLVM back-end for an accumulator-based processor. Currently, I seem stuck in the decision of how to match IR instructions correctly to the ISA.An example could be an LLVM IR ...
-2
votes
0answers
21 views

Top down parsing example

This is image of question.I need string parse in top down and bottom up parsing
-2
votes
1answer
50 views

Extract arithmetic operation information from C++ code [closed]

I am facing a problem of extracting arithmetic operation information from C++ source code. For example, I want to parse a C++ code such that I can find out the the line numbers for all the codes that ...
-1
votes
0answers
36 views

Variable declaration java-python translator in bison

I have to build a compiler that translates the java language into pyhton. I'm using the Flex and Bison tools. I created the flex file and I defined the syntactic grammar in Bison for some restrictions ...
49
votes
3answers
4k views

Why don't C++ compilers do better constant folding?

I'm investigating ways to speed up a large section of C++ code, which has automatic derivatives for computing jacobians. This involves doing some amount of work in the actual residuals, but the ...
3
votes
1answer
63 views

What are Clojure Intrinsics

Browsing the Clojure source code I came across an Intrinsics.java file. It looks like it is a mapping of some clojure runtime functions to JVM opcodes.However, I am not sure where they get applied. ...
3
votes
2answers
153 views

How do C compilers provide access to several memories? [closed]

If a computer has more than one address space which is used for data, how have C compilers provided access to these? The contextSome real-life architectures I am thinking about:KR580VM1 or ...
0
votes
1answer
46 views

How to manage semantic rule of declaration of variable in bison

I have to build a compiler that translates the java language into pyhton. I'm using the Flex and Bison tools. I created the flex file and I defined the syntactic grammar in Bison for some restrictions ...
0
votes
0answers
89 views

Type checking variable and array

I have to build a compiler that translates the java language into pyhton. I'm using the Flex and Bison tools. I created the flex file and I defined the syntactic grammar in Bison for some restrictions ...
0
votes
1answer
47 views

Dot file not genearting for -view-isel-dags option

While trying to see the SelectionDag nodes generated during the instruction selection phase using LLVM (built from sources with debug mode enabled), I am using the below command which is not creating ...
0
votes
1answer
30 views

What is the most efficient way to create a lexer?

I am currently trying to learn how to create my own lexical analyser, by hand. I had been using Flex (along with Bison) a lot to practice and learn how it works internally, but I am currently seeing ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,