-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add support for GraalVM languages. #6
Comments
Basically works with ea2a0ef The only things left which would be nice to have for the next meeting are execution of multiline code and supporting We might be able to solve both issues using some kind of Regex escape for strings maybe. @jonashering @tomkellog |
@jak-ing have you found the LOC where your "transpiled" code is executed (probably by calling Somewhere in eval(request.code); turns into: magic = polyglotExtract(request.code);
Polyglot.eval(magic.language, magic.code); This way, you can easily support multiline code and avoid the use of regexs :) |
Looks like |
@tomkellog wanted to take over from here but here's what I found out already yesterday: Replacing the I'm in favor of this too! Transpiler support in |
The StackOverflow thread talks about sandboxing, so I'm guessing you are concerned about security. First, security is not a primary goal of what we want to achieve here. Nonetheless, GraalVM can sandbox languages and thus the polyglot API can be considered "secure". By default, however, I think sandboxing is disabled. Will look into this for you... |
multi-line, choice of quotation marks and support for all Graal language works. Code is uncommited because changes affect node modules, in function run(code) {
let magic = '';
if(code.startsWith('%polyglot ')){
magic = code.split('\n')[0].replace('%polyglot ', '')
} else {
return vm.runInThisContext(code);
}
const actualCode = code.split('\n').slice(1).join('\n');
return vm.runInThisContext(Polyglot.eval(magic, actualCode));
} |
Why return vm.runInThisContext(Polyglot.eval(magic, actualCode)); and not just return Polyglot.eval(magic, actualCode); ? |
Using magics, we want to support interpreting all languages supported by GraalVM.
If this works well, we want to switch to automatic language detection. #3
The text was updated successfully, but these errors were encountered: