Use More of Python's Infrastructure

Registered by Eike

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.

Blueprint information

Status:
Complete
Approver:
Eike
Priority:
High
Drafter:
Eike
Direction:
Approved
Assignee:
Eike
Definition:
Approved
Series goal:
None
Implementation:
Informational Informational
Milestone target:
milestone icon 0.4.0
Started by
Eike
Completed by
Eike

Related branches

Sprints

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.return_type that tells the interpreter the type of the return value, which is necessary for code generation.

- 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.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.