| Home | Trees | Index | Help |
|---|
| Package ZestyParser :: Module AHT |
|
Version: 0.8.0
Author: Adam Atlas
Contact:
adam@atlas.st
This module is now deprecated in favour of Tags.
The documentation and classes are still available to assist in converting
code that uses AHT, but this module may be removed in a future version.
In general, given some AHT environment E, code can be converted to use
Tags by changing callback=/to=/as=/>> E.x to
callback=/to=/>> Tags.x and isinstance(y,
E.x) to y in Tags.x.
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.
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 MIT license (see LICENSE.txt).
| Classes | |
|---|---|
Env |
|
_AHTFactory |
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Apr 26 01:32:22 2007 | http://epydoc.sf.net |