70 likes | 286 Views
Programming Languages: Basics. Evolution of Programming Languages. “Paper machines”: Turing, von Neumann Binary code -> Assembler Early procedural languages: Fortran Algol : ancestor of modern procedural languages LISP: elegant, mostly functional, AI-language
E N D
Evolution of Programming Languages • “Paper machines”: Turing, von Neumann • Binary code -> Assembler • Early procedural languages: Fortran • Algol: ancestor of modern procedural languages • LISP: elegant, mostly functional, AI-language • Smalltalk: ancestor of modern object oriented languages
Programming Paradigms • Procedural: update memory cells – destructive assignments, the Turing tape on steroids • Object Oriented: inheritance, methods • Functional: based on lambda calculus / combinators, recursion theory, category theory. Functions ONLY! • Logic: based on predicate calculus, relational, “non-determinism”. Uses backtracking, unification.
Syntax and Semantics • Syntax: CF-grammars - easy to compile, easy to learn – uses REGEXPs for tokenizer • Denotational semantics: meaning of the program as a mathematical object • Operational semantics: how it works on a real or virtual machine • Also important for success: pragmatics – how it is used, how it benefits from developer environments, does it run on popular platforms, how it facilitates software construction
Language Processors: Interpreters and Compilers • Interpreters: hardware or software, real or virtual machines • Compiler: translating from the programming language as seen by humans to the low-level code able to be interpreted by the machine • Front end: language -> syntax tree -> high-level intermediate code, machine independent • Back end: machine specific code generator, optimizers, linkers, assemblers
Models of computation • Turing machines: one tape, multiple tape, RAM machines – all equivalent • Lambda calculus: a theory of function application and parameter sybstitution • Combinators: semantically the same as lambda calculus, but getting rid of explicit parameters • Exotic models: DNA-computing, Quantum-computing, molecular computing
Turing equivalence • All major programming languages can compute exactly as much as a Turing machine can. • All alternative formalisms – lambda calculus, combinators, type 0 language processors are equivalent to Turing machines in what they can compute. • Why use (and love/hate) various programming languages? Because of their different expressive power (high-level, elegant, easy to learn, fast, popular – and also for a few things in the eye of the beholder )