Skip to content

Conversation

ubaidsk
Copy link
Collaborator

@ubaidsk ubaidsk commented Jan 13, 2023

Earlier this week (before meet with Dr. Ondrej), I experimented/played with possibility of supporting runtime library by bridging via javascript.

Example:

(lp) lpython$ cat examples/expr2.py 
from ltypes import f64
from numpy import cos, sin

@ccall
def _lfortran_dsin(x: f64) -> f64:
    pass

def main0():
    theta: f64 = 2.0
    print(sin(theta)**2.0 + cos(theta)**2.0)
    
    pi: f64 = 3.141592653589793238462643383279502884197
    print(_lfortran_dsin(pi/2))

main0()
(lp) lpython$ lpython examples/expr2.py --backend wasm -o tmp  
(lp) lpython$ node --experimental-wasi-unstable-preview1 tmp.js
(node:32581) ExperimentalWarning: WASI is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
1
1
(lp) lpython$ 

@ubaidsk ubaidsk added the wasm label Jan 13, 2023
@certik certik mentioned this pull request Jan 31, 2023
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant