Skip to main content

Questions tagged [code-generation]

Questions about the parts of a compiler that select assembly instructions or machine code specific to a specific target computer architecture.

Filter by
Sorted by
Tagged with
1 vote
1 answer
36 views

Creating an executable after code generation - compiler design

I am learning about and building a very basic compiler. My question is about code generation. I have read on a lot of materials about code generation when building a compiler and I get the concept. ...
Ali Ahmed's user avatar
0 votes
1 answer
37 views

time complexity of loops

what is the time complexity of: for (i = 1; i <= n; i = 2*i) for (j = 0; j < i; j++) sum++; ? I thought it is O(nlogn) since the otter loop ...
user163594's user avatar
5 votes
6 answers
2k views

Why is backpatching needed during intermediate code generation? For what purposes?

I understand how backpatching works during intermediate code generation, but I do not understand why it is needed. A common argument for using backpatching during intermediate code generation is as ...
hengxin's user avatar
  • 9,561
0 votes
0 answers
25 views

Do Field separators delimit only fields or also data units inside fields?

At least intuitively, I understand the following terms to be rigorously associated: Field Separator (FS) as a delimiter which delimits text segments such as words, sentences or lines/fields and an ...
timesharer's user avatar
1 vote
1 answer
443 views

How to build 4 codewords with a code distance of 5?

I wonder how can I construct 4 (distinct) codewords given the fact that code distance is 5. As far as I know that the code distance is the number of distinct bits between any 2 codewords. How to ...
Powerful blaster's user avatar
1 vote
1 answer
613 views

What makes a nested function in gcc so complicated?

Disclaimer: I'm not a compiler expert, but some of my best friends are! :) I do a lot of embedded systems programming where stack (and other memory) is limited. Most of my code is written in gcc, ...
fearless_fool's user avatar
1 vote
1 answer
115 views

Generate code from automata

I am trying to figure out the process of generating code (set of instructions, implementation language specifics dont matter at this time) from an automaton. The description of my intent is vague ...
Abhishek Bhaduri's user avatar
0 votes
2 answers
195 views

Can algorithms of arbitrarily worse complexity be systematically created?

We’ve all seen this: Can we get worse? Part 1: Can mathematical operations of increasing orders of growth be generated, with or without Knuth’s up-arrow notation? Part 2: If they can, can ...
JohnnyApplesauce's user avatar
1 vote
2 answers
417 views

Can I program a universal Turing machine to accept arbitrary input encodings?

I've been reading about building Turing machines for specific purposes, and some sources talk about input encodings and some talk about programming specific machines, but I've been unable to find ...
Stella Biderman's user avatar
6 votes
1 answer
313 views

How to generate branch tables from SSA form?

Branch tables are usually described as an efficient way a compiler can implement a switch statement, and that actually seems how GCC and Clang do it (and LLVM even has an opcode just for that). If a ...
paulotorrens's user avatar
1 vote
1 answer
84 views

Software code generation from the (operational) semantics - reference request for automatic programming

Are there research trends that try to research code generation directly from the (operational or some other kind of) semantics? One can imagine cognitive architecture that discovers and reasons about ...
TomR's user avatar
  • 1,401
3 votes
1 answer
107 views

Is there a computer science theory behind automatic source code generation

The OpenAPI specification aims at standardizing the representation of REST based systems in json and yaml formats. A short version of the petstore is below: ...
SyCode's user avatar
  • 133
1 vote
1 answer
341 views

How to Identify which instructions are represented by this microcode

I'm having issues with a question how to identify which instruction are represented by this microcode. The pc starts at 5000 and 7000 and 7001 have values 31 and 64 - I'm really confused how to ...
rahulchawla's user avatar
2 votes
1 answer
4k views

How are codes like 5421 and 2421 unique?

For the number 6, if I need to represent it in 5421 code form, should I code it as 1001 or 0110? Why should I choose the one over the other? Similarly for the number 5 in 2421, is it 1011 or 0101? ...
Anupama's user avatar
  • 21
5 votes
1 answer
549 views

Implementing a Compiler with Macros

I've been thinking about embedded languages (domain-specific or otherwise), and in particular the approach where we define a datatype to represent terms of the embedded language, e.g. (in Haskell): <...
Warbo's user avatar
  • 632
1 vote
3 answers
126 views

Is it possible to define branches which, once taken once, will become the default forever?

Assuming I have a very simple branching: switch on var: 1 => branch1 2 => branch2 default => branch3 And I wish to implement a program that will ...
George's user avatar
  • 111
1 vote
2 answers
686 views

How to generate (Java) source code in academically acceptable way - using abstract syntax tree?

I am trying to do automated programming research: business software generation from the knowledge base that is implemented as Scheme (Lisp dialect) code (in the framework of http://opencog.org/ ...
TomR's user avatar
  • 1,401
0 votes
1 answer
229 views

How to represent software code for code generation / automatic programming? How to integrate procedural and declarative knowledge?

I am learning about deontic logics and there I can make the following inferences: If A then there is **duty to create an entity of class C**, ...
TomR's user avatar
  • 1,401
0 votes
1 answer
116 views

What is the quickest way to allocate a set of points to a fixed number groups based on Euclidean distances from a point in each group?

Example, if i have certain geographic points in an array A=[a,b,c,d...n] and have 10 points distributed in the solution space B= [1,2,3...10], how can I allocate each member of A to the nearest point ...
David's user avatar
  • 3
-1 votes
2 answers
9k views

In a bottom-up evaluation of a syntax directed definition, inherited attributes can

In a bottom-up evaluation of a syntax directed definition, inherited attributes can always be evaluated be evaluated only if the definition is L-attributed be evaluated only if the definition has ...
Mithlesh Upadhyay's user avatar
5 votes
1 answer
393 views

The importance of the language semantics for code generation and frameworks for code generation in model-driven development

I am implementing worflow where the code in industrial programming languages (JavaScript and Java) should be generated from the formal (formally verified) expressions (from ontologies as objects and ...
TomR's user avatar
  • 1,401
6 votes
3 answers
608 views

Is there a described algorithm converting _from_ Continuation Passing Style?

Continuation Passing Style (CPS) is a form of code where the control is passed explicitly, by passing the continuation of the code at each call point, unlike direct style. There are many descriptions ...
John Källén's user avatar
0 votes
2 answers
2k views

Number of operations performed in increment operators [closed]

How many operations are performed in the following in order to get a running time function of an algorithm: x = x + 1 x += 1 <...
JORGE's user avatar
  • 259
2 votes
0 answers
27 views

Codes for correcting a single deletion and re-ranking of a permutation

I was struggling with this paper about codes which can correct single deletion and re-ranking in permutations, http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&arnumber=6875337 [Published in:...
user6818's user avatar
  • 1,145
1 vote
1 answer
146 views

Assigning one variable to another in 3 address code?

3 address code is a very common topic in many of the CS theories. I encountered it while studying Compiler Design. According to the Wikipedia article, it says - Each TAC instruction has at most ...
lethal's user avatar
  • 11
3 votes
1 answer
98 views

About codes over $\mathbb{F}_2$

I was looking through these notes but I am not sure I can locate the answer to these questions of mine - it would be great if someone can just even point out what to look for! So any set of binary ...
user6818's user avatar
  • 1,145
1 vote
1 answer
56 views

Programs for artificial system design? [closed]

Are there program systems that can discover the need of routines - and then design them, code them and use them as parts of the system? Any group of humans trying to pursue an activity has to develop ...
Lehs's user avatar
  • 121
0 votes
1 answer
607 views

Conversion from assembly program to low-level machine language

While studying COMPILER-DESIGN through an online book from Google Books, referenced as Compiler Design by A.A.Puntambekar, I got stuck across a line. Actually, I am more curious to know the inner-...
Am_I_Helpful's user avatar
19 votes
6 answers
12k views

Why do compilers produce assembly code?

Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can't it directly convert from the high-level language to machine code?...
CODERSAM's user avatar
  • 293
1 vote
2 answers
429 views

Some questions regarding compilers and assemblers

Lots of basic questions are there in my mind. I need to clear them. Statement 1: A compiler converts a human-readable codes to object codes, and those are converted to a machine code (executable) by ...
Shashwat's user avatar
  • 503
0 votes
1 answer
121 views

What are current approaches to auto-parallelisation?

I am looking for answers which provide short overview of models and current state of research for auto-parallelisation of sequential code.
check123's user avatar
  • 530