CFG Translation rules === ================= B -> 0 B.trans = 0 -> 1 B.trans = 1 -> B 0 B1.trans = B2.trans * 2 -> B 1 B1.trans = B2.trans * 2 + 1 Input ===== 1001 Annotated Parse Tree ==================== (9) B / \ / \ (4) B 1 / \ / \ (2) B 0 / \ / \ (1) B 0 | 1