{"id":2808,"date":"2025-06-06T14:05:28","date_gmt":"2025-06-06T14:05:28","guid":{"rendered":"https:\/\/diznr.com\/?p=2808"},"modified":"2025-06-06T14:05:28","modified_gmt":"2025-06-06T14:05:28","slug":"compiler-design-short-trick-to-find-the-given-grammar-is-ll1-or-not-in-compiler-design-english-in","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/compiler-design-short-trick-to-find-the-given-grammar-is-ll1-or-not-in-compiler-design-english-in\/","title":{"rendered":"Compiler Design\/ Short trick to find the given grammar is (LL1) or not in Compiler Design In English"},"content":{"rendered":"<p>Compiler Design\/ Short trick to find the given grammar is (LL1) or not in Compiler Design In English<\/p>\n<p>[fvplayer id=&#8221;123&#8243;]<\/p>\n<h3 data-start=\"0\" data-end=\"85\"><strong data-start=\"4\" data-end=\"83\">\u00a0How to Quickly Check if a Grammar is LL(1) \u2013 Compiler Design Short Trick<\/strong><\/h3>\n<p data-start=\"87\" data-end=\"302\"><strong data-start=\"87\" data-end=\"104\">LL(1) Grammar<\/strong> is a type of <strong data-start=\"118\" data-end=\"148\">context-free grammar (CFG)<\/strong> used in <strong data-start=\"157\" data-end=\"177\">top-down parsing<\/strong>. To determine whether a given grammar is <strong data-start=\"219\" data-end=\"228\">LL(1)<\/strong>, follow this simple <strong data-start=\"249\" data-end=\"264\">short trick<\/strong> based on <strong data-start=\"274\" data-end=\"299\">First and Follow sets<\/strong>.<\/p>\n<h3 data-start=\"309\" data-end=\"361\"><strong data-start=\"312\" data-end=\"361\">\u00a0Quick Steps to Check if a Grammar is LL(1)<\/strong><\/h3>\n<h3 data-start=\"362\" data-end=\"418\"><strong data-start=\"368\" data-end=\"418\">Step 1: Compute First Sets for Each Production<\/strong><\/h3>\n<ol data-start=\"419\" data-end=\"570\">\n<li data-start=\"419\" data-end=\"509\"><strong data-start=\"422\" data-end=\"434\">FIRST(A)<\/strong> = Set of terminals that appear at the beginning of the derivations of A.<\/li>\n<li data-start=\"510\" data-end=\"570\">If <strong data-start=\"516\" data-end=\"525\">A \u2192 \u03b5<\/strong>, then include <strong data-start=\"540\" data-end=\"553\">FOLLOW(A)<\/strong> in <strong data-start=\"557\" data-end=\"569\">FIRST(A)<\/strong>.<\/li>\n<\/ol>\n<h3 data-start=\"572\" data-end=\"631\"><strong data-start=\"578\" data-end=\"631\">Step 2: Compute Follow Sets for Each Non-Terminal<\/strong><\/h3>\n<ol data-start=\"632\" data-end=\"814\">\n<li data-start=\"632\" data-end=\"729\"><strong data-start=\"635\" data-end=\"648\">FOLLOW(A)<\/strong> = Set of terminals that can appear immediately <strong data-start=\"696\" data-end=\"705\">after<\/strong> A in some derivation.<\/li>\n<li data-start=\"730\" data-end=\"814\">If the start symbol is <strong data-start=\"756\" data-end=\"761\">S<\/strong>, then <strong data-start=\"768\" data-end=\"811\">$ (End-of-input marker) is in FOLLOW(S)<\/strong>.<\/li>\n<\/ol>\n<h3 data-start=\"816\" data-end=\"859\"><strong data-start=\"822\" data-end=\"859\">Step 3: Apply the LL(1) Condition<\/strong><\/h3>\n<p data-start=\"860\" data-end=\"960\">For the grammar to be <strong data-start=\"882\" data-end=\"957\">LL(1), it must satisfy the following condition for every non-terminal A<\/strong>:<\/p>\n<p data-start=\"962\" data-end=\"1120\"><strong data-start=\"962\" data-end=\"996\">For two productions A \u2192 \u03b1 | \u03b2:<\/strong><br data-start=\"996\" data-end=\"999\" \/><strong data-start=\"1002\" data-end=\"1029\">FIRST(\u03b1) \u2229 FIRST(\u03b2) = \u2205<\/strong> (No common terminal symbols)<br data-start=\"1058\" data-end=\"1061\" \/>\u00a0If <strong data-start=\"1067\" data-end=\"1083\">\u03b5 \u2208 FIRST(\u03b1)<\/strong>, then <strong data-start=\"1090\" data-end=\"1118\">FIRST(\u03b2) \u2229 FOLLOW(A) = \u2205<\/strong><\/p>\n<p data-start=\"1122\" data-end=\"1198\"><strong data-start=\"1125\" data-end=\"1196\">If the condition holds for all non-terminals, the grammar is LL(1).<\/strong><\/p>\n<h3 data-start=\"1205\" data-end=\"1249\"><strong data-start=\"1208\" data-end=\"1249\">\u00a0Short Trick to Check LL(1) Grammar<\/strong><\/h3>\n<p data-start=\"1250\" data-end=\"1553\"><strong data-start=\"1252\" data-end=\"1263\">Step 1:<\/strong> Compute <strong data-start=\"1272\" data-end=\"1290\">FIRST &amp; FOLLOW<\/strong> sets.<br data-start=\"1296\" data-end=\"1299\" \/><strong data-start=\"1301\" data-end=\"1312\">Step 2:<\/strong> Check if any <strong data-start=\"1326\" data-end=\"1348\">FIRST sets overlap<\/strong> for a single non-terminal.<br data-start=\"1375\" data-end=\"1378\" \/><strong data-start=\"1380\" data-end=\"1391\">Step 3:<\/strong> If a production has <strong data-start=\"1412\" data-end=\"1417\">\u03b5<\/strong>, ensure <strong data-start=\"1426\" data-end=\"1465\">FOLLOW(A) and FIRST(A) are disjoint<\/strong>.<br data-start=\"1466\" data-end=\"1469\" \/><strong data-start=\"1471\" data-end=\"1482\">Step 4:<\/strong> If all conditions hold, <strong data-start=\"1507\" data-end=\"1551\">it is LL(1); otherwise, it is NOT LL(1).<\/strong><\/p>\n<h3 data-start=\"1560\" data-end=\"1592\"><strong data-start=\"1563\" data-end=\"1592\">\u00a0Example to Check LL(1)<\/strong><\/h3>\n<p data-start=\"1593\" data-end=\"1615\"><strong data-start=\"1593\" data-end=\"1613\">Example Grammar:<\/strong><\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre\"><span class=\"hljs-selector-tag\">S<\/span> \u2192 <span class=\"hljs-selector-tag\">aA<\/span> | <span class=\"hljs-selector-tag\">bB<\/span><br \/>\n<span class=\"hljs-selector-tag\">A<\/span> \u2192 <span class=\"hljs-selector-tag\">a<\/span> | \u03b5<br \/>\n<span class=\"hljs-selector-tag\">B<\/span> \u2192 <span class=\"hljs-selector-tag\">b<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h3 data-start=\"1659\" data-end=\"1693\"><strong data-start=\"1663\" data-end=\"1693\">Step 1: Compute FIRST Sets<\/strong><\/h3>\n<ul data-start=\"1694\" data-end=\"1768\">\n<li data-start=\"1694\" data-end=\"1719\"><strong data-start=\"1696\" data-end=\"1717\">FIRST(S) = {a, b}<\/strong><\/li>\n<li data-start=\"1720\" data-end=\"1745\"><strong data-start=\"1722\" data-end=\"1743\">FIRST(A) = {a, \u03b5}<\/strong><\/li>\n<li data-start=\"1746\" data-end=\"1768\"><strong data-start=\"1748\" data-end=\"1766\">FIRST(B) = {b}<\/strong><\/li>\n<\/ul>\n<h3 data-start=\"1770\" data-end=\"1805\"><strong data-start=\"1774\" data-end=\"1805\">Step 2: Compute FOLLOW Sets<\/strong><\/h3>\n<ul data-start=\"1806\" data-end=\"1883\">\n<li data-start=\"1806\" data-end=\"1831\"><strong data-start=\"1808\" data-end=\"1829\">FOLLOW(S) = { $ }<\/strong><\/li>\n<li data-start=\"1832\" data-end=\"1857\"><strong data-start=\"1834\" data-end=\"1855\">FOLLOW(A) = { $ }<\/strong><\/li>\n<li data-start=\"1858\" data-end=\"1883\"><strong data-start=\"1860\" data-end=\"1881\">FOLLOW(B) = { $ }<\/strong><\/li>\n<\/ul>\n<h3 data-start=\"1885\" data-end=\"1922\"><strong data-start=\"1889\" data-end=\"1922\">Step 3: Check LL(1) Condition<\/strong><\/h3>\n<ul data-start=\"1923\" data-end=\"2015\">\n<li data-start=\"1923\" data-end=\"1969\"><strong data-start=\"1925\" data-end=\"1965\">FIRST(A) and FIRST(B) do not overlap<\/strong><\/li>\n<li data-start=\"1970\" data-end=\"2015\"><strong data-start=\"1972\" data-end=\"2011\">A \u2192 \u03b5, but FIRST(A) \u2229 FOLLOW(A) = \u2205<\/strong><\/li>\n<\/ul>\n<p data-start=\"2017\" data-end=\"2086\">\u00a0Since all conditions are satisfied, <strong data-start=\"2056\" data-end=\"2082\">this grammar is LL(1).<\/strong><\/p>\n<h3 data-start=\"2093\" data-end=\"2131\"><strong data-start=\"2096\" data-end=\"2131\">\u00a0When is a Grammar NOT LL(1)?<\/strong><\/h3>\n<p data-start=\"2132\" data-end=\"2287\">\u00a0If <strong data-start=\"2138\" data-end=\"2165\">FIRST(\u03b1) \u2229 FIRST(\u03b2) \u2260 \u2205<\/strong>, the grammar is <strong data-start=\"2182\" data-end=\"2195\">not LL(1)<\/strong>.<br data-start=\"2196\" data-end=\"2199\" \/>\u00a0If <strong data-start=\"2205\" data-end=\"2254\">\u03b5 is in FIRST(A) but FIRST(A) \u2229 FOLLOW(A) \u2260 \u2205<\/strong>, the grammar is <strong data-start=\"2271\" data-end=\"2284\">not LL(1)<\/strong>.<\/p>\n<p data-start=\"2289\" data-end=\"2347\" data-is-last-node=\"\" data-is-only-node=\"\">Would you like a <strong data-start=\"2306\" data-end=\"2343\">practice problem or more examples<\/strong>?<\/p>\n<h3 data-start=\"2289\" data-end=\"2347\"><a href=\"https:\/\/cet.edu.in\/noticefiles\/277_CD%20Complete.pdf\" target=\"_blank\" rel=\"noopener\">Compiler Design\/ Short trick to find the given grammar is (LL1) or not in Compiler Design In English<\/a><\/h3>\n<div class=\"kb0PBd A9Y9g jGGQ5e\" data-snf=\"x5WNvb\" data-snhf=\"0\">\n<div class=\"yuRUbf\">\n<div class=\"b8lM7\">\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.necg.ac.in\/CSE\/pdf\/COMPILER%20DESIGN.pdf\" target=\"_blank\" rel=\"noopener\">COMPILER DESIGN (R15A0512)<\/a><\/h3>\n<p data-start=\"0\" data-end=\"185\">Here&#8217;s a clear and <strong data-start=\"19\" data-end=\"46\">shortcut method (trick)<\/strong> to check whether a given grammar is <strong data-start=\"83\" data-end=\"92\">LL(1)<\/strong> or <strong data-start=\"96\" data-end=\"103\">not<\/strong>, useful for <strong data-start=\"116\" data-end=\"135\">Compiler Design<\/strong> topics in GATE, university exams, and interviews.<\/p>\n<hr data-start=\"187\" data-end=\"190\" \/>\n<h2 data-start=\"192\" data-end=\"254\">\ud83d\udcd8 <strong data-start=\"198\" data-end=\"254\">LL(1) Grammar in Compiler Design \u2013 Shortcut to Check<\/strong><\/h2>\n<hr data-start=\"256\" data-end=\"259\" \/>\n<h3 data-start=\"261\" data-end=\"294\">\ud83e\udde0 <strong data-start=\"268\" data-end=\"294\">What is LL(1) Grammar?<\/strong><\/h3>\n<ul data-start=\"296\" data-end=\"412\">\n<li data-start=\"296\" data-end=\"334\">\n<p data-start=\"298\" data-end=\"334\"><strong data-start=\"298\" data-end=\"303\">L<\/strong> = Scan input <strong data-start=\"317\" data-end=\"334\">Left to right<\/strong><\/p>\n<\/li>\n<li data-start=\"335\" data-end=\"376\">\n<p data-start=\"337\" data-end=\"376\"><strong data-start=\"337\" data-end=\"342\">L<\/strong> = Produce <strong data-start=\"353\" data-end=\"376\">Leftmost derivation<\/strong><\/p>\n<\/li>\n<li data-start=\"377\" data-end=\"412\">\n<p data-start=\"379\" data-end=\"412\"><strong data-start=\"379\" data-end=\"384\">1<\/strong> = Use <strong data-start=\"391\" data-end=\"412\">1 token lookahead<\/strong><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"414\" data-end=\"545\">LL(1) grammars are <strong data-start=\"433\" data-end=\"454\">top-down parsable<\/strong> with a <strong data-start=\"462\" data-end=\"489\">single lookahead symbol<\/strong> using a <strong data-start=\"498\" data-end=\"519\">predictive parser<\/strong> (like recursive descent).<\/p>\n<hr data-start=\"547\" data-end=\"550\" \/>\n<h2 data-start=\"552\" data-end=\"592\">\u2705 <strong data-start=\"557\" data-end=\"592\">Shortcut to Check LL(1) Grammar<\/strong><\/h2>\n<h3 data-start=\"594\" data-end=\"654\">\u2714\ufe0f To check if a grammar is LL(1), ensure the following:<\/h3>\n<h3 data-start=\"656\" data-end=\"700\">\ud83e\udde9 <strong data-start=\"663\" data-end=\"700\">Condition 1: FIRST\/FIRST Conflict<\/strong><\/h3>\n<ul data-start=\"701\" data-end=\"820\">\n<li data-start=\"701\" data-end=\"817\">\n<p data-start=\"703\" data-end=\"817\">For every <strong data-start=\"713\" data-end=\"729\">non-terminal<\/strong> with multiple productions,<br data-start=\"756\" data-end=\"759\" \/>\u2192 FIRST sets of the alternatives <strong data-start=\"794\" data-end=\"816\">must not intersect<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"821\" data-end=\"910\"><strong data-start=\"821\" data-end=\"831\">Check:<\/strong><br data-start=\"831\" data-end=\"834\" \/>If <code data-start=\"837\" data-end=\"848\">A \u2192 \u03b1 | \u03b2<\/code><br data-start=\"848\" data-end=\"851\" \/>Then: <code data-start=\"857\" data-end=\"882\">FIRST(\u03b1) \u2229 FIRST(\u03b2) = \u2205<\/code><br data-start=\"882\" data-end=\"885\" \/>\u2192 <strong data-start=\"887\" data-end=\"910\">No common terminals<\/strong><\/p>\n<hr data-start=\"912\" data-end=\"915\" \/>\n<h3 data-start=\"917\" data-end=\"985\">\ud83e\udde9 <strong data-start=\"924\" data-end=\"983\">Condition 2: FIRST\/FOLLOW Conflict (when \u03b5 is involved)<\/strong><\/h3>\n<ul data-start=\"986\" data-end=\"1079\">\n<li data-start=\"986\" data-end=\"1079\">\n<p data-start=\"988\" data-end=\"1079\">If <strong data-start=\"991\" data-end=\"1019\">any production derives \u03b5<\/strong>,<br data-start=\"1020\" data-end=\"1023\" \/>Then: <code data-start=\"1031\" data-end=\"1079\">FIRST(\u03b5-production) \u2229 FOLLOW(non-terminal) = \u2205<\/code><\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1081\" data-end=\"1188\"><strong data-start=\"1081\" data-end=\"1091\">Check:<\/strong><br data-start=\"1091\" data-end=\"1094\" \/>If <code data-start=\"1097\" data-end=\"1108\">A \u2192 \u03b1 | \u03b5<\/code>,<br data-start=\"1109\" data-end=\"1112\" \/>Then: <code data-start=\"1118\" data-end=\"1144\">FIRST(\u03b1) \u2229 FOLLOW(A) = \u2205<\/code><br data-start=\"1144\" data-end=\"1147\" \/>\u2192 <strong data-start=\"1149\" data-end=\"1188\">No overlap between FIRST and FOLLOW<\/strong><\/p>\n<hr data-start=\"1190\" data-end=\"1193\" \/>\n<h2 data-start=\"1195\" data-end=\"1246\">\ud83d\udd0d <strong data-start=\"1201\" data-end=\"1246\">Step-by-Step Shortcut Method (With Trick)<\/strong><\/h2>\n<h3 data-start=\"1248\" data-end=\"1303\">\ud83c\udfaf Step 1: Compute FIRST set for all alternatives<\/h3>\n<p data-start=\"1304\" data-end=\"1342\">Look at all RHSs of each non-terminal.<\/p>\n<h3 data-start=\"1344\" data-end=\"1395\">\ud83c\udfaf Step 2: Check for <strong data-start=\"1369\" data-end=\"1393\">FIRST\/FIRST Conflict<\/strong><\/h3>\n<ul data-start=\"1396\" data-end=\"1459\">\n<li data-start=\"1396\" data-end=\"1459\">\n<p data-start=\"1398\" data-end=\"1459\">If same terminal appears in multiple FIRST sets \u2192 \u274c Not LL(1)<\/p>\n<\/li>\n<\/ul>\n<h3 data-start=\"1461\" data-end=\"1500\">\ud83c\udfaf Step 3: Check for <strong data-start=\"1486\" data-end=\"1500\">\u03b5 in FIRST<\/strong><\/h3>\n<ul data-start=\"1501\" data-end=\"1603\">\n<li data-start=\"1501\" data-end=\"1603\">\n<p data-start=\"1503\" data-end=\"1519\">If yes, then do:<\/p>\n<ul data-start=\"1522\" data-end=\"1603\">\n<li data-start=\"1522\" data-end=\"1563\">\n<p data-start=\"1524\" data-end=\"1563\">Compute <strong data-start=\"1532\" data-end=\"1542\">FOLLOW<\/strong> of that non-terminal<\/p>\n<\/li>\n<li data-start=\"1566\" data-end=\"1603\">\n<p data-start=\"1568\" data-end=\"1603\">Check for <strong data-start=\"1578\" data-end=\"1603\">FIRST\/FOLLOW Conflict<\/strong><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3 data-start=\"1605\" data-end=\"1657\">\ud83c\udfaf Step 4: If <strong data-start=\"1623\" data-end=\"1639\">no conflicts<\/strong>, grammar is LL(1)<\/h3>\n<hr data-start=\"1659\" data-end=\"1662\" \/>\n<h2 data-start=\"1664\" data-end=\"1697\">\u2728 <strong data-start=\"1669\" data-end=\"1697\">Example 1: LL(1) Grammar<\/strong><\/h2>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">less<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"hljs-selector-tag\">S<\/span> \u2192 <span class=\"hljs-selector-tag\">aA<\/span> | <span class=\"hljs-selector-tag\">bB<\/span><br \/>\n<span class=\"hljs-selector-tag\">A<\/span> \u2192 <span class=\"hljs-selector-tag\">c<\/span><br \/>\n<span class=\"hljs-selector-tag\">B<\/span> \u2192 <span class=\"hljs-selector-tag\">d<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"1736\" data-end=\"1820\"><strong data-start=\"1736\" data-end=\"1748\">FIRST(S)<\/strong> = {a, b} \u2192 disjoint \u2192 \u2705<br data-start=\"1772\" data-end=\"1775\" \/>No \u03b5 \u2192 no need to check FOLLOW<br data-start=\"1805\" data-end=\"1808\" \/>\ud83d\udfe9 <strong data-start=\"1811\" data-end=\"1820\">LL(1)<\/strong><\/p>\n<hr data-start=\"1822\" data-end=\"1825\" \/>\n<h2 data-start=\"1827\" data-end=\"1864\">\u274c <strong data-start=\"1832\" data-end=\"1864\">Example 2: Not LL(1) Grammar<\/strong><\/h2>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">less<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"hljs-selector-tag\">S<\/span> \u2192 <span class=\"hljs-selector-tag\">aA<\/span> | <span class=\"hljs-selector-tag\">aB<\/span><br \/>\n<span class=\"hljs-selector-tag\">A<\/span> \u2192 <span class=\"hljs-selector-tag\">c<\/span><br \/>\n<span class=\"hljs-selector-tag\">B<\/span> \u2192 <span class=\"hljs-selector-tag\">d<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"1903\" data-end=\"2005\"><strong data-start=\"1903\" data-end=\"1920\">FIRST(aA) = a<\/strong>, <strong data-start=\"1922\" data-end=\"1939\">FIRST(aB) = a<\/strong> \u2192 \u274c<br data-start=\"1943\" data-end=\"1946\" \/>FIRST sets <strong data-start=\"1957\" data-end=\"1970\">intersect<\/strong> \u2192 <strong data-start=\"1973\" data-end=\"1986\">Not LL(1)<\/strong><br data-start=\"1986\" data-end=\"1989\" \/>\ud83d\udfe5 <strong data-start=\"1992\" data-end=\"2005\">Not LL(1)<\/strong><\/p>\n<hr data-start=\"2007\" data-end=\"2010\" \/>\n<h2 data-start=\"2012\" data-end=\"2037\">\ud83d\udcd3 <strong data-start=\"2018\" data-end=\"2037\">Important Note:<\/strong><\/h2>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"2039\" data-end=\"2514\">\n<thead data-start=\"2039\" data-end=\"2132\">\n<tr data-start=\"2039\" data-end=\"2132\">\n<th data-start=\"2039\" data-end=\"2086\" data-col-size=\"md\">\u2705 LL(1) If&#8230;<\/th>\n<th data-start=\"2086\" data-end=\"2132\" data-col-size=\"sm\">\u274c Not LL(1) If&#8230;<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2228\" data-end=\"2514\">\n<tr data-start=\"2228\" data-end=\"2322\">\n<td data-start=\"2228\" data-end=\"2275\" data-col-size=\"md\">FIRST sets of RHSs are disjoint<\/td>\n<td data-start=\"2275\" data-end=\"2322\" data-col-size=\"sm\">FIRST sets overlap<\/td>\n<\/tr>\n<tr data-start=\"2323\" data-end=\"2417\">\n<td data-start=\"2323\" data-end=\"2370\" data-col-size=\"md\">\u03b5 in FIRST \u2192 check FOLLOW conflict too<\/td>\n<td data-col-size=\"sm\" data-start=\"2370\" data-end=\"2417\">FIRST(\u03b5) \u2229 FOLLOW(non-terminal) \u2260 \u2205<\/td>\n<\/tr>\n<tr data-start=\"2418\" data-end=\"2514\">\n<td data-start=\"2418\" data-end=\"2473\" data-col-size=\"md\">One parsing table entry per [Non-Terminal, Terminal]<\/td>\n<td data-col-size=\"sm\" data-start=\"2473\" data-end=\"2514\">Multiple entries in parsing table<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"2516\" data-end=\"2519\" \/>\n<h2 data-start=\"2521\" data-end=\"2560\">\ud83e\udde0 <strong data-start=\"2527\" data-end=\"2560\">Tips to Remember (Exam Trick)<\/strong><\/h2>\n<ul data-start=\"2562\" data-end=\"2757\">\n<li data-start=\"2562\" data-end=\"2634\">\n<p data-start=\"2564\" data-end=\"2634\"><strong data-start=\"2564\" data-end=\"2608\">Same starting symbol in two productions?<\/strong> \u2192 Usually <strong data-start=\"2619\" data-end=\"2632\">NOT LL(1)<\/strong><\/p>\n<\/li>\n<li data-start=\"2635\" data-end=\"2675\">\n<p data-start=\"2637\" data-end=\"2675\"><strong data-start=\"2637\" data-end=\"2658\">Epsilon involved?<\/strong> \u2192 Check FOLLOW<\/p>\n<\/li>\n<li data-start=\"2676\" data-end=\"2712\">\n<p data-start=\"2678\" data-end=\"2712\"><strong data-start=\"2678\" data-end=\"2706\">Intersecting FIRST sets?<\/strong> \u2192 \u274c<\/p>\n<\/li>\n<li data-start=\"2713\" data-end=\"2757\">\n<p data-start=\"2715\" data-end=\"2757\"><strong data-start=\"2715\" data-end=\"2743\">Parsing Table Conflicts?<\/strong> \u2192 \u274c Not LL(1)<\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"2759\" data-end=\"2762\" \/>\n<p data-start=\"2764\" data-end=\"2779\">Would you like:<\/p>\n<ul data-start=\"2780\" data-end=\"2891\">\n<li data-start=\"2780\" data-end=\"2813\">\n<p data-start=\"2782\" data-end=\"2813\">A solved parsing table example?<\/p>\n<\/li>\n<li data-start=\"2814\" data-end=\"2851\">\n<p data-start=\"2816\" data-end=\"2851\">A PDF cheat sheet for FIRST\/FOLLOW?<\/p>\n<\/li>\n<li data-start=\"2852\" data-end=\"2891\">\n<p data-start=\"2854\" data-end=\"2891\">Practice grammar questions for LL(1)?<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"2893\" data-end=\"2905\" data-is-last-node=\"\" data-is-only-node=\"\">Let me know!<\/p>\n<h3 data-start=\"2893\" data-end=\"2905\"><a href=\"https:\/\/www.vssut.ac.in\/lecture_notes\/lecture1422914957.pdf\" target=\"_blank\" rel=\"noopener\">Compiler Design\/ Short trick to find the given grammar is (LL1) or not in Compiler Design In English<\/a><\/h3>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Compiler Design\/ Short trick to find the given grammar is (LL1) or not in Compiler Design In English [fvplayer id=&#8221;123&#8243;] \u00a0How to Quickly Check if a Grammar is LL(1) \u2013 Compiler Design Short Trick LL(1) Grammar is a type of context-free grammar (CFG) used in top-down parsing. To determine whether a given grammar is LL(1), [&hellip;]<\/p>\n","protected":false},"author":71,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[],"class_list":["post-2808","post","type-post","status-publish","format-standard","hentry","category-compiler-design"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/comments?post=2808"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2808\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=2808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=2808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=2808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}