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

Setup online lpython #2328

Merged
merged 11 commits into from
Sep 17, 2023
Merged

Conversation

Shaikh-Ubaid
Copy link
Collaborator

@Shaikh-Ubaid Shaikh-Ubaid commented Sep 17, 2023


# Notes:
# STANDALONE_WASM is disabling support for exceptions, so it is currently omitted
# In build_to_wasm.sh, we need CMAKE_CXX_FLAGS_DEBUG="-Wall -Wextra -fexceptions" flags for exception support
set(WASM_COMPILE_FLAGS "-g0 -fexceptions")
set(WASM_COMPILE_FLAGS "-g0 -fexceptions -fsanitize=undefined")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LPython's parser segfaults in many cases when LPython is build to wasm. It seems LPython uses a different parser as compared to LFortran. I think LPython uses LR(1) parser where as LFortran uses GLR parser.

The above -fsanitize flag is actually a debugging flag, but it seems to make LPython's parser to work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, LPython uses LALR(1), which should be an easier parser.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a previous version of emscripten, the LPython parser would abort with error in the lines of "large memory ~3.5Gbs requested which is more than the available ~2.4Gbs". With the latest version of emscripten, it says "aborted, runtime error". (I updated my installed emscripten to be sure the errors are not due to some old version. )

@Shaikh-Ubaid Shaikh-Ubaid marked this pull request as ready for review September 17, 2023 03:25
@@ -164,6 +168,7 @@ abi -- External ABI
| GFortranModule -- Yes GFortran
| BindC -- Yes C
| BindPython -- Yes Python
| BindJS -- Yes Javascript
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a new decorator for calls to Javascript functions. We previously used the (BindC + implementation=interface) for recognizing the functions to be imported. But it seems some functions from the numpy intrinsic module use these exact parameters (BindC + interface) and thus we are unable to distinguish between these numpy intrinsic functions and the functions that call into Javascript.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine. The same should be done in LFortran.

--> tests/../integration_tests/elemental_01.py:10:24
|
10 | assert abs(sin(sin(array[i])) - result[i]) <= eps
| ^^^^^^^^^^^^^
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These few files got removed. I think these were left over from some previous PR.

@Shaikh-Ubaid
Copy link
Collaborator Author

Shaikh-Ubaid commented Sep 17, 2023

After we merge this, we need to update the commit version at https://dev.lpython.org/ (and also the browser window tab name).

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is fine, thanks!

@Shaikh-Ubaid Shaikh-Ubaid merged commit 0a5d89b into lcompilers:main Sep 17, 2023
12 checks passed
@Shaikh-Ubaid Shaikh-Ubaid deleted the setup_online_lpython branch September 17, 2023 04:44
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