Skip to content

Add parserless build mode #1021

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

Merged
merged 1 commit into from
Apr 10, 2025
Merged

Add parserless build mode #1021

merged 1 commit into from
Apr 10, 2025

Conversation

bnoordhuis
Copy link
Contributor

Add a QJS_ENABLE_PARSER build option that enables/disables the parser.

Useful if you want to execute bytecode but not parse source code, e.g., for hardening reasons, or due to running in a constrained environment.

Shrinks a release build by about 15%.

Fixes: #976


I decided not to shuffle code around for now but that's maybe not a bad idea in the future, to reduce ifdef soup.

@bnoordhuis bnoordhuis mentioned this pull request Apr 8, 2025
@bnoordhuis
Copy link
Contributor Author

meson builds fail because QJS_ENABLE_PARSER is undefined, and now that I think about it, the amalgamation is affected in the same way. Maybe I should rename it to QJS_DISABLE_PARSER...

@saghul
Copy link
Contributor

saghul commented Apr 8, 2025

meson builds fail because QJS_ENABLE_PARSER is undefined, and now that I think about it, the amalgamation is affected in the same way. Maybe I should rename it to QJS_DISABLE_PARSER...

I was going to suggest that :-)

Add a QJS_DISABLE_PARSER build option that disables the JS source code
parser. The JSON parser is unaffected.

Useful if you want to execute bytecode but not parse source code, e.g.,
for hardening reasons, or due to running in a constrained environment.

Shrinks a release build by about 15%.

Fixes: quickjs-ng#976
@bnoordhuis
Copy link
Contributor Author

openbsd failure was infrastructural, restarted.

@bnoordhuis bnoordhuis merged commit 90b2437 into quickjs-ng:master Apr 10, 2025
239 of 241 checks passed
@bnoordhuis bnoordhuis deleted the fix976 branch April 10, 2025 16:30
graham pushed a commit to graham/quickjs that referenced this pull request Apr 11, 2025
Add a QJS_DISABLE_PARSER build option that disables the JS source code
parser. The JSON parser is unaffected.

Useful if you want to execute bytecode but not parse source code, e.g.,
for hardening reasons, or due to running in a constrained environment.

Shrinks a release build by about 15%.

Fixes: quickjs-ng#976
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.

Parser-less build mode
2 participants