<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>zehnpaard</author_name>
  <author_url>https://blog.hatena.ne.jp/zehnpaard/</author_url>
  <blog_title>Arantium Maestum</blog_title>
  <blog_url>https://zehnpaard.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>言語処理系</anon>
  </categories>
  <description>パーサを作るにあたってまずはlexerから。 lexerと簡単なパーサで共通しているのは「消費可能なストリームの先頭を『消費することなく』先読みする必要がある」という点。lexerだと入力の文字のストリーム、パーサだとlexerの返すトークンストリーム、と対象は異なるがどちらも「先読み」が必要。 Peekable Pythonのストリームであるiteratorは__next__で消費しないと次の要素が何かわからない。iteratorを拡張してpeekが可能なクラスをまず定義する： class Peekable: def __init__(self, input_, k, sentinel=No…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fzehnpaard.hatenablog.com%2Fentry%2F2021%2F09%2F07%2F064930&quot; title=&quot;PythonでLanguage Implementation Patternsのパーサと戯れる　lexerとPeekableストリームオブジェクト - Arantium Maestum&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-09-07 06:49:30</published>
  <title>PythonでLanguage Implementation Patternsのパーサと戯れる　lexerとPeekableストリームオブジェクト</title>
  <type>rich</type>
  <url>https://zehnpaard.hatenablog.com/entry/2021/09/07/064930</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
