Package ZestyParser :: Module AHT
[show private | hide private]
[frames | no frames]

Module ZestyParser.AHT


Version: 0.6.0

Author: Adam Atlas

Contact:

adam@atlas.st

AHT (Ad Hoc Types) is a utility module providing an easy way to generate "labels" for objects in abstract parse trees without defining a class for each one.

To use it, create an instance of Env. Now you can access any property on it and get a unique type for that name. The first time such a type is called, it becomes a subclass of the type of whatever it is passed. For example, EnvInstance.SomeEntity("hi") marks SomeEntity as being a subclass of str, and returns an instance of itself initialized with "hi".) Now you can check at any time with nothing more than a isinstance(something, EnvInstance.SomeEntity) how a piece of data was instantiated.

Ad Hoc Types are primarily intended to be used in conjunction with AbstractToken types, where you should set it as the as parameter, or, if it is more convenient (e.g. when you must use >>), as its callback.

Copyright: Copyright 2006-2007 Adam Atlas. Released under the terms of the GNU General Public License.

Classes
Env  

Generated by Epydoc 2.1 on Thu Jan 11 23:26:09 2007 http://epydoc.sf.net