programming languages lecture 1 : notes

Assessment

written Exam - lab based (70%) programming Assignment (25%) weekly quizzes (5%)

PL pipeline (high level)

parsing β†’ type checking β†’ desugaring β†’ IR conversion β†’ optimisation β†’ interpretation/compilation

PL Design

Syntax

constructs of the language? how do expressions or statements look?

Typing rules

can we trim nonsensical answers going into the programming language?

semantics

what the programming language does when running it?

programming paradigms

the right tool for the job

imperative

Program Counter + Call Stack + state have a current place in the program and alter the position

expressions vs statments

Statment: an instruction / computation step (doesnt return anything)

Expression: a term when evaluated reduces to a value

Expressions can be contained within a statement

functional

everything is an expression first class functions (functions are treated as variables)

object-Oriented

consists of some state(fields), and some functions that operate on the state(methods) encapsulation : don’t expose internal state

Syntax

regex

for recognising tokens for regular languages - they can be recognised by finite state automaton

grammer

set of formal rules specifiying how ot constrcut a sentence: Terminal symbols : symbols that occur in a sentence non terminal symbols : sentence symbol : production rules :

BNF form

parse trees