<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Notes on telosama.xyz</title>
    <link>https://telosama.xyz/notes/</link>
    <description>Recent content in Notes on telosama.xyz</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>© {year}</copyright>
    <lastBuildDate>Mon, 13 Mar 2023 16:29:14 +0800</lastBuildDate><atom:link href="https://telosama.xyz/notes/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Quiz #1 Material Summary </title>
      <link>https://telosama.xyz/notes/quiz1/</link>
      <pubDate>Mon, 13 Mar 2023 16:29:14 +0800</pubDate>
      
      <guid>https://telosama.xyz/notes/quiz1/</guid>
      <description>Main phases/functions of compiler Lexical Analyzer ==&amp;gt; reads the stream of characters and groups them into meaningful sequences Syntax Analyzer ==&amp;gt; using the components produced by the previous phase, creates a tree like intermediate representation that depicts the grammatical structure of the token stream. Semantic Analyzer ==&amp;gt; using the tree, check the semantic consistency of the source program with the language definition. Also gathers type information Intermediate Code Generator ==&amp;gt; constructs intermediate representation of the target code Machine Independent Code Optimzer ==&amp;gt; Optimizes intermediate representation Code Generator ==&amp;gt; generate target machine code from intermediate representation Machine-dependent Code Optimizer ==&amp;gt; optimizes machine code Compiler Phases Compiler Phases with outputs of each phases: Context Free Grammar (CFG) terminals / tokens ==&amp;gt; elementary symbols of the language nonterminals ==&amp;gt; represent string of terminals productions ==&amp;gt; consists of nonterminal (called left side), an arrow, and sequence of terminals and/or nonterminals (called body) a nonterminal designated as the start symbol Finding FIRST() sets Definitions $\alpha$ ==&amp;gt; string of grammar symbolsl (terminals and/or non-terminals) FIRST($\alpha$) ==&amp;gt; set of terminals that appear as the first symols of one or more strings of terminals generated from $\alpha$ How to compute/find FIRST() sets if $X$ is a terminal, then FIRST($X$) = ${X}$ if $X$ is a nonterminal and $X \to Y_1 Y_2 \cdots Y_k$ is a production, FIRST($X$) = FIRST($Y_1$) If FIRST($Y_i$) contains $\epsilon$ then FIRST($X$) = $\{ FIRST(Y_i) – \epsilon \} \cup \{FIRST(Y_{i+1})\}$, and so on If FIRST($Y_i$) contains $\epsilon$ for all $i$ = 1 to $n$, then add $\epsilon$ to FIRST($X$).</description>
    </item>
    
  </channel>
</rss>
