From nas at arctrix.com Sat Apr 2 03:57:26 2005 From: nas at arctrix.com (Neil Schemenauer) Date: Sat Apr 2 03:57:30 2005 Subject: [Compiler-sig] Help with the AST re decorators Message-ID: <20050402015726.GA28784@mems-exchange.org> I'm trying to add support to the AST compiler for decorators. I'm stuck in trying to represent them in ASDL. This is what I currently have: stmt = FunctionDef(decorator* decorators, identifier name, arguments args, stmt* body) | ... decorator = (identifier name, arglist* args) arglist = ArgList(expr* args, keyword* keywords, expr? starargs, expr? kwargs) Although I have quite a bit of the implementation done, I don't like the ArgList node. Perhaps this would be better: stmt = FunctionDef(decorator* decorators, identifier name, arguments args, stmt* body) | ... expr = CallExpr(call c) | ... decorator = DecoratorName(identifier name) | DecoratorCall(call c) call = Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) A decorator call is basically a function call, the only difference being that the func expression must be a dotted_name. The second definition seems fairly clumsy as well. Any advice? Neil From nas at arctrix.com Sat Apr 2 04:03:26 2005 From: nas at arctrix.com (Neil Schemenauer) Date: Sat Apr 2 04:03:28 2005 Subject: [Compiler-sig] Re: Help with the AST re decorators In-Reply-To: <20050402015726.GA28784@mems-exchange.org> References: <20050402015726.GA28784@mems-exchange.org> Message-ID: <20050402020325.GA28860@mems-exchange.org> On Fri, Apr 01, 2005 at 06:57:26PM -0700, Neil Schemenauer wrote: > This is what I currently have: > > stmt = FunctionDef(decorator* decorators, identifier name, > arguments args, stmt* body) > | ... > > decorator = (identifier name, arglist* args) > > > arglist = ArgList(expr* args, keyword* keywords, expr? starargs, > expr? kwargs) Argh, I should have included Call instead of FunctionDef: expr = Call(expr func, arglist args) | ... Sorry. Neil From neal at metaslash.com Sat Apr 2 17:27:10 2005 From: neal at metaslash.com (Neal Norwitz) Date: Sat Apr 2 17:27:15 2005 Subject: [Compiler-sig] Help with the AST re decorators In-Reply-To: <20050402015726.GA28784@mems-exchange.org> References: <20050402015726.GA28784@mems-exchange.org> Message-ID: <20050402152710.GA13138@janus.swcomplete.com> On Fri, Apr 01, 2005 at 06:57:26PM -0700, Neil Schemenauer wrote: > > A decorator call is basically a function call, the only difference > being that the func expression must be a dotted_name. The second > definition seems fairly clumsy as well. Any advice? I don't have any advice, but have you looked at this patch: http://sourceforge.net/tracker/index.php?func=detail&aid=1167709&group_id=5470&atid=305470 I don't know if it is relevent or not, but it might give you some ideas. There are several other AST patches too. Neal From jhylton at gmail.com Sat Apr 2 19:18:26 2005 From: jhylton at gmail.com (Jeremy Hylton) Date: Sat Apr 2 19:18:29 2005 Subject: [Compiler-sig] Help with the AST re decorators In-Reply-To: <20050402015726.GA28784@mems-exchange.org> References: <20050402015726.GA28784@mems-exchange.org> Message-ID: On Apr 1, 2005 8:57 PM, Neil Schemenauer wrote: > I'm trying to add support to the AST compiler for decorators. I'm > stuck in trying to represent them in ASDL. This is what I currently > have: > > stmt = FunctionDef(decorator* decorators, identifier name, > arguments args, stmt* body) I've been wondering if decorators and default argument values should be nodes that wrap a function call. The argument in favor of this approach is that they are in a different block that the function body and arguments. It complicates the visitor code in several places because you have to evaluate parts of the FunctionDef in one namespace, then enter the function's namespace and continue. Jeremy From nas at arctrix.com Sat Apr 2 19:19:54 2005 From: nas at arctrix.com (Neil Schemenauer) Date: Sat Apr 2 19:19:58 2005 Subject: [Compiler-sig] Help with the AST re decorators In-Reply-To: <20050402152710.GA13138@janus.swcomplete.com> References: <20050402015726.GA28784@mems-exchange.org> <20050402152710.GA13138@janus.swcomplete.com> Message-ID: <20050402171954.GB30550@mems-exchange.org> On Sat, Apr 02, 2005 at 10:27:10AM -0500, Neal Norwitz wrote: > I don't have any advice, but have you looked at this patch: > > http://sourceforge.net/tracker/index.php?func=detail&aid=1167709&group_id=5470&atid=305470 I just looked at it. The patch works and is simpler than what I was doing. It uses this definition: - stmt = FunctionDef(identifier name, arguments args, stmt* body) + stmt = FunctionDef(identifier name, arguments args, + stmt* body, expr* decorators) When transforming the CST to the AST, it creates either a Call or a Name/Attribute node for each decorator expr. Neil From cgi-bin at PayPal.Com Wed Apr 6 19:15:33 2005 From: cgi-bin at PayPal.Com (PayPal) Date: Wed Apr 6 20:04:46 2005 Subject: [Compiler-sig] Security Center Advisory Message-ID: <200504061715.j36HFXm14401@ns.cedeao.org.> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050406/c1510d10/attachment.htm From cgi-bin at PayPal.Com Wed Apr 6 19:49:53 2005 From: cgi-bin at PayPal.Com (PayPal) Date: Thu Apr 7 05:42:26 2005 Subject: [Compiler-sig] Security Center Advisory Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050406/256e5cbc/attachment.html From cgi-bin at PayPal.Com Wed Apr 6 19:52:29 2005 From: cgi-bin at PayPal.Com (PayPal) Date: Thu Apr 7 05:44:15 2005 Subject: [Compiler-sig] Security Center Advisory Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050406/d6215e0c/attachment.htm From update at paypal.com Thu May 26 15:36:46 2005 From: update at paypal.com (PayPal Inc.) Date: Thu, 26 May 2005 07:36:46 -0600 Subject: [Compiler-sig] Update And Verify Your PayPal Account Message-ID: <200505261336.j4QDakB05698@dull.scullions.acmebase.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050526/cf90fede/attachment.htm From service at banking.lasallebank.com Sun Jun 5 04:01:34 2005 From: service at banking.lasallebank.com (LaSalle Bank) Date: Sat, 4 Jun 2005 22:01:34 -0400 (EDT) Subject: [Compiler-sig] LaSalle Online Banking Notice - Final Notice Message-ID: <1117936894.72555.qmail@banking.lasallebank.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050604/7d45e2e3/attachment.html From service at banking.lasallebank.com Mon Jun 6 03:10:39 2005 From: service at banking.lasallebank.com (LaSalle Bank) Date: Sun, 5 Jun 2005 21:10:39 -0400 (EDT) Subject: [Compiler-sig] LaSalle Online Banking Notice - Final Notice Message-ID: <1118020239.72555.qmail@banking.lasallebank.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050605/ce22880f/attachment.html From support at southtrust.com Thu Jun 16 20:57:26 2005 From: support at southtrust.com (support@southtrust.com) Date: Thu, 16 Jun 2005 20:57:26 +0200 Subject: [Compiler-sig] Billing Issues Message-ID: <200506161857.j5GIvQV18059@svk2.svkkl.cz> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/compiler-sig/attachments/20050616/ff8709ab/attachment.htm From sniff at azimuth.ch Fri Jun 24 19:55:38 2005 From: sniff at azimuth.ch (Noll) Date: Fri, 24 Jun 2005 09:55:38 -0800 Subject: [Compiler-sig] Works effectively... in mild, moderate or severe ED Message-ID: <2945121427.10873457287@adsl-18-29-220.mco.bellsouth.net> 36 hours: for all your needs :) http://evdr.1gmun21uyt19521.punkag.com I have learned to use the word 'impossible' with the greatest caution. Society produces rogues, and education makes one rogue cleverer than another. Only the shallow know themselves.