{"id":160318,"date":"2023-09-26T12:08:32","date_gmt":"2023-09-26T06:38:32","guid":{"rendered":"https:\/\/www.gkseries.com\/blog\/?p=160318"},"modified":"2023-09-26T12:08:33","modified_gmt":"2023-09-26T06:38:33","slug":"a-lexical-analyzer-uses-the-following-patterns-to-recognize-three-tokens-t1-t2-and-t3-over-the-alphabet-abc","status":"publish","type":"post","link":"https:\/\/www.gkseries.com\/blog\/a-lexical-analyzer-uses-the-following-patterns-to-recognize-three-tokens-t1-t2-and-t3-over-the-alphabet-abc\/","title":{"rendered":"A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}."},"content":{"rendered":"\n<p>Q. A lexical analyzer uses the following patterns to recognize three tokens <em>T<\/em>1, <em>T<\/em>2, and <em>T<\/em>3 over the alphabet {<em>a<\/em>,<em>b<\/em>,<em>c<\/em>}.<\/p>\n\n\n\n<p>\ud835\udc47<sub>1<\/sub>:&nbsp; &nbsp;\ud835\udc4e? (\ud835\udc4f|\ud835\udc50)<sup>\u2217<\/sup>\ud835\udc4e<\/p>\n\n\n\n<p>\ud835\udc472:&nbsp; &nbsp;\ud835\udc4f? (\ud835\udc4e|\ud835\udc50)<sup>\u2217<\/sup>\ud835\udc4f<\/p>\n\n\n\n<p>\ud835\udc47<sub>3<\/sub>:\u00a0 \u00a0\ud835\udc50? (\ud835\udc4f|\ud835\udc4e)<sup>\u2217<\/sup>\ud835\udc50<\/p>\n\n\n\n<p>Note that \u2018<em>x<\/em>?\u2019 means 0 or 1 occurrence of the symbol <em>x<\/em>. Note also that the analyzer outputs the token that matches the longest possible prefix.<\/p>\n\n\n\n<p>If the string \ud835\udc4f\ud835\udc4f\ud835\udc4e\ud835\udc4e\ud835\udc50\ud835\udc4e\ud835\udc4f\ud835\udc50 is processed by the analyzer, which one of the following is the sequence of tokens it outputs<em>?<\/em><\/p>\n\n\n\n<p>(A) \ud835\udc471\ud835\udc472\ud835\udc473\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (B) \ud835\udc471\ud835\udc471\ud835\udc473\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (C) \ud835\udc472\ud835\udc471\ud835\udc473\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (D) \ud835\udc473\ud835\udc473<\/p>\n\n\n\n<p>Ans: \ud835\udc473\ud835\udc473<\/p>\n\n\n\n<p>Sol:<\/p>\n\n\n\n<p>0 or 1 occurrence of the symbol x. &nbsp; T<sub>1<\/sub>&nbsp;: (b+c)* a + a(b+c)* a T<sub>2<\/sub>&nbsp;: (a+c)* b + b(a+c)* b T<sub>3<\/sub>&nbsp;: (b+a)* c + c(b+a)* c Given String : bbaacabc Longest matching prefix is \\\u201d&nbsp;<strong>bbaac<\/strong>&nbsp;\\\u201d&nbsp;<em>(Which can be generated by&nbsp;<strong>T3<\/strong>)<\/em>&nbsp;The remaining part (after Prefix) \\\u201dabc\\\u201d&nbsp;<em>(Can be generated by&nbsp;<strong>T3<\/strong>)<\/em>&nbsp;So, the answer is&nbsp;<strong>T<sub>3<\/sub>T<sub>3<\/sub><\/strong>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}. \ud835\udc471:&nbsp; &nbsp;\ud835\udc4e? (\ud835\udc4f|\ud835\udc50)\u2217\ud835\udc4e \ud835\udc472:&nbsp; &nbsp;\ud835\udc4f? (\ud835\udc4e|\ud835\udc50)\u2217\ud835\udc4f \ud835\udc473:\u00a0 \u00a0\ud835\udc50? (\ud835\udc4f|\ud835\udc4e)\u2217\ud835\udc50 Note that \u2018x?\u2019 means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. [&hellip;]<\/p>\n","protected":false},"author":419,"featured_media":160319,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5141],"tags":[5140],"class_list":["post-160318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gate","tag-gate-questions"],"_links":{"self":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/users\/419"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/comments?post=160318"}],"version-history":[{"count":1,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160318\/revisions"}],"predecessor-version":[{"id":160320,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/posts\/160318\/revisions\/160320"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media\/160319"}],"wp:attachment":[{"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/media?parent=160318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/categories?post=160318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gkseries.com\/blog\/wp-json\/wp\/v2\/tags?post=160318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}