Language design is the craft of deciding what a programming language lets you say, what it forbids and what it makes easy. Every feature trades expressiveness against safety, simplicity and speed, and a small set of choices shapes the whole language: its types, its evaluation rules, how it handles errors and how programs are split into pieces.
Key concepts
- Syntax and semantics: syntax is how programs are written; semantics is what they mean when they run.
- Type system: static or dynamic, strong or weak, with inference, generics and subtyping as the usual dials.
- Evaluation model: strict or lazy, expressions or statements, how names are bound and how scope works.
- Abstraction mechanisms: functions, modules, objects, traits or interfaces, macros.
- Error and resource handling: exceptions, result values, ownership, garbage collection.
- Orthogonality: features that combine without special cases are easier to learn.
Vocabulary
- Grammar: a formal description of which strings are programs, often written in BNF.
- Paradigm: a style of programming, such as imperative, functional, object-oriented or logic.
- Undefined behaviour: a program the language gives no meaning to, leaving the result to the implementation.
- Sugar: syntax that is a convenience over a smaller core language.
What to study, in order
- Use three languages from different paradigms and write down what each made easy and what it made awkward.
- Learn to read a grammar, then write one for arithmetic expressions with precedence.
- Implement a tiny interpreter for a toy language of your own, with variables and functions.
- Study scope, closures and a simple type checker; add types to your toy language.
- Read a language's specification or reference manual and a proposal to change it, noting the arguments for and against.
Related tags
#compilers #interpreters #type-theory #functional-programming