<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>编译原理 on Dai Chao</title>
    <link>https://daichao1997.github.io/tags/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/</link>
    <description>Recent content in 编译原理 on Dai Chao</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 08 Oct 2018 00:00:00 +0800</lastBuildDate>
    <atom:link href="https://daichao1997.github.io/tags/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Crowbar源码剖析：语法</title>
      <link>https://daichao1997.github.io/posts/tech/2018-10-08-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E8%AF%AD%E6%B3%95/</link>
      <pubDate>Mon, 08 Oct 2018 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2018-10-08-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E8%AF%AD%E6%B3%95/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://daichao1997.github.io/Crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%EF%BC%9A%E8%AF%8D%E6%B3%95.html&#34;&gt;上回书说到&lt;/a&gt;，Crowbar的词法分析器将具体的源码文件解析为一串抽象的&lt;strong&gt;符号&lt;/strong&gt;，并伴随着一系列附属动作。接下来轮到Crowbar的语法分析器登场了——它是如何解读这串符号的？解读的同时又做了些什么事情呢？我们一起来看看。&lt;/p&gt;
&lt;p&gt;本篇有非常多杂七杂八的代码，看的时候一定要把握住最大的共同点——&lt;strong&gt;语法&lt;/strong&gt;和&lt;strong&gt;数据结构&lt;/strong&gt;的高度一致。很多代码都是相似的，把握住&lt;strong&gt;设计思想&lt;/strong&gt;才是最关键的。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Crowbar源码剖析：词法</title>
      <link>https://daichao1997.github.io/posts/tech/2018-10-07-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E8%AF%8D%E6%B3%95/</link>
      <pubDate>Sun, 07 Oct 2018 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2018-10-07-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E8%AF%8D%E6%B3%95/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://daichao1997.github.io/Crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%EF%BC%9A%E6%80%BB%E4%BD%93%E6%A1%86%E6%9E%B6.html&#34;&gt;上回书说到&lt;/a&gt;，Crowbar用了Lex/Yacc这对经典工具来生成词法/语法分析器。它们具体的编写规则我不想细说，请参考&lt;a href=&#34;https://segmentfault.com/a/1190000000396608&#34;&gt;这篇文章&lt;/a&gt;，但大致来讲，两者都是“一边匹配一边触发动作”。&lt;/p&gt;
&lt;p&gt;本篇文章会集中讨论&lt;strong&gt;匹配&lt;/strong&gt;触发了&lt;strong&gt;哪些动作&lt;/strong&gt;，而不讲如何匹配、为什么匹配。&lt;/p&gt;
&lt;h2 id=&#34;crowbar-lex&#34;&gt;Crowbar-Lex&lt;/h2&gt;
&lt;p&gt;这部分讲述Lex如何对五花八门的字符作出不同反应，用&lt;code&gt;&amp;lt;X&amp;gt;exp{action}&lt;/code&gt;表示“状态X下，与exp匹配时，执行action”。为了给Yacc传递符号的解析结果，双方约定了一种“通信方式”：&lt;/p&gt;</description>
    </item>
    <item>
      <title>Crowbar源码剖析：总体框架</title>
      <link>https://daichao1997.github.io/posts/tech/2018-10-06-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E6%80%BB%E4%BD%93%E6%A1%86%E6%9E%B6/</link>
      <pubDate>Sat, 06 Oct 2018 00:00:00 +0800</pubDate>
      <guid>https://daichao1997.github.io/posts/tech/2018-10-06-crowbar%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%E6%80%BB%E4%BD%93%E6%A1%86%E6%9E%B6/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Crowbar是《自制编程语言》一书中作者自己构思的无类型语言。本书一边向读者讲述编程语言的基本要素，一边讲解具体的实现方法，可作为编译技术的入门材料。此外，书中还有一门叫做Diksam的静态类型语言，等我学完了再来写。不🐦，真的。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
