{"id":2820,"date":"2025-06-07T14:51:00","date_gmt":"2025-06-07T14:51:00","guid":{"rendered":"https:\/\/diznr.com\/?p=2820"},"modified":"2025-06-07T14:51:00","modified_gmt":"2025-06-07T14:51:00","slug":"lexical-analysis-in-simple-words-token-generation-blank-space-symbol-table-error-lexical","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/lexical-analysis-in-simple-words-token-generation-blank-space-symbol-table-error-lexical\/","title":{"rendered":"Lexical Analysis in simple words &#8211; token generation, blank space, symbol table, lexical error"},"content":{"rendered":"<p>Lexical Analysis in simple words &#8211; token generation, blank space, symbol table, lexical error<\/p>\n<p>[fvplayer id=&#8221;129&#8243;]<\/p>\n<h3 class=\"\" data-start=\"0\" data-end=\"42\"><strong data-start=\"4\" data-end=\"40\">Lexical Analysis in Simple Words<\/strong><\/h3>\n<p class=\"\" data-start=\"44\" data-end=\"260\">Lexical Analysis is the <strong data-start=\"68\" data-end=\"97\">first phase of a compiler<\/strong> that breaks down the source code into smaller <strong data-start=\"144\" data-end=\"164\">meaningful units<\/strong> called <strong data-start=\"172\" data-end=\"182\">tokens<\/strong>. This process is done by a program called the <strong data-start=\"229\" data-end=\"258\">Lexical Analyzer (Lexer).<\/strong><\/p>\n<h3 data-start=\"267\" data-end=\"306\"><strong data-start=\"270\" data-end=\"304\">\u00a0How Lexical Analysis Works?<\/strong><\/h3>\n<p class=\"\" data-start=\"307\" data-end=\"647\">\u00a0The source code is read <strong data-start=\"334\" data-end=\"360\">character by character<\/strong>.<br data-start=\"361\" data-end=\"364\" \/>\u00a0Meaningful groups of characters are converted into <strong data-start=\"418\" data-end=\"428\">tokens<\/strong>.<br data-start=\"429\" data-end=\"432\" \/>\u00a0Unnecessary characters like <strong data-start=\"463\" data-end=\"493\">spaces, tabs, and comments<\/strong> are removed.<br data-start=\"506\" data-end=\"509\" \/>\u00a0A <strong data-start=\"514\" data-end=\"530\">symbol table<\/strong> is created to store identifiers and keywords.<br data-start=\"576\" data-end=\"579\" \/>\u00a0If an unknown symbol is found, a <strong data-start=\"615\" data-end=\"632\">lexical error<\/strong> is reported.<\/p>\n<h3 data-start=\"654\" data-end=\"693\"><strong data-start=\"657\" data-end=\"691\">\u00a0Example of Token Generation<\/strong><\/h3>\n<p class=\"\" data-start=\"694\" data-end=\"714\"><strong data-start=\"697\" data-end=\"712\">Input Code:<\/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 language-c\"><span class=\"hljs-type\">int<\/span> x = <span class=\"hljs-number\">10<\/span>;<br \/>\n<\/code><\/div>\n<\/div>\n<p class=\"\" data-start=\"738\" data-end=\"780\"><strong data-start=\"741\" data-end=\"778\">Lexical Analyzer Output (Tokens):<\/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-section\">Keyword: int  <\/span><br \/>\n<span class=\"hljs-section\">Identifier: x  <\/span><br \/>\n<span class=\"hljs-section\">Operator: =  <\/span><br \/>\n<span class=\"hljs-section\">Number: 10  <\/span><br \/>\n<span class=\"hljs-section\">Symbol: ;<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p class=\"\" data-start=\"857\" data-end=\"926\">Each part of the code is classified into a <strong data-start=\"900\" data-end=\"923\">specific token type<\/strong>.<\/p>\n<h3 data-start=\"933\" data-end=\"977\"><strong data-start=\"936\" data-end=\"975\">\u00a0Handling Blank Spaces &amp; Comments<\/strong><\/h3>\n<p class=\"\" data-start=\"978\" data-end=\"1152\"><strong data-start=\"980\" data-end=\"1020\">Whitespace (spaces, tabs, new lines)<\/strong> is <strong data-start=\"1024\" data-end=\"1035\">ignored<\/strong> by the lexical analyzer.<br data-start=\"1060\" data-end=\"1063\" \/><strong data-start=\"1065\" data-end=\"1097\">Comments (<code data-start=\"1077\" data-end=\"1081\">\/\/<\/code>, <code data-start=\"1083\" data-end=\"1094\">\/* ... *\/<\/code>)<\/strong> are removed, as they don\u2019t affect program execution.<\/p>\n<p class=\"\" data-start=\"1154\" data-end=\"1171\"><strong data-start=\"1157\" data-end=\"1169\">Example:<\/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 language-c\"><span class=\"hljs-type\">int<\/span> a = <span class=\"hljs-number\">5<\/span>;    <span class=\"hljs-comment\">\/\/ This is a comment<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p class=\"\" data-start=\"1216\" data-end=\"1287\">\u00a0The lexer <strong data-start=\"1229\" data-end=\"1240\">ignores<\/strong> <code data-start=\"1241\" data-end=\"1265\">\"\/\/ This is a comment\"<\/code> and processes only:<\/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=\"sticky top-9\">\n<div class=\"absolute bottom-0 right-0 flex h-9 items-center pr-2\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre\"><span class=\"hljs-section\">Keyword: int  <\/span><br \/>\n<span class=\"hljs-section\">Identifier: a  <\/span><br \/>\n<span class=\"hljs-section\">Operator: =  <\/span><br \/>\n<span class=\"hljs-section\">Number: 5  <\/span><br \/>\n<span class=\"hljs-section\">Symbol: ;<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h3 data-start=\"1369\" data-end=\"1393\"><strong data-start=\"1372\" data-end=\"1391\">\u00a0Symbol Table<\/strong><\/h3>\n<p class=\"\" data-start=\"1394\" data-end=\"1597\">\u00a0A <strong data-start=\"1398\" data-end=\"1414\">symbol table<\/strong> stores identifiers (variable names, function names) and their attributes like <strong data-start=\"1493\" data-end=\"1536\">data type, memory location, scope, etc.<\/strong><br data-start=\"1536\" data-end=\"1539\" \/>\u00a0It helps the compiler <strong data-start=\"1563\" data-end=\"1582\">track variables<\/strong> efficiently.<\/p>\n<p class=\"\" data-start=\"1599\" data-end=\"1629\"><strong data-start=\"1602\" data-end=\"1627\">Example Symbol Table:<\/strong><\/p>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"1630\" data-end=\"1794\">\n<thead data-start=\"1630\" data-end=\"1671\">\n<tr data-start=\"1630\" data-end=\"1671\">\n<th data-start=\"1630\" data-end=\"1643\">Identifier<\/th>\n<th data-start=\"1643\" data-end=\"1650\">Type<\/th>\n<th data-start=\"1650\" data-end=\"1671\">Memory Location<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1713\" data-end=\"1794\">\n<tr data-start=\"1713\" data-end=\"1753\">\n<td>x<\/td>\n<td>int<\/td>\n<td>1001<\/td>\n<\/tr>\n<tr data-start=\"1754\" data-end=\"1794\">\n<td>y<\/td>\n<td>float<\/td>\n<td>1002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3 data-start=\"1801\" data-end=\"1827\"><strong data-start=\"1804\" data-end=\"1825\">\u00a0Lexical Errors<\/strong><\/h3>\n<p class=\"\" data-start=\"1828\" data-end=\"1900\">Errors occur when the lexer finds <strong data-start=\"1862\" data-end=\"1897\">an unknown or invalid character<\/strong>.<\/p>\n<p class=\"\" data-start=\"1902\" data-end=\"1919\"><strong data-start=\"1905\" data-end=\"1917\">Example:<\/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 language-c\"><span class=\"hljs-type\">int<\/span> @x = <span class=\"hljs-number\">10<\/span>;<br \/>\n<\/code><\/div>\n<\/div>\n<p class=\"\" data-start=\"1944\" data-end=\"2005\"><strong data-start=\"1947\" data-end=\"1965\">Lexical Error:<\/strong> <strong data-start=\"1966\" data-end=\"2003\">&#8220;Unexpected character &#8216;@&#8217; found.&#8221;<\/strong><\/p>\n<h3 data-start=\"2012\" data-end=\"2031\"><strong data-start=\"2015\" data-end=\"2029\">\u00a0Summary<\/strong><\/h3>\n<p class=\"\" data-start=\"2032\" data-end=\"2242\"><strong data-start=\"2034\" data-end=\"2054\">Lexical Analysis<\/strong> breaks code into <strong data-start=\"2072\" data-end=\"2082\">tokens<\/strong>.<br data-start=\"2083\" data-end=\"2086\" \/><strong data-start=\"2088\" data-end=\"2115\">Blank spaces &amp; comments<\/strong> are ignored.<br data-start=\"2128\" data-end=\"2131\" \/>\u00a0A <strong data-start=\"2135\" data-end=\"2151\">symbol table<\/strong> stores variable names and types.<br data-start=\"2184\" data-end=\"2187\" \/><strong data-start=\"2189\" data-end=\"2207\">Lexical errors<\/strong> occur due to unknown characters.<\/p>\n<p class=\"\" data-start=\"2244\" data-end=\"2326\">Would you like a <strong data-start=\"2261\" data-end=\"2287\">step-by-step breakdown<\/strong> of a real Lexical Analysis process?<\/p>\n<h3 data-start=\"2244\" data-end=\"2326\"><a href=\"https:\/\/www.jntua.ac.in\/gate-online-classes\/registration\/downloads\/material\/a159219982746.pdf\" target=\"_blank\" rel=\"noopener\">Lexical Analysis in simple words &#8211; token generation, blank space, symbol table, lexical error<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.sathyabama.ac.in\/sites\/default\/files\/course-material\/2020-11\/unit1.pdf\" target=\"_blank\" rel=\"noopener\">LEXICAL ANALYSIS Structure of compiler \u2013 Functions and &#8230;<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/home.adelphi.edu\/~siegfried\/cs372\/372l2.pdf\" target=\"_blank\" rel=\"noopener\">Lexical Analysis &#8211; Compiler Construction<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.vssut.ac.in\/lecture_notes\/lecture1422914957.pdf\" target=\"_blank\" rel=\"noopener\">compiler design lecture notes<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/pg.its.edu.in\/sites\/default\/files\/Unit-2.Compiler%20Design_%20Lexical%20Analysis.pdf\" target=\"_blank\" rel=\"noopener\">Chapter 3 Lexical Analysis<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.cse.iitk.ac.in\/users\/swarnendu\/courses\/spring2024-cs335\/lexical-analysis.pdf\" target=\"_blank\" rel=\"noopener\">CS 335: Lexical Analysis<\/a><\/h3>\n<p data-start=\"0\" data-end=\"152\">Here is a <strong data-start=\"10\" data-end=\"52\">simple explanation of Lexical Analysis<\/strong> and its key components, written in easy language (suitable for beginners or non-technical readers):<\/p>\n<hr data-start=\"154\" data-end=\"157\" \/>\n<h2 data-start=\"159\" data-end=\"201\">\ud83d\udcd8 <strong data-start=\"165\" data-end=\"201\">Lexical Analysis in Simple Words<\/strong><\/h2>\n<p data-start=\"203\" data-end=\"354\"><strong data-start=\"203\" data-end=\"223\">Lexical Analysis<\/strong> is the <strong data-start=\"231\" data-end=\"259\">first step of a compiler<\/strong>.<br data-start=\"260\" data-end=\"263\" \/>It reads the code written by a programmer and breaks it into small parts called <strong data-start=\"343\" data-end=\"353\">tokens<\/strong>.<\/p>\n<hr data-start=\"356\" data-end=\"359\" \/>\n<h3 data-start=\"361\" data-end=\"391\">\ud83d\udd39 <strong data-start=\"368\" data-end=\"391\">1. What is a Token?<\/strong><\/h3>\n<p data-start=\"393\" data-end=\"499\">A <strong data-start=\"395\" data-end=\"404\">token<\/strong> is a small, meaningful unit in a programming language.<br data-start=\"459\" data-end=\"462\" \/>Think of it like words in a sentence.<\/p>\n<h4 data-start=\"501\" data-end=\"517\">\ud83e\udde0 Example:<\/h4>\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]\">c<\/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! language-c\"><span class=\"hljs-type\">int<\/span> x = <span class=\"hljs-number\">5<\/span>;<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"540\" data-end=\"582\">This line will be broken into tokens like:<\/p>\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=\"584\" data-end=\"786\">\n<thead data-start=\"584\" data-end=\"612\">\n<tr data-start=\"584\" data-end=\"612\">\n<th data-start=\"584\" data-end=\"597\" data-col-size=\"sm\">Token Type<\/th>\n<th data-start=\"597\" data-end=\"612\" data-col-size=\"sm\">Token Value<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"642\" data-end=\"786\">\n<tr data-start=\"642\" data-end=\"670\">\n<td data-start=\"642\" data-end=\"655\" data-col-size=\"sm\">Keyword<\/td>\n<td data-col-size=\"sm\" data-start=\"655\" data-end=\"670\">int<\/td>\n<\/tr>\n<tr data-start=\"671\" data-end=\"699\">\n<td data-start=\"671\" data-end=\"684\" data-col-size=\"sm\">Identifier<\/td>\n<td data-col-size=\"sm\" data-start=\"684\" data-end=\"699\">x<\/td>\n<\/tr>\n<tr data-start=\"700\" data-end=\"728\">\n<td data-start=\"700\" data-end=\"713\" data-col-size=\"sm\">Operator<\/td>\n<td data-col-size=\"sm\" data-start=\"713\" data-end=\"728\">=<\/td>\n<\/tr>\n<tr data-start=\"729\" data-end=\"757\">\n<td data-start=\"729\" data-end=\"742\" data-col-size=\"sm\">Constant<\/td>\n<td data-col-size=\"sm\" data-start=\"742\" data-end=\"757\">5<\/td>\n<\/tr>\n<tr data-start=\"758\" data-end=\"786\">\n<td data-start=\"758\" data-end=\"771\" data-col-size=\"sm\">Symbol<\/td>\n<td data-col-size=\"sm\" data-start=\"771\" data-end=\"786\">;<\/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<p data-start=\"788\" data-end=\"855\">\u27a1\ufe0f These tokens help the compiler understand the code step-by-step.<\/p>\n<hr data-start=\"857\" data-end=\"860\" \/>\n<h3 data-start=\"862\" data-end=\"896\">\ud83d\udd39 <strong data-start=\"869\" data-end=\"896\">2. Role of Blank Spaces<\/strong><\/h3>\n<ul data-start=\"898\" data-end=\"1200\">\n<li data-start=\"898\" data-end=\"964\">\n<p data-start=\"900\" data-end=\"964\"><strong data-start=\"900\" data-end=\"937\">Blank spaces, tabs, and new lines<\/strong> are called <strong data-start=\"949\" data-end=\"963\">whitespace<\/strong>.<\/p>\n<\/li>\n<li data-start=\"965\" data-end=\"1105\">\n<p data-start=\"967\" data-end=\"1105\">The <strong data-start=\"971\" data-end=\"999\">lexer (lexical analyzer)<\/strong> usually <strong data-start=\"1008\" data-end=\"1032\">ignores blank spaces<\/strong> unless they are part of a string or affect indentation (like in Python).<\/p>\n<\/li>\n<li data-start=\"1106\" data-end=\"1200\">\n<p data-start=\"1108\" data-end=\"1200\">Their job is to <strong data-start=\"1124\" data-end=\"1143\">separate tokens<\/strong> so the compiler knows where one ends and another begins.<\/p>\n<\/li>\n<\/ul>\n<h4 data-start=\"1202\" data-end=\"1218\">\ud83e\udde0 Example:<\/h4>\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]\">c<\/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! language-c\"><span class=\"hljs-type\">int<\/span>   a=<span class=\"hljs-number\">10<\/span>;<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"1241\" data-end=\"1317\">Even with extra spaces, the tokens will still be:<br \/>\n<code data-start=\"1291\" data-end=\"1296\">int<\/code>, <code data-start=\"1298\" data-end=\"1301\">a<\/code>, <code data-start=\"1303\" data-end=\"1306\">=<\/code>, <code data-start=\"1308\" data-end=\"1312\">10<\/code>, <code data-start=\"1314\" data-end=\"1317\">;<\/code><\/p>\n<hr data-start=\"1319\" data-end=\"1322\" \/>\n<h3 data-start=\"1324\" data-end=\"1350\">\ud83d\udd39 <strong data-start=\"1331\" data-end=\"1350\">3. Symbol Table<\/strong><\/h3>\n<p data-start=\"1352\" data-end=\"1424\">A <strong data-start=\"1354\" data-end=\"1370\">symbol table<\/strong> is like a <strong data-start=\"1381\" data-end=\"1393\">notebook<\/strong> the compiler uses to remember:<\/p>\n<ul data-start=\"1426\" data-end=\"1518\">\n<li data-start=\"1426\" data-end=\"1462\">\n<p data-start=\"1428\" data-end=\"1462\">Variables (like <code data-start=\"1444\" data-end=\"1447\">x<\/code>, <code data-start=\"1449\" data-end=\"1452\">a<\/code>, <code data-start=\"1454\" data-end=\"1461\">total<\/code>)<\/p>\n<\/li>\n<li data-start=\"1463\" data-end=\"1479\">\n<p data-start=\"1465\" data-end=\"1479\">Function names<\/p>\n<\/li>\n<li data-start=\"1480\" data-end=\"1492\">\n<p data-start=\"1482\" data-end=\"1492\">Data types<\/p>\n<\/li>\n<li data-start=\"1493\" data-end=\"1518\">\n<p data-start=\"1495\" data-end=\"1518\">Scope and other details<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1520\" data-end=\"1618\">Every time a new identifier is found (like a variable name), it is stored in the <strong data-start=\"1601\" data-end=\"1617\">symbol table<\/strong>.<\/p>\n<hr data-start=\"1620\" data-end=\"1623\" \/>\n<h3 data-start=\"1625\" data-end=\"1653\">\ud83d\udd39 <strong data-start=\"1632\" data-end=\"1653\">4. Lexical Errors<\/strong><\/h3>\n<p data-start=\"1655\" data-end=\"1721\">These are mistakes in the <strong data-start=\"1681\" data-end=\"1706\">structure of the code<\/strong>, usually when:<\/p>\n<ul data-start=\"1723\" data-end=\"1883\">\n<li data-start=\"1723\" data-end=\"1747\">\n<p data-start=\"1725\" data-end=\"1747\">The token is not valid<\/p>\n<\/li>\n<li data-start=\"1748\" data-end=\"1781\">\n<p data-start=\"1750\" data-end=\"1781\">Unexpected characters are found<\/p>\n<\/li>\n<li data-start=\"1782\" data-end=\"1829\">\n<p data-start=\"1784\" data-end=\"1829\">A variable starts with a number (like <code data-start=\"1822\" data-end=\"1828\">2abc<\/code>)<\/p>\n<\/li>\n<li data-start=\"1830\" data-end=\"1883\">\n<p data-start=\"1832\" data-end=\"1883\">Illegal symbols are used (<code data-start=\"1858\" data-end=\"1861\">@<\/code>, <code data-start=\"1863\" data-end=\"1866\">#<\/code> in wrong places)<\/p>\n<\/li>\n<\/ul>\n<h4 data-start=\"1885\" data-end=\"1901\">\ud83e\udde0 Example:<\/h4>\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]\">c<\/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! language-c\"><span class=\"hljs-type\">int<\/span> <span class=\"hljs-number\">2<\/span>num = <span class=\"hljs-number\">5<\/span>;  <span class=\"hljs-comment\">\/\/ \u274c Error: variable cannot start with number<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"1974\" data-end=\"2002\">This is a <strong data-start=\"1984\" data-end=\"2001\">lexical error<\/strong>.<\/p>\n<hr data-start=\"2004\" data-end=\"2007\" \/>\n<h3 data-start=\"2009\" data-end=\"2033\">\u2705 <strong data-start=\"2015\" data-end=\"2033\">Summary Table:<\/strong><\/h3>\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=\"2035\" data-end=\"2507\">\n<thead data-start=\"2035\" data-end=\"2112\">\n<tr data-start=\"2035\" data-end=\"2112\">\n<th data-start=\"2035\" data-end=\"2052\" data-col-size=\"sm\">Term<\/th>\n<th data-start=\"2052\" data-end=\"2112\" data-col-size=\"md\">Meaning in Simple Words<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2192\" data-end=\"2507\">\n<tr data-start=\"2192\" data-end=\"2270\">\n<td data-start=\"2192\" data-end=\"2209\" data-col-size=\"sm\">Token<\/td>\n<td data-col-size=\"md\" data-start=\"2209\" data-end=\"2270\">Smallest meaningful unit (like a word)<\/td>\n<\/tr>\n<tr data-start=\"2271\" data-end=\"2349\">\n<td data-start=\"2271\" data-end=\"2288\" data-col-size=\"sm\">Blank Space<\/td>\n<td data-col-size=\"md\" data-start=\"2288\" data-end=\"2349\">Used to separate tokens; ignored by lexer<\/td>\n<\/tr>\n<tr data-start=\"2350\" data-end=\"2428\">\n<td data-start=\"2350\" data-end=\"2367\" data-col-size=\"sm\">Symbol Table<\/td>\n<td data-col-size=\"md\" data-start=\"2367\" data-end=\"2428\">A record of variable\/function names and info<\/td>\n<\/tr>\n<tr data-start=\"2429\" data-end=\"2507\">\n<td data-start=\"2429\" data-end=\"2446\" data-col-size=\"sm\">Lexical Error<\/td>\n<td data-start=\"2446\" data-end=\"2507\" data-col-size=\"md\">Error in token creation (like wrong names or characters)<\/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=\"2509\" data-end=\"2512\" \/>\n<p data-start=\"2514\" data-end=\"2614\" data-is-last-node=\"\" data-is-only-node=\"\">Would you like a <strong data-start=\"2531\" data-end=\"2547\">visual chart<\/strong>, <strong data-start=\"2549\" data-end=\"2577\">example code walkthrough<\/strong>, or a <strong data-start=\"2584\" data-end=\"2599\">PDF summary<\/strong> of this topic?<\/p>\n<h3 data-start=\"2514\" data-end=\"2614\"><a href=\"https:\/\/www.iitgoa.ac.in\/~sudakshina\/files\/lec3.pdf\" target=\"_blank\" rel=\"noopener\">Lexical Analysis in simple words &#8211; token generation, blank space, symbol table, lexical error<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.univ-orleans.fr\/lifo\/Members\/Mirian.Halfeld\/Cours\/TLComp\/l3-0708-LexA.pdf\" target=\"_blank\" rel=\"noopener\">Compilers Download<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Lexical Analysis in simple words &#8211; token generation, blank space, symbol table, lexical error [fvplayer id=&#8221;129&#8243;] Lexical Analysis in Simple Words Lexical Analysis is the first phase of a compiler that breaks down the source code into smaller meaningful units called tokens. This process is done by a program called the Lexical Analyzer (Lexer). \u00a0How [&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-2820","post","type-post","status-publish","format-standard","hentry","category-compiler-design"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2820","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=2820"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/2820\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=2820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=2820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=2820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}