---
# System prepended metadata

title: Compiler Design - assignment 3

---

# Compiler Design - assignment 3
#### Arjun R Nair CS6A 18

### Augmented Grammar
```
AUGMENTED GRAMMAR:
 0:     S' -> S
 1:      S -> mul = ST
 2:     ST -> LIT
 3:     ST -> ST * ST
 4:     ST -> IDENT
 5:     ST -> ( ST )
 6:     ST -> ST + ST
 7: LETDIG -> ( LETTER
 8: LETDIG -> LETDIG
 9: LETDIG -> DIGIT )
10:  IDENT -> LETTER LETDIG
11:    LIT -> ( DIGIT ( DIGIT ) )
12: LETTER -> x
13: LETTER -> e
14: LETTER -> t
15: LETTER -> s
16: LETTER -> m
17: LETTER -> i
18: LETTER -> n
19: LETTER -> r
20: LETTER -> z
21: LETTER -> p
22: LETTER -> v
23: LETTER -> f
24: LETTER -> a
25: LETTER -> h
26: LETTER -> y
27: LETTER -> u
28: LETTER -> j
29: LETTER -> d
30: LETTER -> c
31: LETTER -> _
32: LETTER -> g
33: LETTER -> o
34: LETTER -> l
35: LETTER -> k
36: LETTER -> q
37: LETTER -> w
38: LETTER -> b
39:  DIGIT -> 4
40:  DIGIT -> 7
41:  DIGIT -> 3
42:  DIGIT -> 6
43:  DIGIT -> 2
44:  DIGIT -> 0
45:  DIGIT -> 8
46:  DIGIT -> 9
47:  DIGIT -> 1
48:  DIGIT -> 5
```

### Terminals
```
TERMINALS: (, m, o, 2, t, i, 5, *, 0, 6, ), 3, 1, 9, q, k, _, h, a, u, +, w, e, r, l, 8, x, b, 7, f, 4, d, s, mul, n, c, p, =, v, z, j, g, y
```
### Non-Terminals
```
NONTERMINALS: S, IDENT, LETTER, DIGIT, LETDIG, S', LIT, ST
```
### Symbols
```
SYMBOLS: (, m, o, 2, t, i, 5, *, 0, 6, ), 3, 1, 9, q, k, _, h, IDENT, a, u, +, S', LIT, ST, w, e, LETTER, r, l, 8, x, b, 7, f, 4, S, d, DIGIT, s, mul, n, LETDIG, c, p, =, v, z, j, g, y
```
### First
```
FIRST:
    S' = { mul }
     S = { mul }
    ST = { (, m, o, t, i, q, k, _, h, a, u, e, r, l, x, b, f, d, s, n, c, p, v, z, w, j, g, y }
LETDIG = { (, 2, 8, 5, 0, 1, 3, 9, 7, 4, 6 }
 IDENT = { m, o, t, i, q, k, _, h, a, u, e, r, l, x, b, f, d, s, n, c, p, v, z, w, j, g, y }
   LIT = { ( }
LETTER = { w, e, m, o, r, t, i, l, x, b, q, k, _, f, h, d, a, s, n, u, c, p, v, z, j, g, y }
 DIGIT = { 2, 8, 7, 5, 0, 1, 3, 9, 6, 4 }
```
### Follow
```
FOLLOW:
    S' = { $ }
     S = { $ }
    ST = { ), $, +, * }
LETDIG = { ), $, +, * }
 IDENT = { ), $, +, * }
   LIT = { ), $, +, * }
LETTER = { (, 2, 8, 5, *, 0, 1, ), 3, 9, $, 7, 4, 6, + }
 DIGIT = { ), ( }
 ```