ev-flow / ev-flow/quark-engine

Using getattr method to make bytecode loader more elegant

Open
#94 0 comments 0 reactions 1 assignee Claimed by @zinwang View on GitHub
enhancement issue-processing-state-04
Dominant language
Python
Stars
1.7k
Forks
218
Avg merge
4d 12h
Merged PRs (30d)
7

Description

[Byterun](https://github.com/nedbat/byterun) is a Python interpreter implemented in Python. In its [implementation](https://github.com/nedbat/byterun/blob/31e6c4a8212c35b5157919abff43a7daa0f377c6/byterun/pyvm2.py#L216-L236), the built-in function of `getattr` is used to call the corresponding bytecode instruction, which is Python's dynamic method lookup instead of using the big [switch statement](https://github.com/quark-engine/quark-engine/blob/ebcc0c2b38fa1fd70cb5993c8b72bb656643e2e9/quark/Evaluator/pyeval.py#L36-L61).

The full implementation link is below:
http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.