Our type inference algorithm is based on the Hindley-Milner algorithm. We'll extend it to support parametric polymorphism.
Algorithm Steps:
Primary Resource: Practical Foundations for Programming Languages (PFPL) by Robert Harper.
Syntax is the surface. In formal foundations, we don't use regular expressions; we use Context-Free Grammars (CFGs) and Abstract Syntax Trees (ASTs) . 15-312 emphasizes the difference between concrete syntax (what the programmer types) and abstract syntax (what the compiler understands). You learn to define languages using BNF (Backus-Naur Form) with a rigor that erases ambiguity.
15-312: Foundations of Programming Languages is a course that stays with a programmer long after they have forgotten the syntax of SML. It is an initiation into the "deep magic" of computation.
It produces a breed of programmer who does not fear the compiler, who understands the logical structure of the systems they build, and who can learn a new language in an afternoon because they understand the universal components—syntax, statics, and dynamics—that constitute all languages. It is a rigorous reminder that beneath the chaotic surface of modern software engineering lies a beautiful, immutable foundation of logic.
Course Title: 15312 Foundations of Programming Languages 15312 foundations of programming languages
Overall Rating: 4.5/5
Course Description: This course provides a comprehensive introduction to the fundamental concepts of programming languages, covering the design, implementation, and analysis of various programming paradigms.
Strengths:
Weaknesses:
Suggestions for Improvement:
Target Audience:
Recommendations:
Overall, "15312 Foundations of Programming Languages" is a comprehensive and engaging course that provides a solid foundation in programming languages. While it may have a steep learning curve, the course offers a wealth of knowledge and practical experience, making it an excellent choice for students and professionals interested in programming languages and software development.
Languages like Java and C++ use subtyping (a Cat is an Animal). The 15-312 treatment includes:
List<Cat> a subtype of List<Animal>? (Covariance, contravariance, invariance).One of the most powerful ideas in 15312 is the type system. A type is a label that tells you what kind of value a variable or expression can hold—integer, boolean, string, function, etc.
Type systems catch errors before the program runs. They are the mathematical armor against entire classes of bugs.
Consider:
3 + true – in a statically typed language like ML or Rust, this is rejected at compile time.But types do more than prevent errors. They express intent. A function add : int × int → int says clearly: “I take two integers and return an integer.”
The crown jewel of type theory is the Curry-Howard Correspondence:
A program is a proof; a type is a logical formula.
This deep link between programming and logic means that writing a correct program is like constructing a proof of a theorem.
Type inference (as in Haskell or OCaml) can even deduce types without explicit annotations—a magical-seeming ability grounded in unification algorithms.
Syntax: [ \beginarrayrcl e & ::= & x \mid \textnum(n) \mid \textplus(e_1, e_2) \ v & ::= & \textnum(n) \endarray ] Syntax: Define a syntax for PolyLambda programs, including
Evaluation Rules (Call-by-Value): [ \frac{}\textnum(n) \Downarrow \textnum(n) \quad \text(E-Const) ] [ \frace_1 \Downarrow \textnum(n_1) \quad e_2 \Downarrow \textnum(n_2)\textplus(e_1, e_2) \Downarrow \textnum(n_1 + n_2) \quad \text(E-Plus) ]