A compiler is a computer program that transforms source code written in one programming language into another computer language.
0
votes
0answers
42 views
Comparing MSVC to Mingw
I may need to switch from Netbeans over to Visual Studios, I am using MinGW currently with a c++ project.
Is a binary made from Visual Studios significantly different from one produced on MinGW? If ...
0
votes
2answers
100 views
Is there such a thing as a 'pseudo-compiler' for proprietary software?
I'm interested in whether there is such a thing as a pseudo-compiler that can create a kind of binary or bytecode version of a plaintext script file, which can only be accessed by a proprietary piece ...
5
votes
2answers
370 views
How are generics implemented in a modern compiler?
What I mean here is how do we go from some template T add(T a, T b) ... into the generated code? I've thought of a few ways to achieve this, we store the generic function in an AST as Function_Node ...
-3
votes
0answers
47 views
how to write a basic c compiler using gcc? [duplicate]
I want to write my own c compiler it may be basic but i want to gain knowledge about how compilers are used to be build and how they work.
I am a beginner c programmer and want to develop a deep ...
2
votes
2answers
536 views
Why can't C# implicitly convert int to string?
C# allows implicit conversions of integers to strings when used in an expression. For example, this is completely valid:
int myInt = 10;
string concatenatedString = "myInt is " + myInt;
string ...
0
votes
1answer
59 views
Grammar design preference for recursion
I would like to know if one of the two following equivalent grammars (since they can produce the same rules) is preferred (and why).
For instance the second grammar is more concise but is it a good ...
4
votes
3answers
170 views
Is loop unrolling one of the examples of “targeted” compilation and faster instruction set?
I'm taking the Computer Architecture course in my undergraduate study.
I see that in loop unrolling, one of the constraints is the number of available registers.
Since the number of registers ...
3
votes
1answer
91 views
Javascript / Ecmascript language grammar disambiguation
I'm working on the design of a compiler for a language in which I have to use curly brace for two different purposes. I am currently stuck in writing a non-ambiguous grammar but I realized that some ...
4
votes
6answers
392 views
How can a compiler be written for a language that allows rewriting code at runtime (such as Lisp macros)?
There are some programming languages, like the many dialects of Lisp, that allow for macro-metaprogramming: rewriting and altering sections of code before the code is run.
It is relatively trivial to ...
3
votes
1answer
73 views
Implementing a construct like Rusts `match` in C?
I'm writing a compiler that compiles to C, one thing I'm attempting to do is implement a construct like Rust's match:
// { some function
let mut foo = 32;
match foo {
3 => return "...
2
votes
1answer
139 views
Do bytecode compilers compile syntax directly or intermediate assembly language?
I am going to write a very simple VM and bytecode compiler. Is it typical for a bytecode compiler to read the syntax and attempt to create the bytecode directly or is there an intermediate stage to ...
1
vote
2answers
89 views
How can an interpreter produce output of some code, without having the computing components like ALU of a processor?
I have gone through lot of explanations about a compiler and interpreter. I think I understood the difference between compiler and interpreter clearly. I'll explain my learning through the following ...
0
votes
1answer
69 views
Difference between intrinsic functions and #pragma directives?
In the ARM C/C++ Language Implementation Guide (p 99), NOINIT is listed as a pragma directive. In the previous code that I'm working with, __no_init was defined as an intrinsic function (IAR compiler ...
4
votes
5answers
440 views
Is there something that prevents a multithreaded C# compiler implementation?
The C/C++ language family apparently has multithreaded compiler implementations that work on file level parallelism, but the Microsoft C# compiler (csc.exe) is single-threaded only. MSBuild supports ...
0
votes
1answer
115 views
Comparison of modern browsers' javascript engine JITs
I understands that most of the recent browsers use JIT compilation to execute javascript. What I do not understand is: which part of javascript is JIT'ed - the script, or the bytecode?
Let me explain....
0
votes
0answers
30 views
How is the TypeScript compiler implemented in TypeScript? [duplicate]
I was reading on the TypeScript site and saw that the TypeScript compiler is itself written in TypeScript. "The TypeScript compiler is implemented in TypeScript and can be used in any JavaScript host."...
0
votes
2answers
130 views
Should compilers follow the defined language standard?
Why do some compilers violate the defined language standard?
I don't understand, in ISO/IEC 10206:1990 Extended Pascal standard on 6.8.3.2 Arithmetic operators section, Page 86.
It says that,
A ...
4
votes
6answers
833 views
“Write an Assembler in C.” Why writing a machine code translator for a low level language in a higher level language?
My Microprocessor class instructor gave us an assignment and said:
"Write an Assembler in C." - My beloved Professor
So it seemed a little bit illogical to me.
If I'm not wrong Assembly Language ...
2
votes
0answers
54 views
Origin of the native compiler [duplicate]
I have been using GCC in a nix environment for as long as I remember. Given the wide range of processors, such as those from Atmel, ARM, Intel, and possibly a custom-made soft-core on an FPGA, and ...
23
votes
2answers
787 views
What semantic features of Python (and other dynamic languages) contribute to its slowness?
I don't know very well Python. I'm trying to understand more precisely what exact features of dynamic languages (à la Python, Lua, Scheme, Perl, Ruby, ....) are forcing their implementations to be ...
7
votes
1answer
146 views
How to resolve generic typenames in compiler?
Let's say I have such code (and its meaning is like in C#):
class Foo<T>
{
public T my_field;
}
and later in code I have:
var foo = new Foo<int>();
foo.my_field = 5;
My problem ...
2
votes
4answers
226 views
Is C is a portable language for new architecture or it is specific for ISA?
How C language is portable to any instruction set (I mean for new architecture). Do we have to write again C compiler for new architecture?
5
votes
1answer
129 views
Do I need to declare a delay timer variable as volatile even if I access it from another module
This is a question more about using volatile to prevent optimization than about caching write/read of a variable. Particularly timer delay variables since I don't want to declare everything volatile ...
6
votes
2answers
191 views
Do compilers utilize multithreading for faster compile times?
If I remember my compilers course correctly, the typical compiler has the following simplified outline:
A lexical analyzer scans (or calls some scanning function) the source code character-by-...
6
votes
2answers
198 views
How do JIT interpreters handle variable names?
Let's say I am to design a JIT interpreter that translates IL or bytecode to executable instructions at runtime. Every time a variable name is encountered in the code, the JIT interpreter has to ...
1
vote
1answer
63 views
Security error on asp.net system after deployment of bug fix dll [closed]
I (recently inherited) a asp.net web application in production. After fixing a generic bug in the area of making a table selection - we have a problem regarding security policies not allowing access ...
1
vote
0answers
79 views
How to get verification that you've implemented all your API in a static library?
I just learned that static library building skips the linking stage, which explains why my build process succeeds all the time when it's possible I actually haven't implemented a function in my header....
4
votes
4answers
249 views
Why isn't the overloading with return types allowed? (at least in usually used languages)
I don't know about all programming languages, but it's clear that usually the possibility of overloading a method taking into consideration its return type (assuming its arguments are the same number ...
-1
votes
3answers
200 views
Are browser console errors 'compiler errors', 'runtime errors', or neither?
I was trying to communicate with a coworker about a JavaScript error I was being notified about in my browser's console window when I realized that I wasn't sure if I should refer to this as a ...
3
votes
1answer
83 views
Self-compilation in Forth
What is Self-compilation (a.k.a. Meta-compilation) in Forth? How it works and why is it useful? Does it have any practical usage and is it still used in modern systems?
2
votes
4answers
600 views
Why isn't there a primitive “complex number” type in Java?
Does anyone know why something like http://www.ipd.uka.de/JavaParty/cj/#Down was never completed and integrated into mainline java?
This seems like a no-brainer... I realize the java gawds dont want ...
23
votes
3answers
2k views
In which process does syntax error occur? (tokenizing or parsing)
I'm trying to understand compilation and interpretation, step by step figuring out a total image. So I came up to a question while reading http://www.cs.man.ac.uk/~pjj/farrell/comp3.html this article
...
2
votes
0answers
68 views
How to report multiple errors as a result of validation?
I have a class that transforms a complex model, for example an abstract syntax tree or intermediate model. The model can be either valid, invalid or partially invalid, i.e. it contains errors but some ...
0
votes
2answers
212 views
Do some built-in functions loop behind the scenes?
I mostly code in C# & VB, but I think this question is pretty universal. I try to limit loops to increase performance. For instance, string functions that split the string into an array, or do a ...
0
votes
2answers
278 views
Trust .net compiler after Microsoft updates
Microsoft releases upgrades and changes to .net, msbuild and Visual Studio quite frequently.
How can I be sure the MSIL code created by msbuild or the Roslyn compiler in VS 2015 will be the same or ...
4
votes
2answers
90 views
Testing strategies for interpreter language parser
For a recent personal project, I started working on an interpreter for my own programming language. One of the ground rules I set for myself on this project is that I need to properly test as much of ...
1
vote
2answers
739 views
How to reduce size of jar file?
I dont know how to reduce the size of jar file.
When we normally code in Java Swing the jar file is created, is there any way to reduce the size of jar file? I can't remove the images and other stuff ...
1
vote
1answer
107 views
Compiler design prevent register override
I'm trying to write a compiler for a self-designed CPU with accompanying instruction set. The CPU has 3 registers, 2 input registers (B and C) and one output register (D). When for example an ADD ...
0
votes
1answer
144 views
Are there compilers which optimize the use of mathematical functions?
Today while programming I stumbled upon the following question - are there any compilers which optimize based on mathematical assumptions?
For instance in cases like
unsigned int i,b;
(i,b not ...
23
votes
1answer
2k views
Why does the documentation on some languages say “equivalent to” rather than “is”?
Why does the documentation on some languages say "equivalent to" rather than "is"?
For example, the Python Docs say
itertools.chain(*iterables)
...
Equivalent to:
def chain(*iterables):
...
2
votes
2answers
79 views
JIT based on precompiled code templates
This is a crazy idea that I just came up with, and I'm interested in knowing if it would be workable, or if someone already wrote about or implemented it.
Imagine you are on a platform (a game ...
10
votes
4answers
510 views
Is there a standard way or standard alternative to packing a struct in c?
When programming in C I have found it invaluable to pack structs using GCCs __attribute__((__packed__)) attribute so I can easily convert a structured chunk of volatile memory to an array of bytes to ...
0
votes
1answer
167 views
Is an AST enough to build any translator? [closed]
Note: In my ignorance of the difference between Programmers vs StackOverflow sites (which I know now), I had posted this question on StackOverflow earlier. What I'm looking for is some elaboration, ...
18
votes
3answers
1k views
What is benefit that a compiler is implemented in the same language it compiles? [duplicate]
I've seen it's very common for a compiler to be made in the language it's compiling. What is the benefit of this? Seems like it makes the process for outsiders (and the developers for a while) more ...
56
votes
8answers
7k views
How can we be certain that the lower components of computer programming like compilers, assemblers, machine instructions, etc. are flawless?
Since we are becoming more and more reliant on computing, including very critical tasks of day-to-day life, I was just wondering how those vital components are tested.
More technically, how are the ...
-2
votes
1answer
256 views
How do I create my own Objective-C to Swift converter? [closed]
I'm really interested in writing my own converter.
I know C++/Python/Objective-C/Swift and a little Haskell.
There are website like objectivec2swift and iswift.org, which can convert OC to Swift ...
3
votes
0answers
411 views
Writing a Compiler - .reloc section of the COFF
I'm looking for a little bit of direction in writing a compiler. I've written in Common Intermediate Language, C#, and various other .NET languages; I've written my own Metadata Parser and now I'm ...
5
votes
1answer
129 views
Strategies to increasing the maintainability of assertions in code [closed]
Background
I am writing a compiler for a custom language for a school project and it is going really well for me.
If I where to start all over from scratch I would have done many software ...
0
votes
5answers
126 views
Confusion about data types, compilers, hardware data representation and static vs dynamic typing [closed]
I am trying to understand static vs dynamic typing, but am really struggling to see how everything fits together.
It all starts with data types. As far as I understand, data types are quite abstract ...
1
vote
4answers
200 views
How are individual lines of code and functions stored in a Concrete Syntax Tree?
I'm trying to write a simple compiler for learning purposes. I've been reading the Dragon Book and Modern Compiler Design and one part I don't understand is how the Concrete Syntax Tree is actually ...