search
Log In

Recent questions tagged compiler-tokenization

2 votes
1 answer
1
The above diagram is Transition Diagrams for identifiers. As we can see that the identifier is said to be accepted if it starts with a letter and ends with a valid delimiter, which includes blank symbol, arithmetic, logical operator, left parenthesis, right parenthesis, +, ... ends with a delimiter and + is a valid delimiter and the error in declaration will not be detected at this stage...
asked Jun 9, 2019 in Compiler Design Hirak 660 views
1 vote
2 answers
2
which one of the following string can definitely said to be a token without looking at the next input: +(++,+=) return(return a) *(*=) =(==) ++ , ( ) ‘ ; option e is: plusplus, comma, bracket open, bracket close, single quote ;
asked Jun 5, 2019 in Compiler Design Rhythm 1.4k views
0 votes
0 answers
3
Q1: Consider G :- $X \rightarrow X + Y | Y$ $Y \rightarrow Y*Z|Z$ $Z \rightarrow (X)$ $Z \rightarrow id$ if LR(1) parser is used to parse the above grammar, then total how many lookahead will be present in the dfa state I0 for the items $X \rightarrow .Y \text{ and } Z \rightarrow .id$. My Answer: ... --------------------------------------------------------------- Someone verify all these answers.
asked Nov 8, 2018 in Compiler Design Shubhanshu 215 views
2 votes
2 answers
4
1 vote
2 answers
5
0 votes
1 answer
6
The number of tokens in the fortran statements DO 10 I = 1.3 is ?
asked Sep 22, 2018 in Compiler Design syncronizing 104 views
1 vote
1 answer
7
Find no of tokens in below program. #include<stdio.h> main() { int I; int *pi = &I; //parent pointer scanf("%d",pi); printf("%d\n", I+5); }
asked Sep 21, 2018 in Compiler Design sagar27 1.3k views
1 vote
0 answers
8
Whether a given pattern constitutes a token or not (a) depends on the source language (b) depends on the target language (c) depends on the compiler (d) none of the above comment is true
asked Sep 16, 2018 in Compiler Design goluabhinan 1.4k views
1 vote
1 answer
9
void main() { int total-value, Num=2,sum=5,var1; 5=Num; var1=2; sum=num*1; if(sum=var1) { sum=sum+1 } } Here, is $\text{"total-value"}$ a lexical error?
asked Mar 20, 2018 in Compiler Design Jason 1.2k views
2 votes
3 answers
10
If I have the grammar : E->E*F | F+E |F F->id , Now here although + and * are defined at the same level , with different associativity but this grammar produces 2 different parse trees for the string id+id*id , so here we can't make any generalization regarding precedence of the operators although they are defined at the same level . So what conclusion can be drawn from this ?
asked Mar 19, 2018 in Compiler Design radha gogia 315 views
2 votes
4 answers
11
1 vote
0 answers
12
# DEFINE M 100 int main() { // declare variables int n = 2020; return n%M; } The number of tokens in this program?
asked Jan 20, 2018 in Compiler Design Mk Utkarsh 209 views
5 votes
1 answer
13
How many tokens are there? 1) int a /*b 2) printf ("%
asked Jan 13, 2018 in Compiler Design srestha 605 views
2 votes
2 answers
14
What are different set of characters which are taken as single token in lexical analysis in compiler design? For eg. Charaters under double quotes are taken as single token, post-increment and pre-increment is taken as single token etc.
asked Dec 27, 2017 in Compiler Design Shubham Kumar Gupta 459 views
1 vote
1 answer
15
Which of the following not a token of C program? a)1.02e+2 b)#define c)MAX d)123.33
asked Dec 23, 2017 in Compiler Design srestha 397 views
5 votes
4 answers
16
if there is miss spelling in some keyword in a program then this misspelled keyword will be treated as lexical errors or it will be treated as a new identifier and accepted as a token ?? ex - whiel (1) ; here while is misspelled as whiel
asked Nov 2, 2017 in Compiler Design itsvkp1 1.3k views
3 votes
1 answer
17
int main() { print("%d",a); return 0; } If i execute,i will get error as:- prog.c:112:17: error: 'a' undeclared (first use in this function) printf("%d",a); Now as this is the semantic error,so how does semantic analyzer knows the row and ... I know lexical analyzer can give the row number and column number of error as it tokenize the entire program but is this also possible in sematic analyzer?
asked Oct 9, 2017 in Compiler Design rahul sharma 5 383 views
3 votes
1 answer
18
How many tokens are there in the following statement: x >> = 2; In general, are shorthand operators counted as a single token as ">>=" or double as ">>" and "=". Or anything else?
asked Oct 2, 2017 in Compiler Design Rishabh Gupta 2 571 views
2 votes
1 answer
19
This screenshot is token from the book Ullman, How can following be a lexical error? because "elipseSize" should have a token recorded as an identifier.
asked Sep 26, 2017 in Compiler Design Manu Thakur 776 views
9 votes
2 answers
20
I am writing down some errors and its type with a reason.If there something wrong please correct it with a valid reason. 1.fi(a==10) this is not a lexical error, because lexical analyzer cannot tell whether fi is a misspelling of the keyword if or an undeclared function ... is not a valid token. but this says it is streams of valid tokens 6.int d=10.10.10 lexical error as invalid num token.
asked Aug 14, 2017 in Compiler Design reena_kandari 1.3k views
4 votes
3 answers
22
Find the type of error produced by the following C code. main() { in/*comment t x; floa/*comment*/t gate; } Lexical error syntax error both a) and b) None of these
asked Feb 7, 2017 in Compiler Design Ashwani Kumar 2 1.6k views
13 votes
2 answers
24
Consider the following C program: int main (void) { in/*this is an example*/z; double/*is it an error?*/y; print( “This is simple” ); return 0; } - How many Different tokens are there in the above code.
asked Dec 13, 2016 in Compiler Design dd 1.7k views
0 votes
1 answer
25
Consider the following C program: How many different tokens are there for the same program
asked Sep 28, 2016 in Compiler Design Rohan Mundhey 309 views
0 votes
1 answer
26
Given explanation Couldn't understand the explanation. Please explain
asked Jan 22, 2016 in Compiler Design shikharV 269 views
5 votes
3 answers
28
1 vote
1 answer
29
what lexical analysis phase use. regular expression , regular grammar , ??
asked Jan 12, 2016 in Compiler Design Tendua 367 views
1 vote
1 answer
30
How tokens are assigned for a string having escape sequence in C lexical phase Eg.. printf ("this\" is a string\""); and what for printf ("this is""a string");
asked Oct 16, 2015 in Programming admin 317 views
To see more, click for the full list of questions or popular tags.
...