Answered step by step
Verified Expert Solution
Question
1 Approved Answer
T1={supper,abcd1e}T2={abd SUPPERID = strings that are ID (see below) and that have supper as prefix. For example, supper123, supper, supperabc are SUPPERID, but supper_ is
T1={"supper","abcd1e"}T2={"abd" SUPPERID = strings that are ID (see below) and that have "supper" as prefix. For example, "supper123", "supper", "supperabc" are SUPPERID, but "supper_" is not SUPPERID because "supper_" is not an ID ID= Set of strings that consist of a letter or underscore that is followed by zero or more letters and/or digits. For example, "_,"_11", "_1a1b" are IDs, but "_ " and "a_" are not IDs according to this definition CRAZYID = Set of strings that consist of an ID followed by "_crazy". For example, "a_crazy" is a CRAZYID, but "a_CRAZY", "acrazy" and "a_crazy" (two underscores) are not a CRAZYID NUM = Set of strings that consist of a non-zero digit that is followed by 1 or more digits or the string " 0 ". For this problem, when identifying tokens in the input, we treat \& and ! as separators. This means that getToken() should stop when it reaches \& or ! and returns the longest matching prefix up to but not including the separator. The separator itself (\& or !) cannot be part of a token, so the next token starts after the separators. \& and ! are the only separator. Space characters are not separators for this problem. Consider the input: supper22_crazyabc!!\&d1_11\&_supper_11\&123abcd1e and the following sequence of calls: tl=lexer.GetToken(;t2=lexer.GetToken();t3=lexer.peek(1);t4=lexer.peek(3);t5=lexer.peek(5);t6=lexer.peek(7); t7=lexer.GetToken();t8=lexer.GetToken(); What are the values of t1,t2,t3,t4,t5,t6,t7 and t8 ? You are only asked to give the values and not to explain how you obtained them
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started