The Function of a Scanner Reading characters from the source code and form them into logical units called tokens Tokens are logical entities defined as an enumerated type – Typedef enum {IF, THEN, ELSE, PLUS, MINUS, NUM, ID,…} TokenType;
Function of a Parser Takes the sequence of tokens produced by the scanner as its input and produces the syntax tree as its output. Parser Sequence of tokens Syntax-Tree
Attributes – Any property of a programming language construct such as The data type of a variable The value of an expression The location of a variable in memory