163
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
A few useful techniques:
Turn on -Wall and -Werror. It might seem counterintuitive when you're struggling with deciphering error messages to create even more error messages, but the warnings are ...
56
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
Your friend does not need a glossary. A glossary will not help him. What he needs is better intuition about what to do when compiler errors occur.
C compiler errors are not as intuitive as, say, C# ...
27
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
A relevant technique worth mentioning is using a second compiler. Clang has invested in better error messages, for instance, but any alternative way to phrase the error can be enlightening.
This is ...
17
votes
Accepted
Can I compile PHP to hide the code?
Is there a way I can compile or obfuscate the PHP code somehow so that it can still run on the server but cannot be viewed/edited/modified like compiled software?
No.
In order for the code to run on ...
13
votes
Accepted
Why does Rust require external linkers? Any other similar languages?
Rust requires a linker to generate final output. It's only "external" insofar as it is a separate program from the compiler that generates object files.
The same is true for most C and C++ compilers, ...
13
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
Someone made an attempt at a GCC error glossary on Wikibooks a while ago, but it looks like it never quite took off and hasn't been updated.
The "Errors" section is much further along than the "...
12
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
In addition to the above answers, note that most compilers don't have comprehensive error glossaries -- these would be a lot of work to maintain as the messages themselves often change, and there are ...
9
votes
Accepted
How is it possible to have an efficient edit-compile-try cycle on large codebases?
Even in small projects, when you do a change, you don't recompile anything. In fact, the build is often performed in two steps: compilation and linking. If you modify two files which don't impact ...
8
votes
Accepted
Circular dependency problem
You can do a two pass compilation.
In the first pass emit the machine instructions as you do now. When you encounter a label record its address in a symbol table. When you encounter a reference to a ...
7
votes
Can I compile PHP to hide the code?
You can obfuscate but you cannot hide completely. I've been forced to use both ionCube and Zend Guard before, which perform this obfuscation, and there is no big difference between them. These ...
7
votes
Accepted
How are literal values encoded into bytecode?
Your question applies more broadly than byte code systems, to general instruction set architecture, hardware or byte code.
What is the common practice when encoding literal values, whose byte ...
7
votes
Accepted
Forth: How do CREATE and DOES> work exactly?
So, I'm a little late to the game, but these questions (particularly about DOES>) were mystifying me as well, being new to Forth. Here is what I've learned and how I've implemented it:
[TL;DR: "...
7
votes
Does the JVM compile bytecode into machine code and run it or does it just run bytecode directly?
Java source code is compiled into bytecode for the JVM.
That is not necessarily true. There is nothing in the Java Language Specification that prescribes any particular implementation strategy. The ...
6
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
The C Standard uses a number of terms like "lvalue" and "object" in ways that are different from other programming languages, and compiler messages are often written in such terms. The use of ...
6
votes
How to write a very basic compiler
Sorry for a shameless plug!
Here are some things I've learned from my experience writing a simple toy compiler. Although it's in F# not in C, hopefully there's still something useful to you.
Theory
...
5
votes
Forth: How do CREATE and DOES> work exactly?
Answering your questions in order.
CREATE may allocate a new, empty data space. It then sets the "data field" of the new dictionary entry to HERE and the execution semantics to push the value of ...
5
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
I'm surprised no one gave the obvious answer and, I suspect, the one most often used in practice: just don't read the error messages.
The vast majority of the value of most error messages is simply ...
5
votes
Accepted
Solving issues in using post and pre increment operators as part of expressions
In the languages I'm familiar with (e.g. C, C++, JavaScript, TypeScript, Java), the code <variable>++ captures the value of <variable>, increments the variable's value, and then yields the ...
5
votes
When writing a tokenizer, what is the standard practice for handling aliased language keywords?
Do we map several different misspellings of a single language keyword to some canonical/standard value?
Not in a tokenizer, no. A tokenizer or lexer is only turning a stream of characters into a ...
4
votes
Solving issues in using post and pre increment operators as part of expressions
The fundamental problem is what does ++i and i++ actually mean?
Each language will give a different answer, so that is important. But lets take a look at the abstract idea first, pseudo code.
...
4
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
Another technique would be for the friend to write his own glossary over time as he encounters different error messages. Often the best way to learn something is to teach it. Of course, by the time ...
4
votes
Novice programmer(s) frustrated by lack of a glossary of compiler errors
So, how should a novice programmer approach the challenge of understanding compiler error messages? Specifically, with the combination of C and GCC?
Tell your friend to do the following when ...
4
votes
How are literal values encoded into bytecode?
the arguments to PUSH are a variable number of bytes, so the virtual machine does not know how many bytes it needs to read for each argument.
Usually, the architecture dictates that all arguments are ...
4
votes
Forth: How do CREATE and DOES> work exactly?
Download the book: Thinking Forth here...
https://sourceforge.net/projects/thinking-forth/files/reprint/rel-1.0/thinking-forth.pdf/download?use_mirror=gigenet&download=
A cleaner explanation is ...
4
votes
why do we need instructions set for processor or controller?
Are you confusing "instruction set" with "assembly language"?
Higher level languages often get compiled into assembly language, and then that gets "compiled" into actual ...
3
votes
What is faster, to read 100MB from file or to compile 100MB of code?
It depends.
If the generation code needs a lot of CPU cycles, using a file as a cache might bring performance benefits. If not, using a file as an intermediate storage can slow things down. The only ...
3
votes
Creating a metaphorical compiled scripted language.
The question is nonsensical.
Interpretation and compilation are properties of the implementation, not the language. In other words, they are properties of the interpreter or compiler (duh!). Every ...
3
votes
How to Validate Output Binary During/After Compilation on Platform without ECC Memory
I am curious about, for this aspect, what developers usually do for this problem.
They consider it so incredibly unlikely that they don't waste any time thinking about it.
3
votes
When writing a tokenizer, what is the standard practice for handling aliased language keywords?
In C++, the tokens signed, short, and int are keywords. The phrase signed short int is not a keyword, but a sequence of three tokens. The parser will later combine these into a type name, and even ...
3
votes
Accepted
Is there any logical reason to "store" just one object file (.o) into archival file (.a)?
Archiving a single object file into an archive file can be beneficial in scenarios where you want to maintain a consistent structure or naming convention across your project. It can also simplify ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
compilation × 62compiler × 12
c++ × 8
optimization × 8
javascript × 5
c × 5
java × 3
c# × 3
performance × 3
builds × 3
scripting × 3
interpreters × 3
build-system × 3
gcc × 3
jit × 3
design × 2
design-patterns × 2
python × 2
unit-testing × 2
programming-languages × 2
terminology × 2
language-design × 2
cpu × 2
production × 2
runtime × 2