Task

Generate Lexeme Analysis and Syntax Analysis on the following items:

A = B + C + 10

Lexical Analysis
LexemeToken
identifierA
assignment=
identifierB
operator+
identifierC
operator+
constant10
Syntax Analysis

POSITION = initial + rate * 60

Lexical Analysis
LexemeToken
identifierPOSITION
assignment=
identifierinitial
operator+
identifierrate
operator*
constant60
Syntax Analysis


A = (b * c) + 5

Lexical Analysis
LexemeToken
identifierA
assignment=
grouping(
identifierb
operator*
identifierc
grouping)
operator+
constant5
Syntax Analysis

X = (b+c+d) * (e * f)

Lexical Analysis
LexemeToken
identifierX
assignment=
grouping(
identifierb
operator+
identifierc
operator+
identifierd
grouping)
operator*
grouping(
identifiere
operator*
identifierf
grouping)
Syntax Analysis

Y = a(b+c+d+e)

Lexical Analysis
LexemeToken
identifierY
assignment=
identifiera
grouping(
identifierb
operator+
identifierc
operator+
identifierd
operator+
identifiere
grouping)
Syntax Analysis

S := a * b * c * d * e

Lexical Analysis
LexemeToken
identifierS
assignment:=
identifiera
operator*
identifierb
operator*
identifierc
operator*
identifierd
operator*
identifiere
Syntax Analysis

A := (x-y) * (v-d-t) * (d-e)

Lexical Analysis
LexemeToken
identifierA
assignment:=
grouping(
identifierx
operator-
identifiery
grouping)
operator*
grouping(
identifierv
operator-
identifierd
operator-
identifiert
grouping)
operator*
grouping(
identifierd
operator-
identifiere
grouping)
Syntax Analysis

F := v-s

Lexical Analysis
LexemeToken
identifierF
assignment:=
identifierv
grouping-
identifiers
Syntax Analysis

X := 6*(2*2*3)+5

Lexical Analysis
LexemeToken
identifierX
assignment:=
constant6
operator*
grouping(
constant2
operator*
constant2
operator*
constant3
grouping)
operator+
constant5
Syntax Analysis

A := 4-3-5-(3-4-5)

Lexical Analysis
LexemeToken
identifierA
assignment:=
constant4
operator-
constant3
operator-
constant5
operator-
grouping(
constant3
operator-
constant4
operator-
constant5
grouping)
Syntax Analysis