There will be no updates upcoming. Now I use Common Lisp and python instead, because Hy has too frequent changes to use for daily tasks. I hope that Hy gets matured and I could go back to Hy someday.
HyCC is a static compiler for Hy, can create shared libraries and standalone executables from Hy source files.
The input source file is once translated to C and then compiled to machine code.
You may also get the generated C source code and compile it mannually with any C/C++ compilers.
One of the recommended uses is to compile a Hy module and create a shared library in order to improve its performance.
In most cases, the compiled module runs much faster than Hy as well as Python, so we can say that hycc
replaces hyc
completely.
- hy >= 0.13.0 (or, the latest version on github)
- Cython >= 0.25.2
$ pip install hycc
$ hycc --help
usage: hycc [options] module...
options:
-o <file> place the output into <file>
--clang create c code; do not compile
--python create python code; do not compile
--shared create shared library
--version show program's version number and exit
--help show this help and exit
- hello.hy
(defn hello []
(print "hello"))
(defmain [&rest args]
(hello))
$ hycc hello.hy
$ ./hello
hello
$ hycc hello.hy --shared
You can import this from Hy as well as Python.
(import hello)
(hello.hello)
; > hello
import hello
hello()
# > hello
Note: if you want to import module as a part of package, __init__.py
is required instead of --init--.hy
.
HyCC is distributed under MIT license.