Use More of Python's Infrastructure
The current interpreter builds a simplistic dialect of Python, on top of Python. This seems like a waste of resources. Instead more of Python's infrastructure could be used directly.
Whiteboard
- User defined functions are special objects "SimlFunction" that are interpreted by the interpreter. They are stored in regular Python classes. They behave like regular methods with respect to attribute lookup (they are descriptors).
- Built in functions are regular Python functions, that have some special attributes. Especially they have an attribute siml_signature.
- Objects are regular objects. No more attributes dictionary. Some additional special attributes named '__siml_***__' are introduced. Important is the attribute __siml_type__ which is used in the interpreter instead of __class__ so that unevaluated expressions can be treated like normal objects.
- Classes (built in and user defined) are regular Python classes, user defined classes inherit from SimlClass.
- The type of unevaluated expressions is handled similar to known objects. The special attribute __siml_type__ is used instead of classes for this reason. Known objects are represented by a normal instance of their class, while unevaluated expressions are ast.Nodes that represent unknown objects.
- The interpreter has to stay:
- Additional keywords.
- Different assignment semantics. (I'm sad that there is no __assign__ method.)
- Code collection, instruction reordering.
Work Items
Dependency tree
* Blueprints in grey have been implemented.