<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Abstract Syntax Tree on Ikwuka Okoye</title><link>https://ikwukao.dev/tags/abstract-syntax-tree/</link><description>Recent content in Abstract Syntax Tree on Ikwuka Okoye</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 10 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ikwukao.dev/tags/abstract-syntax-tree/index.xml" rel="self" type="application/rss+xml"/><item><title>Parsing Markdown into an HTML Tree: Designing the Intermediate Representation</title><link>https://ikwukao.dev/journal/parsing-markdown-into-an-html-tree/</link><pubDate>Mon, 10 Aug 2026 00:00:00 +0000</pubDate><guid>https://ikwukao.dev/journal/parsing-markdown-into-an-html-tree/</guid><description>&lt;h2 id="parsing-markdown-into-an-html-tree-designing-the-intermediate-representation"&gt;Parsing Markdown into an HTML Tree: Designing the Intermediate Representation&lt;/h2&gt;
&lt;p&gt;One of the easiest mistakes to make when building a Markdown-to-HTML converter is to think of the problem as string replacement.&lt;/p&gt;
&lt;p&gt;Replace &lt;code&gt;**text**&lt;/code&gt; with &lt;code&gt;&amp;lt;strong&amp;gt;text&amp;lt;/strong&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Replace &lt;code&gt;*text*&lt;/code&gt; with &lt;code&gt;&amp;lt;em&amp;gt;text&amp;lt;/em&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Replace headings with &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;At first, this seems sufficient.&lt;/p&gt;
&lt;p&gt;It quickly becomes difficult once documents contain nested structures.&lt;/p&gt;
&lt;p&gt;A more robust approach is to introduce an intermediate representation between Markdown and HTML.&lt;/p&gt;</description></item></channel></rss>