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

learn more… | top users | synonyms

-5
votes
0answers
15 views

Having trouble printing a matrix [on hold]

I'm trying to print an array and I keep getting an error message that says " segmentation fault (core dumped)". Not sure what i did wrong cause all i did was initiate the matrix and then put the ...
1
vote
1answer
41 views

Passing parameters to threads

in Programming language course my professor take an example. Suppose the following code: ...
3
votes
3answers
156 views

is there any hardware device to convert source code into machine language? [closed]

Is there any hardware device inside computer that helps to convert high level language into machine, like compiler and assembler ?
-1
votes
1answer
32 views

What are activation records?

What are the open activation records of a recursive algorithm ? Edit: Activation records are the number of times that we call a function that is not finished yet. Correct? So we can find the number ...
1
vote
0answers
11 views

Equivalence of data-flow analysis, abstract interpretation and type inference?

@Babou's answer to a recent question reminds me that at one time I think I read a paper about the equivalence (in terms both of the facts that can be inferred or proved and the time complexity of ...
4
votes
3answers
54 views

Is there a technique for statically checking that a function is only called at a particular rate?

I was reading this article about types, and started wondering how static type checkers could enforce other properties in programs. For example, say I wanted to create a language which would allow ...
1
vote
3answers
199 views

Should compilers automatically translate operations into shortcuts?

There are several coding operations that (I suspect) most compilers will change into more efficient operations at the assembly or machine code level. I have several questions about whether or not the ...
5
votes
0answers
62 views

Convert source code from one language to an other? [closed]

Say I have a full application written in Python. Is it feasible to convert the source code into C? If such a tool doesn't exist, why doesn't it? What are the constraints? I ask this since I have been ...
-1
votes
1answer
28 views

c compiler source code for compiler construction [closed]

Could anyone tell me from where could I get the c compiler source code.In particular the lexical analyzer for c.I searched the web but no links show how a compiler is defined.
1
vote
2answers
52 views

How are Signed integers different from unsigned integers once compiled

How are Signed integers different from unsigned integers once compiled? I already know about twos compliment and the like but my question is how can you tell the difference when looking at 8 bit ...
1
vote
1answer
32 views

Which hazards are solved by instruction reordering?

I am not clear on whether it's data and control hazards, or control hazards only. Also, the "solved" word confuses me - technically, instruction reordering is used to solve dependences and thus ...
36
votes
7answers
6k views

What properties of a programming language make compilation impossible?

Question: "Certain properties of a programming language may require that the only way to get the code written in it be executed is by interpretation. In other words, compilation to a native machine ...
0
votes
0answers
55 views

LALAR vs SLR Table for Given SLR Grammar

i'm so glad that ask my first question on my favorite site. Infact i ran into multiple choice question in recent exam on Compiler Course. Suppose T1, T2 is created with SLR(1) and LALR(1) for ...
2
votes
1answer
90 views

Why multiple return values is not a common thing?

I would like to ask a question about multiple return values, why this construct is not preferrable in programming languages (conceptual and/or technical difficulties). I've heard something about stack ...
3
votes
2answers
69 views

Is it possible to go from code to circuit?

I am wondering if it is possible to have a program that interprets programming code and is capable of turning that code into an optimized circuit. Is this possible, and if so, does it exist?
-1
votes
1answer
62 views

What are the tradeoffs in compiler development effort related to CISC vs. RISC?

What advantages and disadvantages does a CISC instruction set have relative to a RISC instruction set with respect to the ease of developing a functioning compiler and the ease of developing a highly ...
2
votes
2answers
54 views

Lexing and parsing a language with juxtaposition as an operator

Normal human math notation treats juxtaposition as implied multiplication, e.g., $2x$ means $2$ multiplied by $x$. This does not seem to be a common feature of computer languages, although it was, for ...
6
votes
1answer
73 views

Tag-free garbage collection for object oriented languages

I'm looking around for a good garbage collection technique for my language and found this paper, where Benjamin Goldberg describes a garbage collection technique for strongly typed languages, which ...
-1
votes
1answer
26 views

Syntax checking expressed mathematically

1) Set B is the finite set of all rules for a particular programming language. 2) Set A is the infinite set of all valid strings of that language and is defined by Set B. I'm having a problem ...
0
votes
0answers
15 views

How would i design a PDA that accepts order of sentence? [duplicate]

How would i design a PDA that accepts order of sentence. In Natural Language Processing, context free grammars are used to identify valid English sentences from invalid once. For instance, ‘Lorem ...
3
votes
0answers
77 views

Recursive-descent parser for the grammar S -> S(S)S | ε

I'm studying (for self-betterment - I don't go to school) the 2nd edition of Compilers: Principles, Techniques and Tools by Aho et al. I'm not sure how to do Exercise 2.4.1 (b), which is to construct ...
2
votes
1answer
225 views

Numerical stability of C++: will a C++ program using a float or double library return the same arithmetical results on two different computers?

Say I am using boost or the built-in float or double mathematical libraries of my C++ compiler. I distribute the program. Will the execution of my C++ program on different machines given different ...
1
vote
1answer
30 views

Effective computation on linear data without random access

recently I've started thinking about caching problems in modern CPUs, where they struggle to adequately fetch program data (not instructions) in time, so that it can be computed further. So then I ...
1
vote
0answers
16 views

How does supercompilers relate to macro tree transducers?

Supercompilers can be used as a generalisation of deforestation of a functional program. Macro Tree Transducers composition can be used to the same effect, using a completely different approach. What ...
3
votes
1answer
71 views

Why are dependently typed languages such as Agda used for proofs, if supercompilers for simpler typed languages can do the same?

Proof assistants such as Agda can be used to assert properties about programs, such as the double of a number is even. Interestingly, supercompilers can be used for ...
0
votes
1answer
78 views

Computing FOLLOW sets for a LL(1) grammar

I am trying to learn compiler design. But I get confused when I have to deal with Follow set specifically for the empty word. I am trying to figure this out please help me with the same. ...
6
votes
2answers
70 views

Type of a return satement

I'm creating a experimental toy language for my own education purposes (an impure typed Lisp based on Clojure - https://github.com/mikera/kiss) I think I understand the concept of each expression in ...
2
votes
1answer
169 views

Is there C++ code that takes infinite time to compile?

Is C++ as a formal language recursively enumerable? If yes, is there any invalid C++ code that takes "infinite" time to compile?
1
vote
1answer
46 views

Algorithm to find Dominance Frontiers

The algorithm that is used by gcc and llvm is that of Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy (page 9). We start with the immediate dominators of each control-flow graph node ...
0
votes
2answers
211 views

How does an operating system implement the C library?

I have an idea of how a C program is turned into machine code by the compiler. I also know how the processor processes the instructions (https://www.youtube.com/watch?v=cNN_tTXABUA this video has a ...
1
vote
1answer
50 views

Why does left recursion have to be eliminated? [closed]

For example, Let the Grammar be: S->Sa|B Thus, S->Sa->Saa->...->Saa...aaa->Baa...aaa What's wrong with ...
4
votes
1answer
150 views

How are REGEXP implemented in programming languages?

Is there a good general paper about the interpretation or compilation of REGEXP in programming languages for pattern matching, with or without variables? I am not looking for a quick explanation about ...
4
votes
2answers
72 views

Does the OS create its own bootstrapped stack frame when running a program?

I've been doing nand2tetris exercises and I'm quite interested in how compilation actually works. In nand2tetris when creating the VM language I had to create a "bootstrap" which called the main ...
32
votes
5answers
3k views

Time complexity of a compiler

I am interested in the time complexity of a compiler. Clearly this is a very complicated question as there are many compilers, compiler options and variables to consider. Specifically, I am interested ...
3
votes
2answers
161 views

Mathematical background for programming languages, compilers and formal methods in software engineering [closed]

Can you tell me what mathematical background (concrete themes) should I have for studying and doing some investigations (in future) in programming languages, compilers and formal methods in software ...
1
vote
1answer
133 views

When do type systems start needing a logic engine?

I've noticed that some languages include a logic engine as part of their type system (e.g. Shen, Typed Clojure). Other languages have a much more direct type checking algorithm (e.g. Haskell / ...
0
votes
3answers
164 views

What data is stored in the symbol table for a number token?

I'm reading the Dragon Book. The following is from the start of Section 3.1.3. When more than one lexeme can match a pattern, the lexical analyzer must provide the subsequent compiler phases ...
0
votes
2answers
56 views

Which Type of Grammar is this?

I am learning Compiler Design. Can somebody explain what type of Grammar this is? The answer given is $LL(1)$ but there exists a left recursion in the grammar so it cannot be $LL(1)$. I derived the ...
1
vote
3answers
45 views

What do assemblers translate macros into during assembling? [closed]

I have dug in simple binaries, such as though like x86 bootloaders, sega video game binaries, etc. I know that these files tend to use assembler macros to define data, etc. What I am having trouble ...
0
votes
1answer
103 views

Is this grammar LL(1)?

Consider following grammar: $$X\to Yc|ZY$$ $$Y\to ab|cX$$ $$Z\to d|\epsilon$$ Can this be converted to LL(1)? Cleary, its not LL(1) because of First/First conflict at first production. Can anyone ...
2
votes
1answer
36 views

Indentation based Grammars

Considering programming languages with significant whitespace for indentation, such as Python or Haskell. How does this whitespace fit into the grand schemes of programming language grammars. I can ...
0
votes
2answers
589 views

Drawing Annotated Parse Tree for Syntax Directed Definition [closed]

Im trying to draw an annotated parse tree for 3*5+4n, the text book shows the following: [Compilers - Principles, techniques and tools (Dragon Book) by Aho, p308] ...
1
vote
1answer
141 views

Is this grammar LR(1)

I am reading parser chapter from dragon book and I found a grammar over there - $ S \rightarrow L=R $ $ S \rightarrow R $ $L \rightarrow *R $ $L \rightarrow id $ $R \rightarrow L $ Now I have ...
0
votes
1answer
56 views

Eliminating $\varepsilon$-productions during elimination of left recursion

I'm following the algorithm for left recursion elimination from a grammar. It says remove the epsilon production if there is any. I have the grammar $\qquad S \to Aa \mid b$ $\qquad A \to Ac \mid Sd ...
1
vote
1answer
37 views

Has there been a lexer that takes in much more than a regular language?

I understand the restrictions, because a regular language is expressive enough to allow all types of tokens. And even if some context is needed in many languages to tokenize properly, they all seem to ...
0
votes
1answer
71 views

compiler interaction with OS [closed]

I want know if compiler interacts with operating system during compilation process.And if yes then which part of compiler interacts with which part of operating system
4
votes
1answer
135 views

Confusion about compiler and assembler

I have two questions. After compilation of any C program result is assembly language code which should depend on processor. So my question is: how do different computers with different processor ...
0
votes
3answers
55 views

How are image files, sounds, data, etc. compiled/linked in to a single file?

I'm both asking for me & future readers as to how pictures, sounds, textures, assets, and such are compiled and linked in to one binary/program, and how that process works. I have seen this in ...
1
vote
0answers
52 views

what does “Configuration is valid for a viable prefix ” actually means?

I am learning LR(1) parsing from the Dragon Book. I am really confused with this sentence. Formally we say that a configuration $[A \to u•v, a]$ is valid for a viable prefix $α$ if there is a ...
2
votes
4answers
547 views

What information do we get from a compiler's parse tree?

In the compiler course by Alex Aiken on Coursera, more specifically lecture 05-02 Context Free Grammars, the professor says that CFGs give answers of the type yes/no, i.e. whether the given string of ...