Lexical Analysis (1 Viewer)

BlakeOlivo

Member
Joined
Nov 10, 2011
Messages
83
Gender
Male
HSC
2012
Uni Grad
2015
Could someone please explain to me this syntactical and lexical analysis concept? I am very confused :/
 

harrisony

goodbye cruel world
Joined
Jun 1, 2009
Messages
3,596
Gender
Undisclosed
HSC
N/A
Lexical Analysis is all about breaking a piece of source code like
Code:
total = 10 + 5
into parts (tokens).

so in that example we have "total" as a variable, "=" as an assignment, "10" and "5" as literal integers and "+" as an arithmetic operator.

Syntactic Analysis turns the tokens generated in the lexical analysis stage and creates a tree which describes the code in a way the compiler can understand.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top