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/20150124/f7b04d97/attachment.html below:

<div dir="ltr"><div><div><div>Have you tried it yet?<br><br>I think you have to inline dictpopulator, because dictpopulator can start with the same tokens as test, and the parser doesn't backtrack. So it wouldn't know how to decide whether to take the dictpopulator branch or the set branch. If you inline it, the parser will know, because it does something clever within the rule.<br><br>As-is, I get a lot of errors from pgen about ambiguity. This one seems to work (but you still have to adjust the code generator of course):<br><br><span style="font-family:monospace,monospace">dictorsetmaker: ( ((test ':' test | '**' test) (comp_for | (',' (test ':' test | '**' test))* [','])) |<br>                   (test (comp_for | (',' test)* [','])) )</span><br><br></div>Also I presume you want a similar treatment for the set branch (replace both tests with (test | '*' test).<br><br></div>Good luck! There's plenty of code to crib from for the code generation.<br><br></div>--Guido<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 24, 2015 at 6:10 PM, Neil Girdhar <span dir="ltr"><<a href="mailto:mistersheik@gmail.com" target="_blank">mistersheik@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">To finish PEP 448, I need to update the grammar for syntax such as<div><br></div><div>{**x for x in it}</div><div><br></div><div>and</div><div><br></div><div>{1:2, 3:4, **a}</div><div><br></div><div>It's been a long time since I've looked at grammars and I could really use the advice of an expert.  I'm considering replacing:</div><div><div><br></div><div><div>dictorsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |</div><div>  Â  Â  Â  Â  Â  Â  Â  Â  (test (comp_for | (',' test)* [','])) )</div></div><div><br></div><div>with:</div><div><br></div><div>dictpopulator: test ':' test | '**' test</div><div>dictorsetmaker: ( (dictpopulator (comp_for | (',' dictpopulator)* [','])) |</div><div>  Â  Â  Â  Â  Â  Â  Â  Â  Â (test (comp_for | (',' test)* [','])) )</div></div><div><br></div><div>Am I headed in the right direction?  Of course I will need to edit parsermodule.c and ast.c.</div><div><br></div><div>Best,</div><div><br></div><div>Neil</div></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>

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