Hy logo - Cuddles the cuttlefish | |
パラダイム | Multi-paradigm: procedural, functional, object-oriented, meta, reflective, generic |
---|---|
登場時期 | 2013年 |
設計者 | Paul Tagliamonte |
最新リリース | 0.29.0 / 2024年5月20日[1] |
評価版リリース | 0.17.0 / 2019年5月20日 |
影響を受けた言語 | Lisp, Kawa, Clojure, Common Lisp |
プラットフォーム | Cross-platform |
ライセンス | MIT-style |
ウェブサイト |
hylang |
拡張子 | .hy |
関連言語 | Lisp |
Hy(またはHylang)は、式をPythonのAST(抽象構文木)へ変換することで、PythonとLisp間でのやり取りができるように設計されたプログラミング言語Lispの方言のひとつである。HyはPython Conference(PyCon)2013でPaul Tagliamonteが発表した[2]。
KawaやClojureにおいて、S式がJava仮想マシン(JVM)の抽象構文木にマッピングされるのと同様に[3]、Hyは、Pythonの抽象構文に対する透過的なLispフロントエンドとして使用することが想定されている[4]。Lispではコード自体をデータとして操作することが可能である(メタプログラミング)ため、Hyをドメイン固有言語(DSL)として使用することができる[5]。Hyのコードは、コンパイル[note 1]時に両言語のコードをPythonのASTにステップ変換するため、標準ライブラリを含むPythonのライブラリにインポートしたり、ライブラリからHyのコードにアクセスしたりすることが可能である[note 2][6][7][8]。
以下はHy言語のドキュメントからの引用である[9]。
=> (print "Hy!")
Hy!
=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
=> (salutationsnm "YourName")
Hy YourName!