Summary
7.1 Programming Language Foundations
- HLLs give us the ability to make use of abstraction to build algorithms in a close-to-English representation.
- There are criteria that are used for selecting the proper HLL for the required tasks. These can include scalability, cost, flexibility, efficiency, portability, and maintainability.
- HLLs are designed to fulfill a purpose, which could be general purpose, web oriented, object-oriented, or parallel-programming oriented, among others.
- HLLs are shipped with application programming interfaces (APIs) that contain useful tools and objects to help program them for their purpose.
- HLLs have different implementation approaches. These vary from compiled to interpreted to hybrid.
- IDEs are structured environments containing tools that are targeted to programming different HLLs.
7.2 Programming Language Constructs
- HLLs all have data types which are either primitive or complex that form the domain of legal data types they recognize.
- HLLs all have operators that represent the legal set of operations that may be performed on the data types such as addition or assignment.
- HLLs support variables named containers that may hold the legal values of the HLL data types and literals, which are a plain language representation of those values.
- HLLs have rules for identifiers that are user-defined names of language elements such as variables, constants, and functions.
- HLLs allow for documentation, usually as comments, so that programmers know about a program.
- HLLs provide data structures, such as arrays, which are containers to store multiple values.
- HLLs have constructs for flow of control which dictate the path of execution of the code, usually conditional statements and iteration constructs.
- HLLs provide the means to modularize, usually in the form of functions.
- A call stack or execution stack is the data structure that controls the execution of a program.
- Most HLLs provide the means for handling and recovering from runtime errors, a process called exception handling.
- HLLs can handle both user interactive and file input and output.
7.3 Alternative Programming Models
- Functional programming is a declarative language paradigm where programs are constructed by composing functions and applying them; some of whose features are implemented in imperative languages.
- Object-oriented programming (OOP) is a paradigm based on classes and objects and is widely implemented in many HLLs.
- The degree of support of encapsulation, inheritance, and polymorphism is indicative of the degree of object-orientation of an HLL.
- Concurrency is the behavior of an HLL when it can multitask sections of its own code, giving the illusion of simultaneous execution.
- Parallelism is the behavior of an HLL when it can simultaneously execute sections of its own code, requiring multiple cores or processors.
- Scripting languages are HLLs that are usually interpreted but retain many of the features of compiled languages and are often used for web programming.
7.4 Programming Language Implementation
- Compilers are the general tool used to implement the process of translating source code to another language that is either machine language or is closer to assembly language.
- Interpreters follow the same processes as compilers with differences in the timing of the translation phases.
- The compilation process is divided into distinct stages: a front end (code analysis), an optional middle end (code optimization), and a back end (code generation). These tasks may be done in just two stages: front end and back end.
- Many compilers generate assembly language either as their output (needs separate assembly) or as the output of one stage (assembly performed as part of compilation).
- A linker or link-loader is used to stitch together pieces of separately compiled code for final execution.
- Runtime management is handled by a runtime system which is highly aware of the functionality of the compiler as to enable the use of features like garbage collection, exception handling, and concurrency or parallelism.
- Runtime management may be handled by virtual machines which provide execution environments that are emulations of the computer architecture.
- Code optimization and code improvement are highly desirable features of program implementation.