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

Snap Compiler #3048

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft

Snap Compiler #3048

wants to merge 37 commits into from

Conversation

ochan1
Copy link

@ochan1 ochan1 commented May 11, 2022

Paper to be linked on implementation

Work so far for a compiled Snap to JavaScript

Advised by Brian Harvey

@himanss
Copy link

himanss commented May 11, 2022

i was working on a prototype for Snap JIT... try it out!
it uses a more assembly like approach.

here

it produces code that looks like this:

async function anonymous(...a
) {
// head
let r = new Array(3)
let v = new Array(0)
let o = new Array(4)
let p = a.pop()
let bop = op=>p[op].bind(p)
o[0] = bop("getVarNamed")
o[1] = bop("reportPower")
o[2] = bop("reportJoinWords")
o[3] = bop("reportAnd")
// body
// reportAnd {
// reportPower {
r[0] = await o[0](\"a\")
r[0] = await o[1](r[0],2)
// }
// reportPower {
// reportJoinWords {
r[1] = await o[2](WIP_multi_arg) //multi arg is work in progress
// }
// reportJoinWords {
r[2] = await o[2](WIP_multi_arg)
// }
r[1] = await o[1](r[1],r[2])
// }
r[0] = await o[3](r[0],r[1])
// }
return r[0];
}

edit: cleaned up from string conversion

@ochan1
Copy link
Author

ochan1 commented May 21, 2022

Link to Project Report paper on implementation: https://www2.eecs.berkeley.edu/Pubs/TechRpts/2022/EECS-2022-157.html

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

Successfully merging this pull request may close these issues.

None yet

2 participants