CS152
Chris Pollett
Oct 20, 2021
L ::= id LT ⊳ L.c := 1 + LT.c
expr ::= const expr_tail ⊳ expr_tail.st := const.val ⊳ expr.val := expr_tail.val
parseExpr(Attributes exprAttrs, int position, String programString)
Prefix: op a b or op(a, b) or (op a b) Infix: a op b Postfix: a b op
cond ? a : bis an exception, and might be though as a kind of three argument infix. Algol has a similar construct. Smalltalk lets you use infix like this for all functions.
(* (+ 1 3) 2) ; In infix: (1 + 3) * 2
max (2 + 3) 4;;would evaluate to 5.
(a + b) * (c - d) (- a) + (d - c) a + (c - d) + b
d = a; a = b + c:
b := 2; c := b; a := b + c;
import java.util.Hashtable; ... Hashtable ht = new Hashtable(); ... Integer N = new Integer(13); ht.put(N, new Integer(31)); Integer M = (Integer) ht.get(N); int m = M.intValue();
ht.put(13,31); int m = (Integer) ht.get(13);where "boxing/unboxing" is done automatically.