Theory and Design of PL (CS 538)
March 11, 2020
i32
is signed 32-bit, u8
is unsigned 8-bit, …f32
is 32-bit floating, f64
is 64-bit, …:
, not double ::
as
let my_true_bool = true;
let my_false_bool: bool = false; // with annotation
let little_z = 'z';
let fancy_z = 'ℤ';
let heart_eyed_cat = '😻';
.0
, .1
, .2
, ….0
, .1
, etc.&str
Maybe
Maybe a
)Option::
case
in Haskell…T
: comes from impl T
&
, mut
) are very important!var = "x" | "y" | "z" | ... ;
bexpr = "true" | "false"
| bexpr "&&" bexpr | aexpr "<" aexpr | ... ;
aexpr = var | num-cons
| aexpr "+" aexpr | aexpr "*" aexpr | ... ;
comm = "skip" (* do-nothing comm *)
| var ":=" aexpr (* assign to var *)
| comm ";" comm (* sequencing *)
| "if" bexpr "then" comm "else" comm (* if-then-else *)
| "while" bexpr "do" comm ; (* while loops *)