What programming is2.1
Computer programming is becoming a much bigger industry and is growing year upon year. It's become an important part of modern life and it's a skill that can be considered essential.
In a programming language, source code is a series of tokens (symbols and words). These tokens are then translated to code that computers can understand known as machine code. When the source code is translated it is called a computer program.
A program can either be interpreted or compiled. Compiled code is code that is translated into machine code and no longer contains the high level source code that was originally used to create the program. Interpreted source code is code that is compiled line by line so that it can either be debugged or stopped at a certain location in the code.
Some programming languages (including the ZPE/YASS language) use JIT or Just-In-Time compiling whereby they compile the code to interpret it straight away, often to an another language or byte-code/op-code. This is becoming more and more favourable as computers get faster and faster and programs become less demanding. For instance, the PHP server side web development language use a form of JIT to compile code and executes it immediately.
If you are interested in seeing how a program works, you may be interested in my own ZPE programming environment as well as the YASS language that comes with it as ZPE is designed with education in mind and has many tools that will help you to see how code is transformed.
Syntax and semantics
Programming is the art of writing beautiful, syntactically and semantically accurate code that a computer can understand in the simplest way possible.
In regards to language, syntax is the arrangement in which words (or in programming contexts, tokens) follow. With this syntax we can form a formal language which consists of statements.
In contrast, semantics is concerned with the meaning of the arrangement words. If a statement has good syntax, it does not neccessarily have good semantics.
Because of semantics, a compiler can turn a bunch of tokens into something that it can act upon, e.g. some byte-codes. If tokens are arranged in a specific way, they will always be interpreted to the same underlying meaning.
A girl called Sarah had one grandmother named Jane.
This statement could be interpreted as either:
- a girl called Sarah had a single grandmother whose name was Jane
- a girl called Sarah had multiple grandmothers, but only one called Jane
A computer compiler might be unable to decide what to compile the input to based on what it is given and may need more. This is why most programming languages have strong structures and expect you to write less rather than more. For example: