1 / 15

Mitchell McMullen Paul Nguyen

SWAN. Mitchell McMullen Paul Nguyen. Python written entirely in C #. Can access all .NET libraries and Silverlight. Created by the same guy as Jython . No design documentation or developer’s guide for source code =( . IronPySwan. Added Oracle Database Connectivity.

eldora
Télécharger la présentation

Mitchell McMullen Paul Nguyen

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SWAN Mitchell McMullen Paul Nguyen

  2. Python written entirely in C#. • Can access all .NET libraries and Silverlight. • Created by the same guy as Jython. • No design documentation or developer’s guide for source code =(

  3. IronPySwan • Added Oracle Database Connectivity. • Embedded SQL commands/queries. • Allows arbitrary python expressions within SQL commands/queries. (Using back ticks)

  4. Overview

  5. Tokenizer • Breaks up the source code into tokens. • IronPython uses a mostly hand-written tokenizer and parser. • Some token recognition code is auto-generated. MAKECONNECT _________________ ______________ INSERT

  6. Parser • Identifies tokens as they come in. • Implements the Python (BNF) grammar directly. • Constructs the Python AST.

  7. MSAstNode Declaration • This is where a statement/expression is turned into a node fit for the AST. • The statement/expression’s Reduce() method is called, which returns a simpler node. • Typically, reduce() links to implementation code.

  8. Connection AstMethods Statement (Nonquery) Expression (Query) • Big collection of Method signatures, used for reflection/indirection to PythonOps. AstMethods

  9. Connection PythonOps Statement (Nonquery) Expression (Query) • Pretty much another layer of indirection, and a repository for some helper functions.

  10. Runtime Behavior • This is the implementation-ey kind of stuff. In the end, this is where the heavy lifting for each method call is located. • We have one class, PySwanSqlRunner, which houses the connection and passes the final SQL strings on to the database. • These methods are executed by the interpreter.

  11. Connection PySwanSqlRunner Statement (Nonquery) Expression (Query)

  12. Stuff That Still Really Needs Work • Error handling is pretty primitive. • No RDF. (Sorry, Dr. Cannata!!) • SQL must be well-formed.

  13. Programming Language Terms • Terminal/Nonterminal (Tokenizer.cs). • Abstract Syntax Tree (Parser.cs). • Parse tree is implicitly built. (Parser.cs) • Python.g BNF is implemented directly (Parser.cs • Some SQL involved.

  14. Demonstration • Hope you enjoy!

  15. Questions?

More Related