The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+4 votes
236 views

Is this line  a/*b successfully generating the token's or it give lexical error ? if it is given the lexical error then why so ?


I think it will give lexical error because we don't find */ here

asked in Compiler Design by Loyal (9.4k points) | 236 views
0
a is definitely token here.

then /*...........*/ if there then it will not count as token.

But it can take divide sign and * separately

So, why not 4 tokens?
0

@srestha  what would be number of tokens if pattern is given as a/*b ;

0

chk here https://gateoverflow.in/193991/token

discussion going on. just follow it

1 Answer

+1 vote
I think, it gives lexical error bcz in a/*b it first scan 'a',

and after that it scan '/' then '*'. after  /* lexical analyzer consider this as a start of comment but,

it not get the end of comment it fall in infinite loop that's why it gives lexical error.
answered by (269 points)

Related questions

+3 votes
3 answers
4
asked Dec 15, 2016 in Compiler Design by prasitamukherjee Active (2.1k points) | 1.8k views


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

46,638 questions
51,132 answers
176,185 comments
66,551 users