The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+2 votes
How are constants recogonized by the lexical analyser like

interger 1234     floating point  1234.56789

and what happens when we have -1234  and -1234.56789 how many tokens are generated in this case(each of this case) ?

is "-" considered seperately ?
asked in Compiler Design by Active (3.2k points) | 84 views
"-" is considered as a separate token, it is an unary operator. Rest of the constant is taken as a single token, i.e. -1234.56789 are two token: "-" and "1234.56789".
but - is not unary  --  and -= are unary right ?
but i too think it will generate as it is valid operator
If "-" is a separate token in "-2.5" then we need not have a representation for negative numbers :)

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

36,088 questions
43,532 answers
42,762 users