Computer Science, asked by mohammadsaddam6426, 1 year ago

Discuss how the lexical analyzer will tokenize thefollowing inputs for c language

Answers

Answered by knowledgehunter767
0

Lexical analysis is the 1st phase of a compiler action which takes the modified source code from the preprocessors of the language which are being used to be written in the form of sentences. A lexical analyzer is a tool that breaks down all these syntaxes into tokens and removes all the comments or whitespace in the source code.

For writing a C program that implements the lexical analyzer for Arithmetic Expression has the Programming language arithmetic expression as the Input and the sequence of tokens is the output. 

An example of the program taken from another website is as follows - 

Variable name <1,#adddress>

Numeric constant <2,#address>

; <3,3>

= <4,4>

+ <43,43>

+= <430,430>

- <45,45>

-= <450,450>

* <42,42>

*= <420,420>

/ <47,47>

/= <470,470>

% <37,37>

%= <370,370>

^ <94,94>

^= <940,940>

follow me up for more answers....

Similar questions