Task
Generate Lexeme Analysis and Syntax Analysis on the following items:
A = B + C + 10
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | A |
| assignment | = |
| identifier | B |
| operator | + |
| identifier | C |
| operator | + |
| constant | 10 |
Syntax Analysis
.png)
POSITION = initial + rate * 60
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | POSITION |
| assignment | = |
| identifier | initial |
| operator | + |
| identifier | rate |
| operator | * |
| constant | 60 |
Syntax Analysis
.png)
A = (b * c) + 5
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | A |
| assignment | = |
| grouping | ( |
| identifier | b |
| operator | * |
| identifier | c |
| grouping | ) |
| operator | + |
| constant | 5 |
Syntax Analysis
-1.png)
X = (b+c+d) * (e * f)
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | X |
| assignment | = |
| grouping | ( |
| identifier | b |
| operator | + |
| identifier | c |
| operator | + |
| identifier | d |
| grouping | ) |
| operator | * |
| grouping | ( |
| identifier | e |
| operator | * |
| identifier | f |
| grouping | ) |
Syntax Analysis

Y = a(b+c+d+e)
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | Y |
| assignment | = |
| identifier | a |
| grouping | ( |
| identifier | b |
| operator | + |
| identifier | c |
| operator | + |
| identifier | d |
| operator | + |
| identifier | e |
| grouping | ) |
Syntax Analysis
-2.png)
S := a * b * c * d * e
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | S |
| assignment | := |
| identifier | a |
| operator | * |
| identifier | b |
| operator | * |
| identifier | c |
| operator | * |
| identifier | d |
| operator | * |
| identifier | e |
Syntax Analysis
-1.png)
A := (x-y) * (v-d-t) * (d-e)
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | A |
| assignment | := |
| grouping | ( |
| identifier | x |
| operator | - |
| identifier | y |
| grouping | ) |
| operator | * |
| grouping | ( |
| identifier | v |
| operator | - |
| identifier | d |
| operator | - |
| identifier | t |
| grouping | ) |
| operator | * |
| grouping | ( |
| identifier | d |
| operator | - |
| identifier | e |
| grouping | ) |
Syntax Analysis
-2.png)
F := v-s
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | F |
| assignment | := |
| identifier | v |
| grouping | - |
| identifier | s |
Syntax Analysis
.png)
X := 6*(2*2*3)+5
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | X |
| assignment | := |
| constant | 6 |
| operator | * |
| grouping | ( |
| constant | 2 |
| operator | * |
| constant | 2 |
| operator | * |
| constant | 3 |
| grouping | ) |
| operator | + |
| constant | 5 |
Syntax Analysis
.png)
A := 4-3-5-(3-4-5)
Lexical Analysis
| Lexeme | Token |
|---|---|
| identifier | A |
| assignment | := |
| constant | 4 |
| operator | - |
| constant | 3 |
| operator | - |
| constant | 5 |
| operator | - |
| grouping | ( |
| constant | 3 |
| operator | - |
| constant | 4 |
| operator | - |
| constant | 5 |
| grouping | ) |
Syntax Analysis
-1.png)