Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bytecode VM #16

Open
laszlokorte opened this issue Jul 8, 2016 · 0 comments
Open

Bytecode VM #16

laszlokorte opened this issue Jul 8, 2016 · 0 comments

Comments

@laszlokorte
Copy link
Owner

In order to simplify the implementation of stepping through the drawing instructions, setting break points, and the nesting of pictures inside each other (modeled as procedure calls) it seems like a good idea to build a simple VM layer specialized on doing vector math.

I already started to implement that here:
https://github.com/laszlokorte/reform-swift/blob/master/ReformCore/ReformCore/VM.swift

But it's just a rough sketch and it's not in use yet.

It would work as follows:

A picture consists of a Procedure containing the drawing instructions (represented as AST)
The Drawing instructions would be compiled into VM byte code
That byte code would then be executed by the VM/runtime
The result would be a list of shapes

Currently the AST is executed by the runtime directly.

Converting the AST into a linear sequence of instructions would also allow better tracking of runtime errors and preventing long running code (loops, recursion) by injecting control points into the sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant