A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20100331/2d78c295/attachment.html below:

Thank you for the advice everyone.  This seed has finally born (rotten) fruit at:<br><br><a href="http://writeonly.wordpress.com/2010/04/01/whython-python-for-people-who-hate-whitespace/">http://writeonly.wordpress.com/2010/04/01/whython-python-for-people-who-hate-whitespace/</a><br>
<a href="http://bitbucket.org/gregglind/python-whython3k/">http://bitbucket.org/gregglind/python-whython3k/</a><br><br><div class="gmail_quote">On Fri, Mar 12, 2010 at 4:13 AM, Georg Brandl <span dir="ltr">&lt;<a href="mailto:g.brandl@gmx.net">g.brandl@gmx.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Am 09.03.2010 14:42, schrieb Jeremy Hylton:<br>
<div><div></div><div class="h5">&gt; On Sat, Mar 6, 2010 at 11:27 AM, Gregg Lind &lt;<a href="mailto:gregg.lind@gmail.com">gregg.lind@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Python-devs,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m writing to you for some help in understanding the Python grammar.  As an<br>
&gt;&gt; excuse to deep dive into Python&#39;s tokenizer / grammar, I decided (as a<br>
&gt;&gt; hideous, hideous joke) to want to allow braces where colons are allowed (as<br>
&gt;&gt; flow control).<br>
&gt;&gt;<br>
&gt;&gt; Starting from PEP 306 (and branch r311), I hacked on Grammar/Grammer<br>
&gt;&gt;<br>
&gt;&gt; As a first example:<br>
&gt;&gt;<br>
&gt;&gt; funcdef: (&#39;def&#39; NAME parameters [&#39;-&gt;&#39; test] &#39;:&#39; suite |<br>
&gt;&gt;           &#39;def&#39; NAME parameters [&#39;-&gt;&#39; test] &#39;{&#39; suite &#39;}&#39; )<br>
&gt;&gt;<br>
&gt;&gt; I reran Parser/pgen and the dfa changes, but python (3.1) when recompiled,<br>
&gt;&gt; throws errors on things like:<br>
&gt;&gt;<br>
&gt;&gt; def a() { None }<br>
&gt;&gt;<br>
&gt;&gt; Strangely enough:<br>
&gt;&gt;<br>
&gt;&gt; lambdef: ( &#39;lambda&#39; [varargslist] &#39;:&#39; test  |<br>
&gt;&gt;                &#39;lambda&#39; [varargslist] &#39;{&#39; test &#39;}&#39; )<br>
&gt;&gt;<br>
&gt;&gt; works fine!  I this simplely some difference between &quot;test&quot; and &quot;suite&quot;.<br>
&gt;&gt;<br>
&gt;&gt; I have tried tackling this with gdb, looking at err_input clearly isn&#39;t<br>
&gt;&gt; enough.<br>
&gt;&gt;<br>
&gt;&gt;     (gdb) break err_input<br>
&gt;&gt;     (gdb) break PyParser_ASTFromString<br>
&gt;&gt;     import sys<br>
&gt;&gt;     b = compile(&quot;def a() {pass}&quot;,&quot;sys.stdout&quot;,&quot;single&quot;)<br>
&gt;&gt;     # yet a simple grammar fix is enough for this!<br>
&gt;&gt;     c = compile(&quot;lambda x {None}&quot;,&quot;sys.stdout&quot;,&quot;single&quot;)<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m in over my head!<br>
&gt;<br>
&gt; You don&#39;t say what errors occur when you try to compile strings in<br>
&gt; your new language.  You may have changed the Grammar, which allows you<br>
&gt; to tokenize the input.  That isn&#39;t enough to get the input to compile.<br>
&gt;  You also need to change the compiler to understand the new tokens.<br>
<br>
</div></div>In particular, many AST creation functions check for specific counts of<br>
children on many nodes.   I haven&#39;t checked, but in the case of the<br>
&quot;funcdef&quot; rule, it may check for either 7 or 5 children to determine<br>
whether the optional return annotation [&#39;-&gt;&#39; test] is present.<br>
<br>
Georg<br>
<br>
<br>
--<br>
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.<br>
Four shall be the number of spaces thou shalt indent, and the number of thy<br>
indenting shall be four. Eight shalt thou not indent, nor either indent thou<br>
two, excepting that thou then proceed to four. Tabs are right out.<br>
<div class="im"><br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
</div>Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/gregg.lind%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/gregg.lind%40gmail.com</a><br>
</blockquote></div><br>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4