Check out Microsoft.Scripting.Ast.Utils.Assign, Read, Delete. These all take in a SymbolId which is the name of the global and let you get/set it.
These ultimately just generate calls into a helper which calls back onto your LanguageContext's LookupName, SetName, and RemoveName methods. You can either use the default implementation (which just gets/sets/deletes from the global scope) or you can override them and get your own custom globals behavior. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Artur Krosny Sent: Friday, June 27, 2008 8:08 AM To: [email protected] Subject: [IronPython] A few DLR questions Hi, First of all, I am sorry if this is a wrong group, but I couldn't find a better place to ask questions about DLR. I am trying to learn how to write a simple compiler which targets DLR by analising ToyScript sources (and sometimes looking at IronRuby sources too). My idea is to use GoldParser to create a parser skeleton for my learning curve. This allows me to concentrate on a problem of generating DLR Ast, instead of spending time on creating a parser by hand. The GoldParser part was rather easy and a skeleton parser was ready quite quickly. Now I am trying to "fill it" with a generation of DLR Ast. I am trying to follow a "ToyScript way" of generating DLR Ast, adopting its Ast classes and applying required changes. However I encountered a problem with "Global varaiables". My language has a statement "PUBLIC <var>[:=<value>]" which declares a global var. And I fill a little bit "lost" :). I see how "Local variables" are handled in ToyScript but I have no idea how to handle globals. Anyone could point me to the right direction ? -- Artur _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
