https://github.com/fabiosantoscode/quickjs-precompiler
Speed up javascript: compile some JS to C, the rest will use quickjs
https://github.com/fabiosantoscode/quickjs-precompiler
Last synced: 11 months ago
JSON representation
Speed up javascript: compile some JS to C, the rest will use quickjs
- Host: GitHub
- URL: https://github.com/fabiosantoscode/quickjs-precompiler
- Owner: fabiosantoscode
- Created: 2024-11-09T11:31:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-14T12:04:11.000Z (12 months ago)
- Last Synced: 2025-03-09T09:29:28.033Z (11 months ago)
- Language: TypeScript
- Size: 282 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# quickjs-precompiler
Precompiles your JavaScript files into C with quickjs embedded.
Note: quickjs can already output C files containing your JS turned into bytecode, but this aims to provide a faster version of this by creating C files that mirror your actual JS.
# Internal design
Firstly, the JS is parsed with Acorn, producing the ESTree AST. This is a standard format for JavaScript ASTs.
Then, we turn the ESTree AST into our internal precomp-AST. The precomp-AST is fully convertible into C with quickJS calls.
In the future, there may be a step to optimize the precomp-AST by utilizing type information.
Finally, the precomp-AST is output into C source code.
# Roadmap
- Optimize written functions per-type
- Extend your code with C functions
- Precompile the generated code with TCC