Notes

Reflection

What is Reflection? # Reflection enables a program to observe and modify its own structure and behavior. t bridges the gap between the base level (the application logic) and the meta level (objects representing the program itself). Core Concepts # Introspection : The program can…

Initialization in Programming Languages

"I call it my billion-dollar mistake. It was the invention of the null reference in 1965. [...] This has led to innumerable errors, vulnerabilities, and system crashes." ~ Tony Hoare 1 The core problem addressed here is Null Safety and how to properly initialize objects to…

Bytecode Verification

Code in modern days is mobile in the sense that it gets downloaded and executed on the fly very often. In JVM they are usually shipped with: Platform independent code Organized into class files. Class Loaders # The class loader is the part of the JVM that takes the bytecode and…

Typing and Subtyping

We first start with some design goals for the language Language Design Principles # Simplicity Syntax and semantics can easily be understood by users and implementers of the language Expressiveness : Language can (easily) express complex processes and structures, conflicting…

Inheritance

Introduction to Inheritance # Difference between Inheritance and Subtyping # We say that a subclass is inheritance and subtyping. We have studied subtyping in Typing and Subtyping and it entails mainly two things: Liskov Substitution Polymorphism of the types While inheritance…

Teoria dei Tipi

Introduzione alla Teoria dei Tipi # History of Languages Research # The root of languages research are in: in logic and computations (even before computers!). Artificial intelligence (Lisp, constrained solvers, the original logical AI we studied in (Russell & Norvig 2009)…

Classi OOP

Introduzione a OOP # Per la definizione di classe andare a guardare Object Orientation , però lo ripeto in questa occasione, è solamente un modello su cui andare a costruire degli oggetti. Capisaldi # Incapsulazione (con interfaccia, base per la documentazione) Astrazione…

LR(k) e YACC

LR(k) # Grammatiche LR(k) # Anche in questo caso proviamo a generalizzare il concetto dei pirmi k caratteri, in modo da generalizzare in qualche senso il concetto di LR(k), quindi andiamo a modificare la closure considerando ora first k Per ricordarti come si calcolava first k,…

Linguaggi Deterministici e DPDA

DPDA # Definizione (2) # La definizione di DPDA è molto simile a quella trattata in Linguaggi liberi e PDA , con solo costraints sulla deterministicità, che si traducono in due condizioni: Al massimo posso avere un risultato per ogni coppia di lettura e simbolo su stack Se ho…

Linguaggi liberi e PDA

In questa parte del nostro percorso nei linguaggi di programmazione proviamo ad espandere NFA e DFA in modo che possano riconoscere linguaggi come w w r ∣ w ∈ { a , b } ∗ , con r maggiore o uguale a zero (r per dire che è il contrario di w) (questo linguaggio per il pumping…