You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When using the compile to javascript feature, its not possible to change the operators defined in NATIVE_JS_OPERATORS and functions in NATIVE_JS_FUNCTIONS. This is required to compile to environments where there are no operators like - 2+3*3 -> add(2, multiply(3,3))
Describe the solution you'd like
Add parameters in the options for compile to specify the CompileTarget interface.
This will enable overriding operators and functions.
For functions, its possible to pass them but they are compiled directly to javascript so its not possible to change the behaviour like in CompileTarget
Describe alternatives you've considered
Using the compileTarget directly, but it's not exported. Also since box.compile() is the entry-point, it should be possible to override based on that.
Additional context
Also I wrote a compiler for GLSL, it's in a fork right now since required many changes, but this would make it easy to work on that and maybe get that merged easily.
The text was updated successfully, but these errors were encountered:
I'm not sure I understand the point of this feature request. Is this to compile to targets other than JavaScript?
I'm aware of several implementations that compile to GLSL and Python, which is great, but none of those have been contributed back to the project. As such, I am not very motivated to work on making improvements for individual users who are not contributing to the community.
This specific request is to allow setting operators for compiling to javascript, which are required for vector operations, since compiling an expression that adds 2 vectors results to [1,1,1]+[1,1,1] which is not valid javascript, so I was thinking of overriding operators to functions so it compiles to add([1,1,1], [1,1,1]) which can be defined for vector, matrix operation.
Other than that, another request was to provide interface to allow compiling to any target where we can pass in the CompileTarget interface which would allow more customization.
For GLSL compile, I worked on it last year, but couldn't get time to finish it with support for all statements, hope to finish it this year and contribute to the project.
Kudos on the project and the cortexjs ecosystem though, great to see it progress so much.
It's not very big of a requirement, if you feel its not a worthwhile addition to the compile function options, please don't spend time on it and feel free to close the issue. Thanks
Is your feature request related to a problem? Please describe.
When using the compile to javascript feature, its not possible to change the operators defined in NATIVE_JS_OPERATORS and functions in NATIVE_JS_FUNCTIONS. This is required to compile to environments where there are no operators like -
2+3*3
->add(2, multiply(3,3))
Describe the solution you'd like
Add parameters in the options for compile to specify the
CompileTarget
interface.This will enable overriding operators and functions.
For functions, its possible to pass them but they are compiled directly to javascript so its not possible to change the behaviour like in CompileTarget
Describe alternatives you've considered
Using the
compileTarget
directly, but it's not exported. Also since box.compile() is the entry-point, it should be possible to override based on that.Additional context
Also I wrote a compiler for GLSL, it's in a fork right now since required many changes, but this would make it easy to work on that and maybe get that merged easily.
The text was updated successfully, but these errors were encountered: